This project is a multi-container application built using Docker and Docker Compose.
It includes:
- A Node.js (Express) backend API
- A MongoDB database
- A CI pipeline using GitHub Actions
The goal of this project was to gain hands-on experience with containerisation, service communication, and CI/CD workflows in a DevOps environment.
- Node.js
- Express
- MongoDB
- Docker
- Docker Compose
- GitHub Actions (CI/CD)
- REST API with GET and POST endpoints
- MongoDB integration using Mongoose
- Persistent storage using Docker volumes
- Environment variable configuration via
.env - Multi-container orchestration with Docker Compose
- Automated Docker image build and push using CI/CD
docker-node-mongo-app/
│
├── backend/
│ ├── Dockerfile
│ ├── package.json
│ └── server.js
│
├── docker-compose.yml
├── .github/workflows/
├── .env
└── README.md
git clone https://github.com/izharn001/docker-node-mongo-app.git
cd docker-node-mongo-app
docker compose up --build
Returns a message confirming the API is running.
Returns all saved messages.
Create a new message:
{
"text": "hello"
}curl -X POST http://localhost:3000/messages -H "Content-Type: application/json" -d "{\"text\":\"hello\"}"
curl http://localhost:3000/messages
MongoDB data is stored using a Docker volume:
mongo-data
This ensures data persists even after containers are restarted.
The application uses a .env file:
MONGO_URI=mongodb://mongo:27017/mydb
This project includes a CI pipeline using GitHub Actions that:
- Builds the Docker image
- Authenticates with Docker Hub
- Pushes the image to Docker Hub
The pipeline is triggered on every push to the main branch.
- Docker containerisation
- Multi-container architecture using Docker Compose
- Container networking (service-to-service communication)
- Persistent storage using volumes
- CI/CD automation with GitHub Actions
- Add frontend service
- Implement authentication
- Deploy to cloud (AWS / Kubernetes)
Built by Izharn Mohammed as part of a DevOps learning journey.