A progressive Node.js framework for building efficient and scalable server-side applications.
Run long-running tasks with NestJS with the techniques demonstrated here
- System design primer project demonstrates how to design a backend project in a way that can scale gracefully
- When it comes to long-running tasks and tasks that consume too much computing power, it is interesting to handle them asynchronously in a so-called, worker.
- So an optimal approach is, to move the heavy/long-running task to a worker, and communicate with them asynchronously via queues, like Kafka, SQS or RabbitMQ.
- For this project, I'm using RabbitMQ as the Queue message broker, but the choice is up to you and what you feel most comfortable using
The following flow explains how everything works
$ yarn install
- PS For running both apps correctly, make sure that the docker engine is running on your machine.
# start docker-compose file
$ docker-compose up
# development with watch mode
## web app
$ yarn start:dev
## worker app
$ yarn start:dev worker-backend-app
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
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.
- Project author - Mpcsj
- Youtube channel - Mpcsj Tech Tips
Nest is MIT licensed.