Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏑 StayNest β€” Airbnb-like Full-Stack Rental Platform

A production-grade vacation rental web app demonstrating containerized full-stack deployment with Docker, MongoDB, Express, and Nginx.

Docker Node.js MongoDB Nginx


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Docker Network (bridge)               β”‚
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Frontend  │────▢│   Backend   │───▢│  MongoDB  β”‚   β”‚
β”‚  β”‚  Nginx :80  β”‚     β”‚ Express:5000β”‚    β”‚  :27017    β”‚   β”‚
β”‚  β”‚  (Port 3000)β”‚     β”‚  (Port 5000)β”‚    β”‚            β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚         β–²                                      β–²         β”‚
β”‚         β”‚                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚     Browser                            β”‚ Seed Job   β”‚    β”‚
β”‚                                        β”‚ (one-shot) β”‚    β”‚
β”‚                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Tech Stack

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

πŸ“ Project Structure

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

⚑ Quick Start

Prerequisites

  • Docker Desktop installed
  • Ports 3000, 5000, 27017 available

Run the full stack

# 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 start

Open http://localhost:3000 in your browser.

Screenshots

1. Web Page

2. Search tab and footer

Tear down

docker compose down -v   # also removes volumes

πŸ”Œ API Endpoints

Base 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

πŸ” MongoDB Credentials

Field Value
Root User root
Root Password rootpassword
App User staynest_user
App Password staynest_pass
Database staynest
Auth Source staynest

🐳 Docker Details

  • 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.0 with 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

πŸ“‹ DevOps Highlights

  • 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.


πŸ“„ License

This project is open source and available under the MIT License.


✍️ Author

SWAPNIL MALI.

GitHub Profile

πŸ‘¨πŸ»β€πŸ’»CS Engineer | AWS & DevOps Specialist -🎯focused on building reliable, observable, and scalable systems.


About

🏑 StayNest β€” Airbnb-like Full-Stack Rental Platform | A production-grade vacation rental web app demonstrating containerized full-stack deployment with Docker, MongoDB, Express, and Nginx.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages