Skip to content

This repository provides a complete backend setup featuring NestJS for the API, MongoDB for data storage, and Nginx as a reverse proxy and load balancer. Everything is fully containerized and managed with Docker Compose, offering an easy and efficient development and deployment workflow.

License

Notifications You must be signed in to change notification settings

claudiocaldeirao/nest-nginx-mongo

Repository files navigation

🧱 NestJS API with MongoDB and Nginx Load Balancer

This repository contains a full-stack backend setup using NestJS, MongoDB, and Nginx as a reverse proxy/load balancer. All components are containerized and orchestrated using Docker Compose for a seamless development and deployment experience.

πŸ—‚οΈ Project Structure

. 
β”œβ”€β”€ mongo/ # MongoDB configuration
β”œβ”€β”€ src/ # NestJS API source code
β”œβ”€β”€ nginx/ # Nginx configuration
β”œβ”€β”€ docker-compose.yml # Docker Compose setup
└── README.md # Project documentation

πŸš€ Features

  • ✨ NestJS - Scalable and modular server-side application framework.
  • πŸ—ƒοΈ MongoDB - NoSQL database integration for data persistence.
  • 🌐 Nginx - Reverse proxy/load balancer handling API traffic.
  • 🐳 Docker Compose - Simplified multi-container setup and orchestration.

πŸ› οΈ Getting Started

Prerequisites

Clone the Repository

$ git clone git@github.com:claudiocaldeirao/nest-nginx-mongo.git
$ cd nest-nginx-mongo

🐳 Running the Stack

$ docker compose up -d

πŸ§ͺ NestJS API Unit Tests

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

🧹 Useful Commands

# build image
$ docker build -t nest-api:1.0 .

# list images
$ docker images

# run container
$ docker run -p 3000:3000 nest-api:1.0 --d

# list running containers
$ docker container list

# stop running container
$ docker stop <container_id>

# stop all containers at once
$ docker stop $(docker ps -a -q)

# purge images
$ docker image prune --all --force

# delete all images
$ docker rmi -f $(sudo docker images -a -q)

# docker-compose to run multiple containers with nginx as load balancer
$ docker compose up -d

# stop docker-compose containers
$ docker compose down -v

πŸ§‘β€πŸ’» Author

Made by Your Luiz CaldeirΓ£o

πŸ“„ License

This project is licensed under the MIT License.

About

This repository provides a complete backend setup featuring NestJS for the API, MongoDB for data storage, and Nginx as a reverse proxy and load balancer. Everything is fully containerized and managed with Docker Compose, offering an easy and efficient development and deployment workflow.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published