Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Train Traffic Control 🚆

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.


image

🌟 Features

  • 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.

🏗️ Architecture & Technologies

Frontend

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-client for connecting to backend WebSockets.
  • Styling: Custom Vanilla CSS with a premium dark-mode glassmorphism design.

Backend

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.

🚀 Getting Started

Prerequisites

  • Node.js (v18+)
  • Java 17
  • Maven
  • Docker & Docker Compose (Required for Kafka)
  • MongoDB (Local or Atlas)

1. Backend Setup

  1. Navigate to the backend directory:
    cd train-scheduler-backend
  2. Start the Kafka & Zookeeper containers:
    docker-compose up -d
  3. Configure your MongoDB connection in src/main/resources/application.properties.
  4. Build and run the Spring Boot application (ensure the simulation profile is active for live telemetry):
    mvn clean install
    .\mvnw.cmd spring-boot:run
    The backend will start on http://localhost:8080.

2. Frontend Setup

  1. Navigate to the frontend directory:
    cd train-scheduler-frontend
  2. Install dependencies:
    npm install
  3. Start the Vite development server:
    npm run dev
    The frontend will be accessible at http://localhost:5173.

🛠️ Usage

  1. Dashboard: Upon launching the frontend, you will see the main Traffic Control Dashboard.
  2. 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.
  3. Live Map: The map will automatically update, snapping train markers to real GeoJSON tracks based on live telemetry streamed from Kafka.
  4. Emergencies:
    • Click Halt All Traffic to simulate a system-wide critical halt via API override.

📄 License

This project is for educational and simulation purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages