MadeiraMadeira boilerplate project to build scalable, testable and high performance Node.js microservices.
- NestJS: a progressive Node.js + TypeScript framework based on dependency injection;
- gRPC: a Remote Procedure Call framework that provides high performance communication between microservices.
- REST and gRPC layers;
- Husky Git hooks that automatically runs ESLint and Prettier before all commits;
ConfigService
: easily manage environment variables;Health
module: a gRPC and a REST endpoint that displays relevant information about the application status;- Docker infrastructure with Docker Compose.
$ cp example.env .env
$ npm install --target=12.0.0 --target_platform=linux --target_arch=x64 --target_libc=musl
Notice: these flags are needed to build the gRPC package to the correct container architecture. This issue will be fixed in the next major release of NestJS (nestjs/nest#6349).
$ docker-compose up
$ cp example.env .env
$ npm install
# local development
$ npm run start
# local watch mode
$ npm run start:dev
# local production mode
$ npm run start:prod
- gRPC: use a gRPC client (like Kreya or Insomnia) to hit
http://localhost:5000/health.HealthService.GetStatus
- REST:
http://localhost:3001/health
{
"alive": true,
"applicationName": "Core APIs Nest Service Template",
"grpcPort": "5000",
"restPort": "3001",
"env": "development",
"message": "Uncle Bob we love you"
}
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Download and extract the project, then:
$ mv nest-service-template-production {your_project_name}
$ git init
$ git remote add origin https://github.com/{user}/{repo}.git
Hint: use $ git remote -v
to verify new remote