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 withnpm 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
npm install
npm run dev
npm start
npm test
docker compose up
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
.