You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GET /api/v1/health — DB state + uptime (used by Docker HEALTHCHECK)
DevOps / Docker
Feature
Implementation
Multi-stage Build
deps stage + production stage — minimal final image
Non-root User
adduser appuser — containers never run as root
Docker HEALTHCHECK
Polls /api/v1/health every 30s
Dev Hot-reload
docker-compose.override.yml mounts src/ and runs nodemon
Named Volumes
MongoDB data persists across container restarts
Graceful Shutdown
SIGTERM/SIGINT → drain connections → close DB → exit 0
API Endpoints
Tours
Method
Endpoint
Auth
Description
GET
/api/v1/tours
🔒
Get all tours (filterable, sortable, paginated)
GET
/api/v1/tours/:id
Public
Get single tour
POST
/api/v1/tours
🔒 admin/lead-guide
Create a tour
PATCH
/api/v1/tours/:id
🔒 admin/lead-guide
Update a tour
DELETE
/api/v1/tours/:id
🔒 admin
Delete a tour
GET
/api/v1/tours/top-5-cheap
Public
Alias — top 5 cheapest tours
GET
/api/v1/tours/tour-stats
Public
Aggregated stats by difficulty
GET
/api/v1/tours/monthly-plan/:year
🔒
Monthly tour schedule
Users & Auth
Method
Endpoint
Auth
Description
POST
/api/v1/users/signup
Public
Register a new user
POST
/api/v1/users/login
Public
Login and receive JWT
POST
/api/v1/users/forgotPassword
Public
Request password reset email
GET
/api/v1/users
🔒
Get all users
System
Method
Endpoint
Auth
Description
GET
/api/v1/health
Public
DB + uptime health check
Query String Features
All list endpoints support:
Filtering: ?price[lte]=1000&difficulty=easy
Sorting: ?sort=-ratingsAverage,price
Field Selection: ?fields=name,price,duration
Pagination: ?page=2&limit=10
Quick Start
Option 1 — Docker (Recommended)
# Copy example env file and fill in your values
cp config.env.example config.env
# Start app + MongoDB with one command
npm run docker:up
# App will be available at → http://localhost:8000# Health check → http://localhost:8000/api/v1/health
Option 2 — Local Development
# Prerequisites: Node.js 22+, MongoDB running locally
npm install
# Edit config.env with your local MongoDB URI
npm run dev
Tech Stack
Runtime: Node.js 22 (LTS)
Framework: Express 4.x
Database: MongoDB 7 via Mongoose 5 ODM
Auth: JSON Web Tokens (JWT)
Logging: Winston + winston-daily-rotate-file
Security: Helmet, express-rate-limit, express-mongo-sanitize, xss-clean, hpp, cors
RESTful API for tour booking system built with Node.js, Express, and MongoDB. Features JWT authentication, role-based access control, and advanced querying capabilities.