Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Node MongoDB DevOps Project

A full-stack application with

  • Node.js + Express backend
  • MongoDB database
  • React frontend
  • NGINX reverse proxy
  • Docker Compose orchestration

Project Structure

node-mongodb-devops/
├── app/
│   ├── Dockerfile
│   ├── package.json
│   └── src/
├── frontend/
│   ├── Dockerfile
│   ├── package.json
│   └── src/
├── docker/
│   └── nginx/
│       └── nginx.conf
├── Docker-compose.yml
├── .dockerignore
├── .env.example
├── README.md
└── .gitignore

Tech Stack

  • Backend: Node.js, Express, Mongoose
  • Frontend: React + Vite
  • Database: MongoDB
  • Admin UI: Mongo Express
  • Reverse Proxy: NGINX
  • Containerization: Docker + Docker Compose

Prerequisites

Make sure you have installed:

  • Docker
  • Docker Compose

Environment Setup

Create a .env file in the project root based on .env.example.

Example:

MONGO_ROOT_USER=admin
MONGO_ROOT_PASSWORD=password123
MONGO_DB_NAME=devopsdb
ME_PORT=8081
ME_CONFIG_BASICAUTH_USERNAME=admin
ME_CONFIG_BASICAUTH_PASSWORD=password123
PORT=3000

Run the Project

From the project root:

docker-compose up --build

To stop the project:

docker-compose down

Access the Application

After the containers are running:

  • Frontend:http:// localhost

  • Backend API: http://localhost/api/users

  • Health check: http://localhost/health

  • Mongo Express: http://localhost:8081

Services

Frontend

  • Built with React and served by NGINX
  • Runs on port 80 through the reverse proxy

Backend

  • Express API server
  • Runs on port 3000 internally
  • Connects to MongoDB using the configured Mongo URI

MongoDB

  • Runs on port 27017 internally
  • Stores project data persistently in a Docker volume

Mongo Express

  • Web UI for MongoDB inspection
  • Available at http://localhost:8081

Notes

  • The NGINX configuration routes frontend requests to the React app and API requests to the backend.
  • The app is intended for local development and testing.
  • For production deployments, consider adding HTTPS, rate limiting, and stricter security settings.

Common Commands

docker-compose ps
docker-compose logs -f

Troubleshooting

If the frontend is blank:

  • refresh the browser with Ctrl + F5
  • ensure the containers are running with docker-compose ps
  • check logs with docker-compose logs -f nginx frontend backend

If the backend cannot connect to MongoDB:

  • confirm the .env values are valid
  • check MongoDB health status
  • verify the backend and MongoDB are on the same Docker network

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages