A production-grade vacation rental web app demonstrating containerized full-stack deployment with Docker, MongoDB, Express, and Nginx.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Docker Network (bridge) β
β β
β βββββββββββββββ βββββββββββββββ ββββββββββββββ β
β β Frontend ββββββΆβ Backend βββββΆβ MongoDB β β
β β Nginx :80 β β Express:5000β β :27017 β β
β β (Port 3000)β β (Port 5000)β β β β
β βββββββββββββββ βββββββββββββββ ββββββββββββββ β
β β² β² β
β β ββββββββββββββ β
β Browser β Seed Job β β
β β (one-shot) β β
β ββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, Vanilla JS |
| Web Server | Nginx (reverse proxy + static serving) |
| Backend | Node.js 20, Express.js |
| Database | MongoDB 7.0 |
| Containerization | Docker, Docker Compose |
| Data | 30 seeded property listings |
staynest/
βββ docker-compose.yml # Orchestrates all services
βββ mongo-init.js # DB user & schema initialization
βββ .gitignore
βββ README.md
βββ frontend/
β βββ index.html # SPA - listings page
β βββ Dockerfile # Nginx static server
β βββ nginx.conf # Proxy + caching config
βββ backend/
βββ server.js # Express app entry point
βββ package.json
βββ .env # MongoDB credentials
βββ Dockerfile # Multi-stage Node build
βββ models/
β βββ Listing.js # Mongoose schema
βββ routes/
β βββ listings.js # CRUD REST API
βββ seed/
βββ seed.js # Seeds 30 property listings
- Docker Desktop installed
- Ports 3000, 5000, 27017 available
# Clone the repo
git clone https://github.com/devops-swapnil/staynest.git
cd staynest
# Build and start all containers
docker compose up --build
# The seed job runs automatically on first startOpen http://localhost:3000 in your browser.
docker compose down -v # also removes volumesBase URL: http://localhost:5000/api
| Method | Endpoint | Description |
|---|---|---|
| GET | /listings |
Get all listings |
| GET | /listings?category=Beach |
Filter by category |
| GET | /listings?search=Maldives |
Search by keyword |
| GET | /listings/:id |
Get single listing |
| POST | /listings |
Create listing |
| PUT | /listings/:id |
Update listing |
| DELETE | /listings/:id |
Delete listing |
| GET | /health |
Health check |
| Field | Value |
|---|---|
| Root User | root |
| Root Password | rootpassword |
| App User | staynest_user |
| App Password | staynest_pass |
| Database | staynest |
| Auth Source | staynest |
- Frontend:
nginx:1.25-alpineβ serves static files, proxies/api/*to backend - Backend:
node:20-alpine(multi-stage build) β runs as non-root user for security - MongoDB:
mongo:7.0with persistent volume and health checks - Seed: One-shot job that seeds 30 listings on first start
- All services communicate over an isolated Docker bridge network
- Multi-stage Docker builds (smaller images)
- Health checks on all services
- Dependency ordering with
condition: service_healthy - Non-root container user (security best practice)
- Nginx gzip compression & static asset caching
- Environment-based configuration via
.env - Persistent MongoDB volume
Built as a DevOps project demonstrating containerization, microservices architecture, and full-stack development.
This project is open source and available under the MIT License.
|
π¨π»βπ»CS Engineer | AWS & DevOps Specialist -π―focused on building reliable, observable, and scalable systems. |

