Predictive Adaptive Road Intelligence System — a real-time AI-powered traffic monitoring platform built for Bangalore, India.
RASTA Cortex provides citizens, traffic police, and city engineers with a unified command centre to monitor live road conditions, receive AI-generated hazard alerts, watch CCTV feeds, and report incidents — all accessible through any modern browser with no sign-up required.
RASTA Cortex is a full-stack TypeScript application combining Next.js 16 on the frontend with a Node.js + Express + Socket.IO backend. The platform simulates a network of 12 IoT sensor nodes across major Bangalore junctions, processes their data through a multi-factor AI risk scoring engine, and delivers real-time updates to connected clients with sub-15ms latency.
- Live interactive map of 12 major Bangalore junctions with colour-coded risk indicators
- WebSocket-powered updates every 1.5 seconds with no page refresh required
- AI prediction engine with 94% accuracy across four risk dimensions
- Citizens: Live traffic map, hazard alerts, incident reporting, CCTV feeds, signal status
- Traffic Police: Critical alert dashboard, AI confidence scores, emergency signal override, impact radius predictions, event audit log
- Traffic Engineers: Risk timeline charts, vehicle density analytics, node comparison, environmental sensor data, radar risk profiles
- Collision risk scoring based on vehicle density and obstacle detection
- Flood risk prediction using waterlogging sensors and weather data
- Congestion probability analysis with adaptive signal recommendations
- Pedestrian risk assessment from crowd density and visibility metrics
- 9 simulated camera feeds from major corridors
- Silk Board, MG Road, Marathahalli, Hebbal, Electronic City, Whitefield, Koramangala, Indiranagar, Jayanagar
- One-tap citizen reporting for potholes, waterlogging, accidents, and road hazards
- Reports tagged to the nearest monitored junction
- Integrated into the alert feed for traffic police visibility
- Risk timeline charts showing historical trends across all nodes
- Vehicle density bar charts with inflow, outflow, and congestion index
- Side-by-side node comparison tables
- Radar charts visualising multi-dimensional risk profiles
rasta-cortex/
├── frontend/ Next.js 16 + React 19 + TypeScript
│ ├── app/
│ │ ├── page.tsx Landing page and dashboard entry point
│ │ ├── about/page.tsx Features and capabilities page
│ │ ├── layout.tsx Root layout with metadata
│ │ └── globals.css Tailwind CSS v4 + custom styles
│ ├── components/
│ │ ├── dashboard/
│ │ │ ├── Dashboard.tsx Main dashboard orchestrator
│ │ │ ├── Topbar.tsx Navigation with mobile menu
│ │ │ ├── Sidebar.tsx Node list with status indicators
│ │ │ ├── BangaloreMap.tsx Leaflet map with risk markers
│ │ │ ├── AlertFeed.tsx Real-time alert stream
│ │ │ ├── AnalyticsPanel.tsx Charts and data visualisation
│ │ │ ├── CctvPanel.tsx Live camera feed grid
│ │ │ ├── NodeDetailPanel.tsx Detailed sensor readout overlay
│ │ │ ├── ReportModal.tsx Incident reporting form
│ │ │ └── HelpModal.tsx User guide and keyboard shortcuts
│ │ ├── landing/LandingPage.tsx Marketing page with feature grid
│ │ └── about/AboutPage.tsx Mobile-optimised features page
│ ├── hooks/
│ │ └── useSocket.ts Socket.IO connection and state management
│ ├── lib/
│ │ └── utils.ts Utility functions and helpers
│ ├── types/
│ │ └── index.ts Shared TypeScript interfaces
│ ├── DEPLOYMENT.md Deployment guide for all platforms
│ └── README.md Frontend-specific documentation
│
├── backend/ Node.js + Express + Socket.IO
│ ├── src/
│ │ ├── index.ts Express server and Socket.IO setup
│ │ ├── ai-engine/
│ │ │ └── predictor.ts Multi-factor risk scoring engine
│ │ ├── orchestrator/
│ │ │ └── index.ts Event orchestration and alert dispatch
│ │ ├── routes/
│ │ │ └── api.ts REST API endpoints
│ │ ├── simulation/
│ │ │ └── nodeSimulator.ts IoT node data generator
│ │ └── types/
│ │ └── index.ts Backend TypeScript types
│ ├── package.json
│ └── tsconfig.json
│
├── package.json Root workspace configuration
├── pnpm-workspace.yaml pnpm workspace definition
├── pnpm-lock.yaml Dependency lock file
└── README.md This file
| Layer | Technology | Purpose |
|---|---|---|
| Frontend Framework | Next.js 16 | React-based framework with App Router |
| UI Library | React 19 | Component-based UI |
| Language | TypeScript 5 | Type-safe development |
| Styling | Tailwind CSS v4 | Utility-first CSS framework |
| Animations | Framer Motion | Declarative animations and transitions |
| Charts | Recharts | Data visualisation components |
| Map | Leaflet + React Leaflet | Interactive map rendering |
| Real-time Transport | Socket.IO | WebSocket communication |
| Backend Runtime | Node.js 20 | JavaScript runtime |
| HTTP Framework | Express 4 | REST API server |
| IoT Simulation | Custom MQTT-style simulator | Sensor data generation |
The platform tracks 12 high-traffic intersections across Bangalore:
- Silk Board Junction
- MG Road
- Marathahalli Bridge
- Hebbal Flyover
- Electronic City Toll
- Whitefield Signal
- Koramangala 5th Block
- Indiranagar 100ft Road
- Jayanagar 4th Block
- Yeshwanthpur Circle
- KR Puram Bridge
- Bannerghatta Road
Each junction has a simulated IoT node emitting vehicle density, obstacle detection, waterlogging risk, crowd density, ambient visibility, pedestrian activity, temperature, humidity, and wind speed data every 1.5 seconds.
-
IoT Simulation: The backend
nodeSimulator.tsgenerates realistic sensor data for all 12 junctions every 1.5 seconds, including vehicle counts, environmental conditions, and hazard indicators. -
AI Risk Scoring: The
predictor.tsengine processes incoming sensor data and computes four independent risk scores per node:- Collision risk (vehicle density + obstacle detection + visibility)
- Flood risk (waterlogging level + weather conditions)
- Congestion probability (vehicle density + historical patterns)
- Pedestrian risk (crowd density + pedestrian activity + visibility)
-
Alert Generation: When any risk score exceeds predefined thresholds, the
orchestratorfires an alert with:- Severity level (low, medium, high, critical)
- AI confidence percentage
- Predicted impact radius in meters
- Adaptive response recommendation (signal override, rerouting, emergency dispatch)
-
Real-Time Broadcast: All node updates, predictions, and alerts are pushed via Socket.IO to every connected browser. The frontend
useSockethook manages the WebSocket connection and updates React state, triggering re-renders across the map, alert feed, analytics charts, and signal indicators.
The risk scoring engine uses weighted multi-factor analysis:
collisionRisk = (vehicleDensity * 0.4) + (obstacleDetected * 0.3) + (1 - visibility * 0.3)
floodRisk = (waterloggingRisk * 0.6) + (humidity * 0.2) + (windSpeed * 0.2)
congestionProbability = (vehicleDensity * 0.5) + (signalState * 0.3) + (timeOfDay * 0.2)
pedestrianRisk = (crowdDensity * 0.4) + (pedestrianActivity * 0.3) + (1 - visibility * 0.3)
overallRisk = max(collisionRisk, floodRisk, congestionProbability, pedestrianRisk)
Confidence scores are derived from sensor data quality and historical accuracy metrics.
- Node.js 20 or later
- pnpm 9 or later
Install pnpm globally if you do not have it:
npm install -g pnpm# Clone the repository
git clone https://github.com/Sreejith-nair511/VILTRUM.git
cd VILTRUM
# Install all dependencies (frontend + backend)
pnpm install# Start both frontend and backend concurrently
pnpm devThis command runs:
- Frontend at http://localhost:3000 (Next.js dev server with hot reload)
- Backend at http://localhost:4000 (Express + Socket.IO with nodemon)
Both services automatically reload when you edit source files.
# Build the frontend
pnpm --filter frontend build
# Build the backend
pnpm --filter backend buildFrontend output: frontend/.next
Backend output: backend/dist
# Start the frontend production server
pnpm --filter frontend start
# Start the backend production server
node backend/dist/index.jsCreate frontend/.env.local:
NEXT_PUBLIC_BACKEND_URL=http://localhost:4000For production, replace with your deployed backend URL (no trailing slash).
Create backend/.env:
PORT=4000
CORS_ORIGIN=http://localhost:3000For production, set CORS_ORIGIN to your deployed frontend URL (no trailing slash).
See frontend/DEPLOYMENT.md for comprehensive deployment guides covering:
- Vercel (recommended for frontend)
- Railway (recommended for backend)
- Self-hosted VPS with pm2
- Docker Compose with Dockerfiles
- Nginx reverse proxy with WebSocket support
- HTTPS via Certbot
- Health checks and troubleshooting
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Health check with system uptime and node count |
| GET | /api/nodes |
Current state of all 12 junction nodes |
| GET | /api/alerts |
Active alerts across all nodes |
| Event | Direction | Payload | Description |
|---|---|---|---|
connect |
Client → Server | - | Establish Socket.IO connection |
nodeUpdate |
Server → Client | NodeData |
Real-time sensor data for a single node |
aiPrediction |
Server → Client | PredictionResult |
AI risk scores for a node |
alert |
Server → Client | AIAlert |
New hazard alert |
systemHealth |
Server → Client | SystemHealth |
Overall system metrics |
trafficFlow |
Server → Client | TrafficFlow |
Vehicle flow statistics |
| Metric | Value |
|---|---|
| Monitored junctions | 12 |
| Live CCTV feeds | 9 |
| AI prediction accuracy | 94% |
| Sensor-to-screen latency | under 15ms |
| Risk dimensions per node | 4 (collision, flood, congestion, pedestrian) |
| Sensor update interval | 1.5 seconds |
| WebSocket transport | Socket.IO with automatic reconnection |
| Supported browsers | Chrome, Firefox, Safari, Edge (latest 2 versions) |
RASTA Cortex was developed as part of the Bangalore Smart City Initiative 2026. The platform demonstrates how real-time IoT data, AI-powered risk prediction, and modern web technologies can converge to create a unified traffic intelligence system accessible to all stakeholders — from individual citizens checking road conditions before their commute, to traffic police coordinating emergency responses, to city engineers analysing infrastructure bottlenecks.
The project is fully open source and designed to run without requiring user accounts, mobile app installations, or proprietary hardware. Any citizen with a modern web browser can access the live dashboard.
The interface uses a dark theme with semi-transparent cards, subtle backdrop blur, and neon cyan accents to create a futuristic command centre aesthetic while maintaining readability and accessibility.
All components adapt to screen sizes from 320px to 4K displays. The topbar collapses navigation tabs on mobile, the about page uses accordion sections for feature lists, and the map adjusts marker sizes based on viewport width.
No polling, no manual refresh buttons. Every data point flows through WebSocket connections and updates the UI instantly. The scan line animation and pulsing status indicators reinforce the live nature of the platform.
- Semantic HTML with proper ARIA labels
- Keyboard navigation support across all interactive elements
- Focus rings on all buttons and links
- Colour-coded risk levels with text labels (not colour-only)
- Screen reader-friendly alert announcements
This is an open-source project. Contributions are welcome via pull requests. For major changes, please open an issue first to discuss what you would like to change.
MIT License
Copyright (c) 2026 RASTA Cortex
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Built with Next.js, React, TypeScript, Tailwind CSS, Framer Motion, Recharts, Leaflet, Socket.IO, Express, and Node.js.
Bangalore junction coordinates sourced from OpenStreetMap.
CCTV feed simulation uses placeholder video streams.
AI risk scoring algorithm inspired by traffic engineering research and urban mobility studies.