/nestjs-standalone

This application was developed to demonstrate the concept of standalone, where each module works independently and self-sufficiently.

Primary LanguageTypeScript

NestJS Standalone

This application was developed to demonstrate the concept of standalone, where each module works independently and self-sufficiently.

Badge

Demo

demo.mp4

What is a standalone application?

A standalone application is software that can run independently, without the need to install other programs. Typically, a standalone application incorporates all the resources and libraries necessary to operate without relying on additional software. In the context of this NestJS application, we can interpret that the modules can work autonomously.

Application flow

The application flow in the context of NestJS is structured into modules, and each module is designed to operate independently, as if it were a separate application. Each module has its own initialization script and is contained in its own container.

imagem representativa dos container

By dividing the application into separate modules, each in its own container, communication between these services is maintained through messaging, using the RabbitMQ broker. This approach allows for a more distributed and scalable architecture, where each module can be scaled individually as needed.

imagem representativa da comunicação dos serviços

This organization provides a clear view of the application deployment environment. For example, if there is a need to scale the application, simply make a configuration in the docker-compose file to specify how many instances of each service are desired.

This separation into autonomous modules facilitates not only scalability, but also maintenance, development and debugging of the application, since each part can be treated independently, without interfering with the others. Furthermore, this approach promotes a more resilient architecture, where a failure in one module does not necessarily affect the functioning of the others.


🛠️ Prerequisites

  • Docker e docker-compose installed

🎲 Running the Backend

Create the .env file and copy the variables from .env.example

cp ./.env.example ./.env
  • Make changes when necessary

Run application

docker-compose up -d 

Check application logs

docker logs -f {container-name} --tail 200

Enter the application container

docker exec -it {container-name} sh

📖 API documentation

Documentação

👨🏼‍💻 Technologies

The following tools were used to build the project:

🛠️ Comments

  • Install dependencies inside the container
  • The documentation is not available if the NODE_ENV environment variable is set to production

🌍 Read this in other language