Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.82 KB

File metadata and controls

59 lines (46 loc) · 1.82 KB

MakeMyTrip Clone

React frontend and Express API for booking flights, hotels, trains, buses and tours.

Requirements

Node 20+, Docker (for MongoDB).

Running it

docker compose up -d                     # MongoDB on :27017

cd Backend
cp .env.example .env                     # set JWT_SECRET to a long random string
npm install
npm run seed                             # inventory + demo user
npm run dev                              # API on :5000

cd ../Frontend
cp .env.example .env
npm install
npm run dev                              # app on :5173

Demo login: demo@makemytrip.test / demo12345

Layout

Backend/
  models/        User, Flight, Hotel, Train, Bus, Tour, Booking
  controllers/   auth and bookings
  Routes/        authRoutes, bookingRoutes, inventoryRoutes (factory for the five inventory types)
  Middlewares/   CheckAuth, roleCheck, Multer
  seed/          seed data and the seed script
Frontend/src/
  Api/           fetch client and one module per resource
  Pages/         routed screens
  Components/    UI building blocks per domain
  Context/       user, search, booking and cart state

API

Method Path
POST /api/auth/signup sets an httpOnly JWT cookie
POST /api/auth/login sets an httpOnly JWT cookie
POST /api/auth/logout clears the cookie
GET /api/auth/me current user
GET /api/flights /hotels /trains /buses /tours search, filters via query string
GET /api/flights/:code single item
GET /api/bookings own bookings
POST /api/bookings create a booking
PATCH /api/bookings/:id/cancel cancel a booking

Search accepts the text fields of the resource plus minPrice, maxPrice, minRating, sort and limit. Everything under /api/bookings requires the auth cookie.