Skip to content

A full-stack, real-time ride-hailing platform built with FastAPI, WebSockets, and TailwindCSS. Features live driver-rider matching, dynamic pricing, and a geospatial admin dashboard.

Notifications You must be signed in to change notification settings

twopranav/Rider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛺 Rider (Open Mobility Network Simulation)

A full-stack, real-time ride-hailing platform built with FastAPI, WebSockets, and TailwindCSS. This project simulates an open mobility network (similar to Namma Yatri or ONDC) featuring live ride matching, dynamic pricing, pooling logic, and a geospatial admin command center.

🚀 Key Features

👤 Rider Portal

  • Instant Booking: Real-time ride requests broadcasted instantly to drivers via WebSockets.
  • Dynamic Pricing: Algorithmic pricing based on distance and ride mode:
    • Solo: Standard pricing for faster travel.
    • Pool: ~30% cost reduction to incentivize shared mobility.
  • Smart Scheduling: "Plan Your Commute" feature allows users to book rides in advance. The system automatically triggers these as Gold Priority requests at the scheduled time.
  • Live Feedback: Visual status updates for "Driver Assigned," "Arrived," and "Trip Started."

🚖 Captain (Driver) Dashboard

  • Split-Queue UI: A reactive interface featuring a dedicated Priority Section for high-value/scheduled rides (Gold Cards) and a standard feed for immediate requests.
  • Real-Time Interaction: Accept or decline rides instantly without page reloads.
  • Trip Lifecycle: Full workflow management: Accept -> Arrive -> Start Trip -> Complete.
  • Earnings Visibility: Upfront fare display for every ride card.

🚔 Admin Command Center

  • Live Heatmap: Real-time visualization of demand across 101 zones in Bangalore.
  • Fleet Monitoring: Track active trips and waiting queue load in real-time.
  • Data Logs: Comprehensive history of completed trips and revenue generation.

🛠️ Tech Stack

  • Backend: Python 3.10+, FastAPI
  • Real-Time Communication: Python websockets (Bi-directional)
  • Database: SQLAlchemy (SQLite/PostgreSQL)
  • Frontend: HTML5, Jinja2 Templates, JavaScript (ES6+)
  • Styling: Tailwind CSS (CDN)
  • Maps & Geospatial: Leaflet.js, OpenStreetMap
  • Task Scheduling: Python asyncio background tasks

📦 Installation & Setup

  1. Clone the repository

    git clone [https://github.com/yourusername/Rider.git](https://github.com/yourusername/Rider.git)
    cd Rider
  2. Create a virtual environment

    # Windows
    python -m venv .venv
    .\.venv\Scripts\activate
    
    # Mac/Linux
    python3 -m venv .venv
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run the Server This command starts the API server, the WebSocket manager, and the background scheduler.

    uvicorn main:app --reload

Note: The application is configured to reset the database (drop_all) on every startup for clean simulation testing. To persist data, comment out the drop_all line in main.py.


🚦 Usage Guide

Access the portals via your browser at http://127.0.0.1:8000:

Portal URL Path Description
Login / Home / Main entry point for Riders and Drivers.
Admin Dashboard /dashboard Monitoring tool for fleet managers.
API Docs /docs Swagger UI for testing API endpoints manually.

🧪 Simulation Workflow

To test the full loop locally:

  1. Open Login in one tab and register as a Driver (e.g., ID 1). Keep this tab open.
  2. Open Login in a new tab (Incognito) and register as a Rider (e.g., ID 1).
  3. Rider Tab: Select Start/Drop locations and click Confirm Booking.
  4. Driver Tab: You will see the ride card appear instantly. Click Accept.
  5. Driver Tab: Click Arrived -> Start Trip -> Complete.
  6. Admin Tab: Watch the stats update live during this process.

📂 Project Structure

Rider/
├── main.py                 # Application entry point, WebSocket logic, & Scheduler
├── requirements.txt        # Python dependencies
├── templates/              # Frontend UI
│   ├── login.html          # Authentication landing page
│   ├── register.html       # User registration (Rider/Driver)
│   ├── rider.html          # Rider booking interface
│   ├── driver.html         # Driver dashboard with split queue
│   └── admin.html          # Admin heatmap and monitoring
└── server/                 # Backend Modules
    ├── database.py         # Database connection setup
    ├── models.py           # SQLAlchemy database models
    ├── schemas.py          # Pydantic data validation schemas
    └── connection_manager.py # WebSocket connection handler

About

A full-stack, real-time ride-hailing platform built with FastAPI, WebSockets, and TailwindCSS. Features live driver-rider matching, dynamic pricing, and a geospatial admin dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •