Skip to content

Armored Template for Fastify projects using TypeScript 🛡️

License

Notifications You must be signed in to change notification settings

flaviodelgrosso/fastify-forge

Repository files navigation

🛡️ Fastify Forge 🛡️

CI

Typescript based REST API lite boilerplate using Fastify framework.

Features

Plugins

Swagger

Type Safety and Schemas

swagger-ui

Environment

Configurations

Linting and Formatting

  • The project uses biome to lint and format the codebase.
  • Enforce commit message conventions with commitlint.

TypeScript

  • fastify/tsconfig is used to provide a base TypeScript configuration for Fastify projects.

Git Hooks

  • husky is used to manage git hooks.

PM2

  • pm2 is a process manager that provides a simple way to run the server in cluster mode with built-in load balancing feature. You can edit the process.yml file to customize the app configuration.

How to use

1. Clone this repo & install dependencies

Install Node dependencies:

pnpm install

2. Start the Fastify server

Running development server is pretty straightforward. It uses tsx, the easiest way to run Typescript in Node.js. Just run the following command in watch mode:

pnpm dev

🚀 Building

To generate a production build, the project uses tsup. Build server with command:

pnpm build

🧪 Testing

To run tests, the project uses borp that is a typescript-aware test runner for Node.js built-in testing library. It also supports c8 coverage. Borp is very usefull if you want avoid struggling with loaders and false positives uncovered code.

pnpm test