A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
This project uses a monorepo structure with multiple services:
apps/
auth-service/
concert-service/
booking-service/
notification-service/
libs/
- Install dependencies:
npm install
- Start all services in development mode (with hot-reload):
npm run start:dev
- Build all services:
npm run build
- Start all services in production mode:
npm run start:prod
- Build and start all services with Docker:
docker-compose up --build
- Each service has its own
.envfile inapps/<service>/.env. - Example files:
apps/auth-service/.env.example, etc. - Copy
.env.exampleto.envand update values as needed.
A ready-to-use Postman Collection is provided for API testing: Concert Booking API.postman_collection.json.
- Open Postman and click "Import".
- Select the file
Concert Booking API.postman_collection.jsonfrom the project root. - Create a new environment in Postman and add these variables:
auth_host(e.g., http://localhost:3001)concert_host(e.g., http://localhost:3002)booking_host(e.g., http://localhost:3003)admin_token,user_token,concertId,seatTypeId,userId(as needed)
- Select the environment and run requests for each service.
This allows you to test Auth, Concert, and Booking APIs independently, even if they run on different ports or hosts.
This project includes a k6 load test to simulate high-concurrency booking scenarios and ensure the system prevents overbooking and duplicate bookings.
load-test/booking-test.js: Main k6 test script for booking concurrencyload-test/setup.js: Script to initialize test data (users, concerts, seat types)
- Make sure all services (auth, concert, booking, notification, MongoDB, Redis) are running (e.g., via
docker-compose up). - Install k6 if you haven't:
brew install k6 # macOS # or see https://k6.io/docs/getting-started/installation/
- Run the load test:
k6 run load-test/booking-test.js
- The test simulates 1,000 concurrent users booking tickets.
- Key metrics:
booking_errors: Rate of failed bookings (should be low if system is correct)http_req_failed: Rate of failed HTTP requestshttp_req_duration: Response time percentiles
- Check the summary at the end for threshold violations and overall system performance.
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.