Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Set default behavior to automatically normalize line endings
* text=auto eol=lf
*.bat eol=crlf
*.cmd eol=crlf
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"endOfLine": "lf"
"endOfLine": "auto"
}
34 changes: 20 additions & 14 deletions BLOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Say Goodbye to Gridlocks: How TraffiTech is Automating Smart Cities with AI and IoT

We’ve all been there: stuck at a red light on an entirely empty intersection, or circling the block for the fifth time just looking for a place to park.
We’ve all been there: stuck at a red light on an entirely empty intersection, or circling the block for the fifth time just looking for a place to park.

In modern cities, traffic and parking systems operate as isolated silos. Static traffic light timers don’t care about actual road density, and drivers looking for parking space search passively, contributing to **up to 30% of urban congestion**. Most critically, emergency vehicles like ambulances face life-threatening delays navigating gridlocked intersections.
In modern cities, traffic and parking systems operate as isolated silos. Static traffic light timers don’t care about actual road density, and drivers looking for parking space search passively, contributing to **up to 30% of urban congestion**. Most critically, emergency vehicles like ambulances face life-threatening delays navigating gridlocked intersections.

To solve this, I built **TraffiTech**—an AI-powered, IoT-integrated cyber-physical system designed to optimize large-scale traffic control and parking allocation in real-time.
To solve this, I built **TraffiTech**—an AI-powered, IoT-integrated cyber-physical system designed to optimize large-scale traffic control and parking allocation in real-time.

Here is a deep dive into how TraffiTech works, the technical engine under the hood, and how it's shaping the future of smart city infrastructure.

Expand All @@ -19,31 +19,36 @@ Instead of separating navigation and parking, TraffiTech unites them into a sing
Here are the key pillars that make TraffiTech unique:

### 1. AI-Powered Traffic Autopilot
Traditional traffic lights run on pre-programmed cycles. TraffiTech uses virtual IoT road sensors to continuously stream vehicle density counts. The system’s **AI Autopilot** evaluates these density thresholds in real-time and dynamically extends green-light cycles for heavily congested lanes while shortening green phases for empty corridors.

Traditional traffic lights run on pre-programmed cycles. TraffiTech uses virtual IoT road sensors to continuously stream vehicle density counts. The system’s **AI Autopilot** evaluates these density thresholds in real-time and dynamically extends green-light cycles for heavily congested lanes while shortening green phases for empty corridors.

### 2. Life-Saving SOS Corridors

Every second counts during a medical or fire emergency. TraffiTech features a manual **Emergency Corridor Override**. With a single click, dispatchers or first responders can force a continuous green-light pathway along the emergency vehicle's route, proactively clearing traffic gridlocks before the vehicle even arrives at the intersection.

### 3. Contactless Smart Parking & Dynamic Pricing

Drivers can open the TraffiTech mobile app to locate vacant parking spots on an interactive, geolocation-aware map. To balance parking gridlocks during peak hours, the system automatically triggers dynamic surge pricing. Once a spot is selected, users book it securely using Stripe and receive a digital QR ticket. Scanning this QR pass at the physical gate updates the live database occupancy immediately.

### 4. Eco-Smart Infrastructure (Smart Streetlighting)

To reduce municipal energy costs, TraffiTech links density sensors to streetlighting networks. During off-peak night hours, streetlights automatically dim by up to 50% when the road is empty and instantly return to 100% brightness as vehicles approach, reducing grid loads by up to 40%.

---

## Under the Hood: The Tech Stack

Building a real-time smart city dashboard requires high performance, security, and absolute reliability.
Building a real-time smart city dashboard requires high performance, security, and absolute reliability.

