- Fastify as core (Can be customized / replaced by expressjs,...)
- Modern typescript / ESM
- Typescript documentation with typedoc
- DB schema migration (by versions)
- Lightweigh ORM with objection / knex
- Common securities (xss, rate limit, csrf, csp, header protection)
- OpenAPI 3.0 documentation in a modular way
- DB unit test with Jest / Typescript / ESM
- Restful API testing with supertest
- Static file serving.
- Static source code analysis and checks with eslint
- Source code auto format with prettier
- Tested with Node.js 14+
$ git clone xxx
$ cd project
$ yarn install
# For development
./scripts/install-dev-dependencies.sh
./scripts/install-build-dependencies.sh
At first time, you need to run Database schema generation. Configure your database information at /knexfile.js
, then run: yarn migrate-env accorndingly, for example:
# Generate db schemas for development
yarn migrate-dev
# Generate db schemas for testing
yarn migrate-test
# Generate db schemas for production
yarn migrate-prod
# Start development server with hot reload (nodemon)
$ yarn dev
# Start development server with buit and NOT hot-reload
$ yarn start-dev
# Format with prettier
$ yarn format
# Check code lint (eslint)
$ yarn lint
# Generate class documentation (typescript docs) (docs folder by default) : currently NOK with ESM
$ yarn docs
# Start test server (dont need, integrated with concurrently)
# yarn start-test
# Start to execute the tests
yarn test
# build for production
$ yarn build
# start production app
$ yarn start
# Build docker image
$ scripts/build-docker-image.sh
# Start container
$ cd docker
$ docker-compose up
To generate latest openapi (swagger) docs:
yarn build-api-docs
- http://localhost:3000/index.html -> static file serving
- http://localhost:3000/documentation/ -> api documenation
- http://localhost:3000/api/v1/users/ -> sample
- (docker) adminer: http://localhost:8089