An opinionated template for spinning up typescript services.
It's often useful to have a consolidated template for spinning up services, in order to skip configuration and boilerplate.
Running locally, quickly:
docker-compose run --dev yarn migrate
to get the database ready.docker-compose up dev
to run the service atlocalhost:3000
docker-compose down
to clean up when you're done.
To fully set up (see more in the 'What's Needed' section below):
- Instantiate a new repository using this as a template.
- Replace all instances of
typescript-service-template
with the name of your project. - In your database server, create a new database for your service.
- Replace all instances of
typescript_service_template
with the name of your database. - Add the following github secrets to your repository:
- POSTGRES_HOST
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_PORT
- AZURE_CREDENTIALS
- REGISTRY_USERNAME
- REGISTRY_PASSWORD
- AZURE_CREDENTIALS
- REGISTRY_USERNAME
- REGISTRY_PASSWORD
- Let CI/CD do the magic. Probably. I wrote this over a few weekends and may have forgotten something...
This repository contains:
- Typescript
- Apollo Server 2.0
- Dockerized local development through docker-compose, including a database.
- Prisma, and configuration + connections, assuming postgres.
- Tests, through Jest.
- A CI/CD pipeline through Github Actions.
- Deployment to a kubernetes cluster on Azure, including an ingress service.
- A pile of Github Secrets
- An AKS resource on Azure
- A container registry
- A postgres database