https://github.com/flaviodelgrosso/fastify-forge
Armored template for Fastify projects ✨
https://github.com/flaviodelgrosso/fastify-forge
better-auth boilerplate fastify nodejs template typebox typescript
Last synced: about 2 months ago
JSON representation
Armored template for Fastify projects ✨
- Host: GitHub
- URL: https://github.com/flaviodelgrosso/fastify-forge
- Owner: flaviodelgrosso
- License: mit
- Created: 2024-12-24T14:26:12.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-05-05T18:37:54.000Z (about 2 months ago)
- Last Synced: 2025-05-05T19:39:47.229Z (about 2 months ago)
- Topics: better-auth, boilerplate, fastify, nodejs, template, typebox, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/fastify-forge
- Size: 895 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 🛡️ Fastify Forge 🛡️
[](https://www.npmjs.com/package/fastify-forge)
[](https://www.npmjs.com/package/fastify-forge)
[](https://img.shields.io/github/license/flaviodelgrosso/fastify-forge)
[](https://github.com/flaviodelgrosso/fastify-forge/actions/workflows/ci.yaml)Typescript based REST API lite boilerplate using [Fastify](https://fastify.dev/) framework.
## Installation
Clone the repo using:
```sh
npx fastify-forge@latest
```## Features
### Plugins
- [x] [@fastify/autoload](https://www.npmjs.com/package/@fastify/autoload) for automatic loading of plugins
- [x] [@fastify/cors](https://www.npmjs.com/package/@fastify/cors) for CORS support
- [x] [@fastify/helmet](https://www.npmjs.com/package/@fastify/helmet) for security HTTP headers
- [x] [@fastify/rate-limit](https://www.npmjs.com/package/@fastify/rate-limit) for rate limiting requests and preventing attackers to search for valid URLs.
- [x] [@fastify/under-pressure](https://www.npmjs.com/package/@fastify/under-pressure) for process load measuring
- [x] [@fastify/multipart](https://www.npmjs.com/package/@fastify/multipart) for file upload
- [x] [@fastify/sensible](https://www.npmjs.com/package/@fastify/sensible) to provide useful utilities to your Fastify instance
- [x] [fastify-better-auth](https://www.npmjs.com/package/fastify-better-auth) plugin for seamless authentication implementation using [better-auth](https://www.npmjs.com/package/better-auth)
### Swagger- [x] Swagger with [@fastify/swagger](https://www.npmjs.com/package/@fastify/swagger)
- [x] Beautiful OpenAPI UI with [@scalar/fastify-api-reference](https://www.npmjs.com/package/@scalar/fastify-api-reference)
### Type Safety and Schemas
- [x] JSON Schema builder with [TypeBox](https://www.npmjs.com/package/@sinclair/typebox)
- [x] Enhanced support for TypeBox with [@fastify/type-provider-typebox](https://www.npmjs.com/package/@fastify/type-provider-typebox)### Environment
- [x] Environment utility checker with [env-schema](https://www.npmjs.com/package/env-schema)
### Configurations
#### Linting and Formatting
- The project uses [biome](https://biomejs.dev/) to lint and format the codebase.
- Enforce commit message conventions with [commitlint](https://www.npmjs.com/package/@commitlint/cli).#### Git Hooks
- [husky](https://www.npmjs.com/package/husky) is used to manage git hooks.
#### PM2
- [pm2](https://www.npmjs.com/package/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 just Node.js with the latest TypeScript configuration support. You need Node v23.x, check `tsconfig.json` for details. Just run the following command in watch mode:
```sh
pnpm dev
```## 🚀 Building
To generate a production build, the project uses [tsup](https://github.com/egoist/tsup). Build server with command:
```sh
pnpm build
```## 🧪 Testing
To run tests, use the following command. It will produce a coverage report as well using `c8`.
```sh
pnpm test
```