- Fastify as the API server (fast and comes with Pino out of the box)
- AVA and supertest for testing
- Flow for totally optional type annotations
- Standardjs and Prettier for never-think-of-it-again code formatting
The thing is designed to be simple but extendable.
For example:
- Fastify makes the service very lightweight and fast. Just add routes under the
/routes
folder andapp.register(myRoute)
them inapp.js
or whatever.
An example route is the
/healthCheck
one, which also has an integration test (see below), and can be used to report service health to some monitoring solution.
-
config.js
holds all app-level configuration the rest of the app could use. The whole config object can be overridden at launch/deployment time using aCONFIG
environment variable. -
Write some bloody tests, man. Ava is super simple and I have added examples for unit and integration tests.
npm run test
for unit testsnpm run test:int
for integration tests
- The built-in logger is doing a few convenience tasks, but is really just a thin wrapper around pino. It outputs logs in JSON, ready for ELK or other centralised monitoring.
That's it. Now go build your shit.
- Dockerfile and docker-compose config
- K8s service definitions
- Some CI config
- Migrate from Flow to Typescript?
- Replace Koa with Fastify
- Add Serverless config for Lambda deployment