Getting Started
Installation
- Install dependencies.
npm install- Create a local environment file.
cp .env.example .env- Run development mode.
npm run dev- Open endpoints.
- API Root:
http://localhost:3000/ - Swagger:
http://localhost:3000/docs - Health:
http://localhost:3000/health
Bootstrap With NPX
Scaffold a new project directly from this starter:
npx create-nest-fastify-app my-apiFor package owner (one-time setup before global NPX usage):
npm login
npm publish --access publicLocal test without publishing:
npm link
npx create-nest-fastify-app my-apiStarter cURL Commands
Quick smoke tests after running the server:
curl -X GET http://localhost:3000/
curl -X GET http://localhost:3000/health
curl -X GET http://localhost:3000/not-foundAvailable Scripts
| Script | Description |
|---|---|
npm run dev | Start in watch mode |
npm run build | Build to dist |
npm run start | Start app |
npm run start:debug | Start app in debug mode |
npm run start:prod | Run compiled output |
npm run lint | Run ESLint with autofix |
npm run test | Run unit tests |
npm run test:e2e | Run e2e tests |
Project Structure
src/
common/
filters/
http-exception.filter.ts
interceptors/
response.interceptor.ts
pipes/
request-validation.pipe.ts
database/
database.config.ts
database.module.ts
database.types.ts
drizzle.provider.ts
health/
health.controller.ts
health.module.ts
utils/
response/
index.ts
response-template.util.ts
app.controller.ts
app.module.ts
app.service.ts
main.ts