This is a comprehensive, full-stack, real-world example of a reservation booking system built using NestJS. This system handles reservations, payments, email notifications, and persists data to a MongoDB database. It is structured as a microservices architecture and contains various branches demonstrating different implementations like MySQL with TypeORM and RabbitMQ.
Note: This project was for learning purposes. Any secret keys committed before November 2nd are invalidated and no longer in use.
The project is structured into multiple apps and common libraries:
- Reservations: Handles all reservation logic.
- Auth: Manages authentication and authorization.
- Payments: Processes payments.
- Notifications: Sends email notifications.
- Common Libraries: Shared code across all services.
- Dockerfiles: For containerizing the applications.
- Kubernetes Manifests: For orchestrating the deployment.
- Docker & Docker Compose
- Node.js
- PNPM (Package manager)
- Kubernetes (Optional)
-
Clone the repository
git clone https://github.com/your-repo/nest-js-microservices.git
-
Navigate to project directory
cd nest-js-microservices
-
Install dependencies using PNPM
pnpm install
-
Copy
.env.example
to.env
for each app and fill in environment variablescp apps/{service-name}/.env.example apps/{service-name}/.env
-
Build and Start Services with Docker Compose
docker-compose up --build
Follow the Setup and Installation steps above.
This project is also deployed on Google Cloud.
Start services:
docker-compose up
Stop services:
docker-compose down
Build the project:
pnpm run build
Start in development:
pnpm run start:dev {service-name}
Run unit tests:
pnpm run test
Run unit tests in watch mode:
pnpm run test:watch
Run e2e tests:
pnpm run test:e2e
typeorm
: Implementation with MySQL and TypeORM.rabbitmq
: Implementation using RabbitMQ for message brokering.
The project includes Kubernetes manifests and Helm charts for deployment.
Apply Kubernetes manifests:
kubectl apply -f k8s/
Deploy using Helm:
helm install -f helm/values.yaml nest-js-microservices helm/
If you have suggestions or issues, please open an issue or create a PR.