The Railway Management System (RMS) is a backend REST API built using Spring Boot that manages railway operations such as train management, passenger management, ticket booking, payments, and admin operations. The system uses JWT Authentication, PostgreSQL Database, and Swagger API Documentation, and is deployed on Render.
- Backend: Spring Boot
- Database: PostgreSQL (Neon Cloud / Local)
- Security: Spring Security + JWT Authentication
- API Documentation: Swagger (OpenAPI)
- Build Tool: Maven
- Deployment: Render
- Version Control: GitHub
┌───────────────────────┐
│ Client │
│ (Browser / Postman) │
└──────────┬────────────┘
│ HTTP Requests
▼
┌───────────────────────┐
│ Spring Boot API │
│ Railway Management │
└──────────┬────────────┘
│
┌──────────────────┼──────────────────┐
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Controllers │ │ Services │ │ Repositories│
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌───────────────────────┐
│ PostgreSQL Database │
│ (Neon / Local) │
└───────────────────────┘
│
▼
┌───────────────────────┐
│ Swagger UI │
│ API Documentation │
└───────────────────────┘
User Login → Server Generates JWT Token
Client Stores Token
Client Sends Token in Authorization Header
JWT Filter Validates Token
If Valid → API Access Granted
If Invalid → Unauthorized
Authorization Header Format:
Authorization: Bearer <JWT_TOKEN>
com.rms.api
├── config
├── controller
├── dto
├── entity
├── filter
├── repository
├── security
├── service
├── util
└── resources
├── application.properties
├── application-dev.properties
├── application-prod.properties
├── schema.sql
└── data.sql
- users
- passenger
- train
- ticket
- payment
- admin
| Module | Endpoint |
|---|---|
| Auth | /auth/login |
| Auth | /auth/register |
| Train | /trains |
| Train | /trains/search |
| Ticket | /tickets/book |
| Ticket | /tickets/cancel/{id} |
| Payment | /payments |
| Admin | /admin/add-train |
| Admin | /admin/delete-train |
Swagger UI:
http://localhost:8009/swagger
Production Swagger:
https://your-render-url/swagger
spring.datasource.url=jdbc:postgresql://localhost:5432/rms
spring.datasource.username=postgres
spring.datasource.password=root
Environment Variables:
DB_URL=
DB_USERNAME=
DB_PASSWORD=
SPRING_PROFILES_ACTIVE=prod
Steps:
- Push project to GitHub
- Create Web Service on Render
- Add Environment Variables
- Deploy
- Open Swagger URL
- User Authentication (JWT)
- Role-Based Access (Admin/User)
- Train Management
- Passenger Management
- Ticket Booking & Cancellation
- Payment Management
- Swagger API Documentation
- PostgreSQL Database
- Cloud Deployment
Rahul Mourya Railway Management System – Spring Boot Project