The aim of this repository is to provide a concrete example of a Fastify application using what are considered best practices by the Fastify community.
Prerequisites: You need to have Node.js version 22 or higher installed.
Install the dependencies:
npm install
You can run a MySQL instance with Docker:
docker compose up
To run it in the background:
docker compose up -d
To create and update the database schema, run the migrations:
npm run db:migrate
To populate the database with initial data, run:
npm run db:seed
To build the project:
npm run build
In dev mode:
npm run dev
Open http://localhost:3000 to view it in the browser.
In production mode:
npm run start
To run the tests:
npm run test
dev
and start
leverage fastify-cli,
but you can run the demo as a standalone executable (see server.ts):
npm run standalone
To check for linting errors:
npm run lint
To check and automatically fix linting errors:
npm run lint:fix
To learn more about Fastify, check out the Fastify documentation.