A comprehensive, enterprise-grade Train Movement Optimization and Traffic Control System designed for nationwide railway networks. This project features a full-stack, event-driven architecture that provides real-time train tracking, automated emergency handling, and intelligent route optimization using a modern React dashboard and a robust Spring Boot backend powered by Apache Kafka.
- Event-Driven Live Tracking (Kafka): High-volume, synthetic IoT telemetry is pumped into an Apache Kafka topic in real-time, instantly broadcasting train positions to the frontend via WebSockets.
- Nationwide Route Optimization: Visualizes the shortest optimal paths across complex geographic networks (e.g., New Delhi to Mumbai), highlighting the AI's routing choices over alternative tracks.
- Emergency Handling & Manual Overrides: Instantly halt all traffic or reroute specific trains during emergencies. Triggers WebSocket alerts seamlessly to all connected clients.
- Premium Dashboard UI: Government-ready, high-contrast, dark-mode glassmorphism interface built with React 19.
- Geospatial Precision: Leaflet-powered maps rendering highly-detailed geographic routes and train interpolation across thousands of waypoints.
The frontend is a modern single-page application focused on high performance and real-time telemetry rendering.
- Framework: React 19 + Vite
- Mapping: Leaflet & React-Leaflet for interactive geographic track visualization.
- Real-time Communication:
@stomp/stompjs&sockjs-clientfor connecting to backend WebSockets. - Styling: Custom Vanilla CSS with a premium dark-mode glassmorphism design.
The backend is a robust Java service responsible for heavy computations, state management, and real-time event streaming.
- Framework: Java 17 + Spring Boot 3.5
- Event Streaming: Apache Kafka & Zookeeper (via Docker)
- Database: MongoDB (Spring Data MongoDB)
- Real-time Communication: Spring WebSocket & STOMP for broadcasting live telemetry and emergencies.
- Node.js (v18+)
- Java 17
- Maven
- Docker & Docker Compose (Required for Kafka)
- MongoDB (Local or Atlas)
- Navigate to the backend directory:
cd train-scheduler-backend - Start the Kafka & Zookeeper containers:
docker-compose up -d
- Configure your MongoDB connection in
src/main/resources/application.properties. - Build and run the Spring Boot application (ensure the
simulationprofile is active for live telemetry):The backend will start onmvn clean install .\mvnw.cmd spring-boot:runhttp://localhost:8080.
- Navigate to the frontend directory:
cd train-scheduler-frontend - Install dependencies:
npm install
- Start the Vite development server:
The frontend will be accessible at
npm run dev
http://localhost:5173.
- Dashboard: Upon launching the frontend, you will see the main Traffic Control Dashboard.
- Route Optimization: Select a source and destination (e.g. New Delhi to Mumbai) and click "Find Trains" to watch the system plot the optimal route across the geographic network.
- Live Map: The map will automatically update, snapping train markers to real GeoJSON tracks based on live telemetry streamed from Kafka.
- Emergencies:
- Click
Halt All Trafficto simulate a system-wide critical halt via API override.
- Click
This project is for educational and simulation purposes.