Skip to content

Fastify rest api template with built in configurations to run cloud native

Notifications You must be signed in to change notification settings

lucasrodriguex/fastify-rest-api-template

Repository files navigation

🚀 Fastify Boilerplate

This project contains a template to build cloud-native REST APIs using Fastify with all necessary configurations, including:

  • Language: TypeScript
  • Linting: ESLint configured for code quality and consistency
  • Logging: Configured using Elastic Search ECS logging with traceId for better traceability
  • Monitoring: Built-in monitoring using Prometheus at the /metrics endpoint
  • Architecture: Follows the Hexagonal Architecture pattern for a clean and maintainable codebase
  • Health Check: Health check endpoint at /health, customizable to validate dependencies
  • Swagger: Auto-generated Swagger documentation available at the /swagger route, customizable for your needs
  • Tests: Unit and integration test examples in the __test__ folder, runnable with npm test
  • Docker: Dockerfile with distroless image and docker-compose file for easy cloud deployment
  • API Default Port: 3000, changeable via the API_PORT environment variable

🛠️ Setup

npm install

🔄 Run development with live reload

npm run dev

🚀 Run application

npm start

🧪 Run tests

npm test

🐳 Run with Docker using docker-compose

docker compose up

🐞 Run VSCode Debug

This project is configured to run in VSCode, located in the .vscode folder.

To run in Debug mode in VSCode, click on Run -> Start Debugging.

Debug configuration is registered as Launch Program with ts-node.

About

Fastify rest api template with built in configurations to run cloud native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published