Skip to content

A microservices Nestjs mvc app for concurrent ticket reservation.

Notifications You must be signed in to change notification settings

mohamedsalem331/nestjs-mvc-event-reservation

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Excursia

A Microservices Backend Nestjs MVC app for events & ticket reservation, allow user to authenticate and reserve any number of tickets. The app was heavily focused on ensuring it is a production reliable reservation app meaning it can handle concurrency, heavy requests loads and handling race conditions using mongoose optimistic concurrency and rabbitmq.

The app was load tested to handle over 5k requests making sure ticket reservation is optimized and race conditions wont errupt meaning thousand users can reserve tickets without read/write database confilict operations, using mongoose optimistic concurrency & transactions & rabbitmq.

alt text alt text alt text

Motivation

I always wanted to build a microservices backend app that can handle a common issues in real world usecases and that is race conditions. lets say there is a taylor swift event with only 50 tickets left and server received 100 requests with each request have atleast one ticket for reservation, how can we handle this issue?? using database transactions, locking, database isolation level and Rabbitmq VERY CAREFULLY! we can eliminate this issue.

Technologies

  • Nestjs
  • Handlebars
  • Mongodb
  • Stripe
  • Nodemailer
  • RabbitMQ
  • Docker
  • Kubernetes
  • Google Cloud

Installation

Make sure to have docker installed with rabbitmq image & mongodb atlas instance

$ npm install

## Running the app
Make sure to replace env variables like MONGO_URI with your mongoatlas uri config, stripe & nodemailer smtp secret.

```bash
# docker-compose up


Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

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.

Stay in touch

License

Nest is MIT licensed.

About

A microservices Nestjs mvc app for concurrent ticket reservation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published