* **Frontend:** Built as a Progressive Web Application (PWA) using **React 19** and **Vite** for rapid rendering. **Tailwind CSS** handles the styling, **Leaflet** powers the interactive maps, and **Recharts** handles live analytics.
* **Backend:** Powered by **Node.js** and **Express.js**. I used **Socket.io** to establish persistent, bi-directional WebSocket streams to handle the real-time IoT signal cycles.
* **Payments:** Elements from the **Stripe API** are fully integrated to handle secure, PCI-compliant bookings.
- **Frontend:** Built as a Progressive Web Application (PWA) using **React 19** and **Vite** for rapid rendering. **Tailwind CSS** handles the styling, **Leaflet** powers the interactive maps, and **Recharts** handles live analytics.
- **Backend:** Powered by **Node.js** and **Express.js**. I used **Socket.io** to establish persistent, bi-directional WebSocket streams to handle the real-time IoT signal cycles.
- **Payments:** Elements from the **Stripe API** are fully integrated to handle secure, PCI-compliant bookings.

![TraffiTech Live Dashboard](https://raw.githubusercontent.com/10-Mohan/Trafitech/main/documentation/assets/real_dashboard.png)

### Engineering for Offline Resilience
Critical city infrastructure cannot afford downtime. If the internet drops, traffic lights must keep running.

Critical city infrastructure cannot afford downtime. If the internet drops, traffic lights must keep running.

To solve this, I engineered a **hybrid database storage engine**. While the production system runs on **MongoDB Atlas** in the cloud, the database adapter automatically detects connection drops and fails over to a zero-dependency **local JSON database fallback**. This ensures that local servers can keep processing data offline until connectivity is restored.

Expand All @@ -52,12 +57,13 @@ To solve this, I engineered a **hybrid database storage engine**. While the prod
## The Road Ahead

TraffiTech is a foundation. The next steps in our roadmap focus on large-scale logistics:
* **Freight Priority Routing:** Integrating with registered delivery fleets to coordinate "Priority Green" windows, optimizing industrial supply chains.
* **Urban Planning Simulator:** A sandbox mode for city engineers to test new road layouts (like roundabouts) against historical traffic data before investing physical capital.

- **Freight Priority Routing:** Integrating with registered delivery fleets to coordinate "Priority Green" windows, optimizing industrial supply chains.
- **Urban Planning Simulator:** A sandbox mode for city engineers to test new road layouts (like roundabouts) against historical traffic data before investing physical capital.

Smart cities shouldn't just passively observe congestion—they should actively clear it. With AI, IoT, and resilient architectures, platforms like TraffiTech are paving the way for safer, cleaner, and highly coordinated urban transit.

***
---

* 👉 [TraffiTech Live Demo](https://trafitech-git-main-10-mohans-projects.vercel.app/)
* 👉 [Explore the Code on GitHub](https://github.com/10-Mohan/Trafitech)
- 👉 [TraffiTech Live Demo](https://trafitech-git-main-10-mohans-projects.vercel.app/)
- 👉 [Explore the Code on GitHub](https://github.com/10-Mohan/Trafitech)
59 changes: 35 additions & 24 deletions PROJECT_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# 🏙️ TraffiTech: Smart Traffic & Parking Management System
### *End-to-End Project Description & Technical Documentation*

### _End-to-End Project Description & Technical Documentation_

---

## 📌 Executive Summary
**TraffiTech** is a Progressive Web Application (PWA) designed to address two of the most critical challenges facing modern urban areas: **traffic congestion** and **inefficient parking space allocation**.

**TraffiTech** is a Progressive Web Application (PWA) designed to address two of the most critical challenges facing modern urban areas: **traffic congestion** and **inefficient parking space allocation**.

By combining real-time IoT sensor telemetry, interactive map visualizations (React-Leaflet), automated Stripe payment processing, and dynamic demand-based pricing, TraffiTech creates a unified ecosystem for citizens and city administrators. It streamlines the parking space discovery process, dynamically controls traffic light cycles based on vehicle density, and provides critical safety features like real-time emergency routing overrides.

---

## ⚠️ The Problem Statement

As urban populations grow, legacy traffic control and parking infrastructures fail to scale:

1. **Inefficient Parking Search:** Studies show that drivers searching for parking account for up to **30% of urban traffic congestion**, resulting in wasted fuel, higher carbon emissions, and driver frustration.
2. **Static Traffic Signal Timing:** Conventional traffic lights operate on fixed, pre-programmed timers that do not adjust to actual traffic flow, leading to unnecessary idling and gridlocks during peak hours.
3. **Emergency Vehicle Delays:** First responders (ambulances, fire engines) face critical delays navigating gridlocked intersections, which can directly affect patient survival rates.
Expand All @@ -20,6 +24,7 @@ As urban populations grow, legacy traffic control and parking infrastructures fa
---

## 💡 The Solution: TraffiTech

TraffiTech bridges these silos by integrating real-time traffic signal automation and reservation-based parking into a single, responsive platform.

```mermaid
Expand All @@ -41,55 +46,61 @@ graph TD
## 🛠️ Core Features & Detailed Workflows

### 🚦 1. Adaptive Traffic Control Center
* **Emergency Corridor Override (SOS):** Allows dispatcher networks or EMT responders to trigger a global emergency override. The system immediately forces the required vertical or horizontal route into a continuous green light sequence, clearing traffic blocks before the vehicle arrives.
* **AI-Powered Autopilot Mode:** Evaluates live density readings from simulated IoT sensors and dynamically adjusts cycle durations. Lanes with high vehicle density are prioritized, while empty corridors receive shorter green windows, keeping traffic flowing continuously.
* **Live Simulation Map:** An interactive, responsive crossroads schematic mapping active signals, current speeds, and active vehicle counters.

- **Emergency Corridor Override (SOS):** Allows dispatcher networks or EMT responders to trigger a global emergency override. The system immediately forces the required vertical or horizontal route into a continuous green light sequence, clearing traffic blocks before the vehicle arrives.
- **AI-Powered Autopilot Mode:** Evaluates live density readings from simulated IoT sensors and dynamically adjusts cycle durations. Lanes with high vehicle density are prioritized, while empty corridors receive shorter green windows, keeping traffic flowing continuously.
- **Live Simulation Map:** An interactive, responsive crossroads schematic mapping active signals, current speeds, and active vehicle counters.

### 🅿️ 2. Smart Parking Space Allocation
* **Interactive Geolocation Spotting:** Integrates React-Leaflet maps to automatically capture the user's GPS coordinates and display nearby parking garages.
* **Dynamic Surge Pricing:** Features demand-responsive pricing logic. During peak hours (9:00–11:00 AM & 5:00–7:00 PM), the hourly parking rate scales by **1.5x** automatically to manage parking gridlocks.
* **Seamless Reservation Flow:** Built with Stripe Elements. Users securely enter checkout credentials, receive automated session confirmations, and generate a dynamic, digital **QR Access Ticket** for contactless gate verification.

- **Interactive Geolocation Spotting:** Integrates React-Leaflet maps to automatically capture the user's GPS coordinates and display nearby parking garages.
- **Dynamic Surge Pricing:** Features demand-responsive pricing logic. During peak hours (9:00–11:00 AM & 5:00–7:00 PM), the hourly parking rate scales by **1.5x** automatically to manage parking gridlocks.
- **Seamless Reservation Flow:** Built with Stripe Elements. Users securely enter checkout credentials, receive automated session confirmations, and generate a dynamic, digital **QR Access Ticket** for contactless gate verification.

### 📊 3. Executive Data Insights
* **System Analytics:** Features custom-styled **Recharts** line charts showing traffic volume trends mapped against hourly parking occupancy over 24 hours.
* **Revenue & Space Management:** Displays cumulative revenue, total transactions, and fills/availabilities per parking zone (Week, Month, Year views).

- **System Analytics:** Features custom-styled **Recharts** line charts showing traffic volume trends mapped against hourly parking occupancy over 24 hours.
- **Revenue & Space Management:** Displays cumulative revenue, total transactions, and fills/availabilities per parking zone (Week, Month, Year views).

---

## 💻 Tech Stack & Architecture

* **Frontend (Single Page App):** React 19, Vite, Tailwind CSS, Leaflet, Recharts, Lucide Icons, Framer Motion.
* **Backend (REST API & WebSockets):** Node.js, Express, Socket.io (for streaming real-time IoT signal cycles).
* **Database (Hybrid Storage Model):** MongoDB Atlas (Cloud database) backed by a Zero-Dependency local JSON file database fallback for maximum reliability.
* **Payment Gateway:** Stripe API integration.
* **Hosting & Production:** Frontend hosted on **Vercel**, Backend hosted on **Render** (fully hosted in the cloud, running 24/7).
- **Frontend (Single Page App):** React 19, Vite, Tailwind CSS, Leaflet, Recharts, Lucide Icons, Framer Motion.
- **Backend (REST API & WebSockets):** Node.js, Express, Socket.io (for streaming real-time IoT signal cycles).
- **Database (Hybrid Storage Model):** MongoDB Atlas (Cloud database) backed by a Zero-Dependency local JSON file database fallback for maximum reliability.
- **Payment Gateway:** Stripe API integration.
- **Hosting & Production:** Frontend hosted on **Vercel**, Backend hosted on **Render** (fully hosted in the cloud, running 24/7).

---

## 🌟 Why TraffiTech is Different

1. **Unified Ecosystem:** Instead of using separate apps for traffic navigation and parking booking, TraffiTech joins them together to help drivers park before hitting gridlocks.
2. **Offline Resilience:** The application's database adapter automatically fails over to local files if cloud servers are unreachable, guaranteeing zero downtime.
3. **Progressive Web App (PWA) First:** Fully installable directly onto mobile home screens without requiring native app store downloads.

---

## 📈 Future Scope & Large-Scale Optimizations

Based on the physical and digital systems optimization domain, we have designed a roadmap detailing three large-scale features:

1. **🚚 Freight & Logistics Priority Routing (Supply Chain)**
* **Concept:** Integration with registered delivery truck fleets (e.g., Amazon, FedEx). The system recognizes these logistics vehicles on approaching corridors and coordinates the traffic grid to provide "Priority Green" windows.
* **Impact:** Drastically reduces delivery delay overhead, lowers idling fuel waste, and optimizes supply chain flow inside heavy commercial zones.
- **Concept:** Integration with registered delivery truck fleets (e.g., Amazon, FedEx). The system recognizes these logistics vehicles on approaching corridors and coordinates the traffic grid to provide "Priority Green" windows.
- **Impact:** Drastically reduces delivery delay overhead, lowers idling fuel waste, and optimizes supply chain flow inside heavy commercial zones.

2. **💡 IoT-Based Smart Streetlighting (Infrastructure Energy Management)**
* **Concept:** Linking physical city streetlighting grids directly to TraffiTech's traffic density sensors. When zero traffic is detected during off-peak night hours, streetlights dim by 50% automatically and ramp back to 100% brightness as vehicles approach.
* **Impact:** Slashes city energy costs and grid loads by up to 40% while keeping roads safely lit.
- **Concept:** Linking physical city streetlighting grids directly to TraffiTech's traffic density sensors. When zero traffic is detected during off-peak night hours, streetlights dim by 50% automatically and ramp back to 100% brightness as vehicles approach.
- **Impact:** Slashes city energy costs and grid loads by up to 40% while keeping roads safely lit.

3. **📐 Urban Planning Simulator (Virtual Layout Builder)**
* **Concept:** A sandbox simulation mode built into the admin control panel. It allows traffic engineers to test route redesigns (e.g., adding roundabouts or modifying parking garages) against historical volume trends.
* **Impact:** Enables predictive urban planning before spending capital resources on physical roadway redesign.
- **Concept:** A sandbox simulation mode built into the admin control panel. It allows traffic engineers to test route redesigns (e.g., adding roundabouts or modifying parking garages) against historical volume trends.
- **Impact:** Enables predictive urban planning before spending capital resources on physical roadway redesign.

---

## 🚀 Live Access Links
* **Live Application URL:** [https://trafitech-git-main-10-mohans-projects.vercel.app/](https://trafitech-git-main-10-mohans-projects.vercel.app/)
* **GitHub Code Repository:** [https://github.com/10-Mohan/Trafitech](https://github.com/10-Mohan/Trafitech)

- **Live Application URL:** [https://trafitech-git-main-10-mohans-projects.vercel.app/](https://trafitech-git-main-10-mohans-projects.vercel.app/)
- **GitHub Code Repository:** [https://github.com/10-Mohan/Trafitech](https://github.com/10-Mohan/Trafitech)
Loading