- Node.js + Express backend
- MongoDB database
- React frontend
- NGINX reverse proxy
- Docker Compose orchestration
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- Backend: Node.js, Express, Mongoose
- Frontend: React + Vite
- Database: MongoDB
- Admin UI: Mongo Express
- Reverse Proxy: NGINX
- Containerization: Docker + Docker Compose
Make sure you have installed:
- Docker
- Docker Compose
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=3000From the project root:
docker-compose up --buildTo stop the project:
docker-compose downAfter the containers are running:
-
Frontend:http:// localhost
-
Backend API:
http://localhost/api/users -
Health check:
http://localhost/health -
Mongo Express:
http://localhost:8081
- Built with React and served by NGINX
- Runs on port 80 through the reverse proxy
- Express API server
- Runs on port 3000 internally
- Connects to MongoDB using the configured Mongo URI
- Runs on port 27017 internally
- Stores project data persistently in a Docker volume
- Web UI for MongoDB inspection
- Available at
http://localhost:8081
- 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.
docker-compose ps
docker-compose logs -fIf 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
.envvalues are valid - check MongoDB health status
- verify the backend and MongoDB are on the same Docker network