https://github.com/batjko/api-boilerplate
There are many node service boilerplates, but this one is mine.
https://github.com/batjko/api-boilerplate
api-boilerplate api-rest ava boilerplate fastify flowtype nodejs pino
Last synced: 5 months ago
JSON representation
There are many node service boilerplates, but this one is mine.
- Host: GitHub
- URL: https://github.com/batjko/api-boilerplate
- Owner: batjko
- Created: 2019-03-16T01:01:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2026-01-22T08:04:05.000Z (5 months ago)
- Last Synced: 2026-01-22T22:59:48.132Z (5 months ago)
- Topics: api-boilerplate, api-rest, ava, boilerplate, fastify, flowtype, nodejs, pino
- Language: JavaScript
- Homepage:
- Size: 1.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pat's API boilerplate
[](http://standardjs.com) 
## Shit included:
1. **Fastify** as the API server (fast and comes with **Pino** out of the box)
2. **AVA** and **supertest** for testing
3. **Flow** for totally optional type annotations
4. **Standardjs** and **Prettier** for never-think-of-it-again code formatting
## Design
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 and `app.register(myRoute)` them in `app.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 a `CONFIG` 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 tests
> `npm 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.
## Todo:
- [x] Dockerfile and docker-compose config
- [ ] K8s service definitions
- [x] Some CI config
- [ ] Migrate from Flow to Typescript?
- [x] Replace Koa with Fastify
- [ ] Add Serverless config for Lambda deployment