Features True Multimodal Routing: Combines different modes of public transport into a single, easy-to-follow itinerary. Smart Optimization Engine: Sort and filter routes based on "Fastest Time", "Lowest Cost", or "Fewest Transfers". Dynamic Pricing & Timing: Accurately estimates dynamic fares, travel durations, and waiting times across transit networks. Eco-Tracking (Carbon Savings): Calculates precise CO2 emission savings for every public transit trip compared to a private car ride. Last-Mile Connectivity: Direct, seamless Uber integration to bridge the gap between the final transit hub and the destination. High Performance: Sub-second response times powered by geospatial database queries and intelligent Redis caching. 🛠️ Technology Stack Chennai Transit is built on a highly scalable, microservices-inspired architecture:
- Frontend (Client) React.js & Vite: For a lightning-fast, highly responsive single-page application (SPA). Tailwind CSS: Provides a sleek, modern, mobile-first user interface. Leaflet & React-Leaflet: Renders dynamic interactive maps and interactive route polylines.
- Primary API Gateway (Backend) Node.js & Express: The core orchestrator that handles user requests, stitches multimodal paths, and integrates with live MTC Bus APIs. Axios: Handles internal cross-service communication.
- Pathfinding Engine (Microservice) Python & FastAPI: A dedicated, high-performance microservice specifically designed to solve complex Graph Theory problems for the rail networks.
- Data & Caching Layer PostgreSQL + PostGIS (Supabase): Stores station metadata and performs complex geospatial queries. Redis (Upstash): A remote caching layer that caches heavy routing computations for 5 minutes (300s TTL) to dramatically reduce server load. Core Algorithms Used Dijkstra's Shortest Path Algorithm (Graph Theory): The FastAPI Python engine utilizes NetworkX to model the intricate web of Chennai's Metro and Suburban train lines as a directed mathematical graph.
Nodes represent physical stations and train lines. Edges represent travel time, wait times, and transfer penalties (e.g., walking between an MRTS and a Metro station). Dijkstra's algorithm traverses this graph to find the most optimal, time-efficient path across multiple interconnected rail lines. K-Nearest Neighbors (KNN) via PostGIS: To bridge the physical world with the transit network, the Node.js backend uses PostgreSQL with PostGIS extensions. It performs rapid geospatial bounding box queries using the <-> (distance) operator to instantly locate the closest transit hubs to any raw GPS coordinate provided by the user.
Haversine Formula: Used extensively to calculate the great-circle distance between two points on a sphere. This algorithm powers the first-mile and last-mile walking segment calculations, converting geographical distance into estimated walking durations and calorie/carbon metrics.
Architecture Workflow Locate: The user inputs an origin and destination coordinate. The Node.js backend queries PostGIS to find the nearest Bus, Metro, and Train stops. Calculate: The Node.js server concurrently fetches Bus routes from the MTC API. It simultaneously sends a request to the Python FastAPI microservice to run Dijkstra's algorithm on the rail graph. Stitch: The Node.js server receives the optimal rail path and "stitches" it together by dynamically calculating the exact walking distance and time from the user's origin to the start station, and from the end station to the final destination. Cache & Serve: The final compiled multimodal itinerary is cached in Redis. If another user requests the same route within 5 minutes, it is served instantly from memory. Real-World Impact & Uses Reducing Carbon Footprint: By gamifying carbon emission savings (displaying exact kg of CO2 saved per trip), Chennai Transit actively incentivizes citizens to choose green public transport over private vehicles. Resolving the "Last-Mile" Problem: A major reason people avoid public transit is the uncertainty of getting from the station to their final destination. Our integrated walking directions and 1-click Uber booking resolves this friction entirely. Economic Accessibility: By prioritizing "Lowest Cost" sorting, lower-income commuters can reliably navigate the cheapest possible transit options across the sprawling city. De-congestion: Making public transit seamless and predictable encourages higher ridership, directly reducing traffic congestion and vehicular pollution in Chennai's metropolitan area. Tourist & New Resident Accessibility: Helps visitors and new residents navigate Chennai's public transport network confidently through a unified journey planning experience.
Log in or sign up for Devpost to join the conversation.