This project implements a microservices architecture using NestJS, featuring multiple services and a comprehensive monitoring setup.
The project consists of the following services:
- API Gateway: Main entry point for all client requests
- Auth Service: Handles authentication and authorization
- Billing Service: Manages billing and payment processing
- Docker and Docker Compose
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd nestjs-microservice
- Start the development environment:
docker-compose -f docker-compose.dev.yml up -d
To start the production environment:
docker-compose -f docker-compose.prod.yml up -d
The project includes a monitoring stack with Prometheus and Grafana:
- Prometheus: Available at
http://localhost:9090
- Grafana: Available at
http://localhost:3001
- Default credentials:
- Username:
admin
- Password:
admin
- Username:
- Default credentials:
To start the monitoring stack:
docker-compose -f docker-compose.monitoring.yml up -d
- API Gateway:
3000
- Auth Service:
3001
- Billing Service:
3002
- Prometheus:
9090
- Grafana:
3001
Configuration files are located in the configs/
directory:
- Prometheus configuration:
configs/prometheus.yml
- Grafana provisioning:
configs/grafana/provisioning/
Each service can be run independently:
# Auth Service
cd auth
npm install
npm run start:dev
# Billing Service
cd billing
npm install
npm run start:dev
# API Gateway
cd api-gateway
npm install
npm run start:dev
security.protocol=SASL_PLAINTEXT sasl.mechanism=PLAIN sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password=" admin-secret";