This is a github template for API Service, built with:
- Typescript
- Fastify 4
- Knex & ObjectionJS
- IORedis
- Spec-first-approach using OpenAPI/Swagger
- Env variables using .env for development
- Develop inside container with hot reload
-
Create your own repo using this template
-
Clone to your development machine
-
Run
yarn
-
Start development by running
yarn docker-dev
. The example app will run on http://localhost:3000 (Swagger-UI is available) -
Edit and the code will recompile between changes.
You also can run the development server without docker using ```yarn dev```
- In VS Code, open Run and Debug (Ctrl+Shif+D)
- Launch Fastify Server
- Set breakpoints and stuffs
- App Config (
FastifyInstance.config
) - IORedis (
FastifyInstance.redis
) - Knex (
FastifyInstance.objectionjs.knex
) - ObjectionsJS Models (
FastifyInstance.objectionjs.models.YourModels
)
- ReplyWrapper (
FastifyReply.setApi({code: string, message: string, data: object, status: string})
)