Entire project is written using TypeScript 4. No JS files should be necessary.
Eslint and Prettier are configured in the project using predefinied @hypedevs/eslint-config library. You can adjust them to your liking by modifying the eslint
section in package.json
.
Fastify is the core framework used for HTTP in this project.
As Fastify supports JSON Schema out of the box each request is described in as much detail as possible. Check out *.ctrl.ts
files to see how to endpoint are provided with dedicated OpenAPI definition.
After any change in routes JSON Schema definition with api started up, the ./openapi.json file will be reconstructed, transforming and combining JSON Schemas from controllers into a single JSON. It's commited to the repo and serve as reference for current API interface.
Server provide swagger panel for documentation browsing: http://localhost:3000/documentation
A util library that allows type inference from JSON Schemas directly into route handler is present in this project. I built this library some time ago but didn't publish it yet cause it miss tests - the plan is to make it public when I have time - currently it's available in the lib/fastify-typed-route directory with the whole git log because it was cloned as submodule from the original repo to lib dir.