Skip to content

rvs123720/rail-reserve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Railway Reservation System

A full-stack Railway Reservation System built with React, Tailwind CSS, Node.js, Express, MongoDB, and JWT authentication.

Features

  • User signup, login, logout, and protected dashboard
  • Train search by source, destination, date, and exact stop-count filters
  • Route-aware train details with timings, duration, and seat availability
  • Smart seat allocation with window, lower, and aisle preferences
  • Segment-based seat booking so seats can be reused across non-overlapping route segments
  • Mock payment lifecycle with success, failure, and refund statuses
  • PNR generation, ticket records, booking history, waitlist promotion, and cancellations
  • Seed scripts for stations, trains, seats, and demo users

Monorepo Structure

client/   React + Tailwind frontend
server/   Express + MongoDB backend

Local Setup

  1. Install dependencies:

    npm install
  2. Create environment files:

    • Copy server/.env.example to server/.env
    • Copy client/.env.example to client/.env
  3. Start MongoDB locally or provide a MongoDB Atlas connection string.

  4. Seed the database:

    npm run seed
  5. Run the backend:

    npm run server:dev
  6. Run the frontend in a second terminal:

    npm run client:dev

Demo Accounts

  • User: aarav@example.com / Password123!
  • User: priya@example.com / Password123!
  • Admin seed (future use): admin@railway.com / Password123!

Important Notes

  • The frontend expects the backend at http://localhost:5000.
  • Payments are mocked and do not connect to a real payment gateway.
  • Waitlist promotion runs automatically after confirmed ticket cancellation.

API Highlights

  • POST /api/auth/signup
  • POST /api/auth/login
  • GET /api/auth/me
  • GET /api/trains/search
  • GET /api/trains/:id
  • POST /api/bookings/quote
  • POST /api/bookings
  • GET /api/bookings/me
  • GET /api/bookings/:pnr
  • PATCH /api/bookings/:id/cancel
  • POST /api/payments/mock-checkout
  • PATCH /api/payments/:id/mock-complete

About

Rail Reserve is a full-stack railway reservation app with secure JWT auth, train search by route/date, stop-based filtering, smart seat allocation, segment-wise booking, mock payments, waitlist auto-confirmation, ticket history, and cancellation support. Built with React, Tailwind, Express, and MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages