RideFlow
Full-Stack Ride-Hailing Platform with Next.js, TypeScript, and MySQL
RideFlow is a full-stack ride-hailing platform built to model the complete journey from requesting a ride to completing payment and reviewing the trip. The project goes beyond a single booking screen: it provides dedicated experiences for riders, drivers, support staff, and administrators, all connected to the same operational database.
The Problem
A ride-hailing system looks simple from the outside, but each trip coordinates several actors and a strict sequence of events. A rider needs a fare estimate before confirming a request. An eligible driver must be found and assigned. The trip must move through valid states, and later actions such as payment, ratings, complaints, and earnings depend on the final ride record. RideFlow was built as a Database Systems Lab project to explore that complete workflow as a coherent application.
Four Roles, One System
The interface is divided by responsibility. Riders can manage their profile and wallet, search for pickup and drop-off locations, estimate fares, request rides, review trip history, pay, rate drivers, and submit complaints. Drivers can manage vehicles, availability, incoming requests, active trips, earnings, and profile information. Support staff can review operational issues, while administrators can manage users, drivers, vehicles, rides, payments, fare rules, promo codes, complaints, alerts, and reports.
Role checks are applied on both pages and API routes. Authentication uses signed JSON Web Tokens stored in HTTP-only cookies, with passwords hashed using bcrypt. This keeps access rules close to the server operations they protect instead of relying only on what the interface displays.
A Database-First Architecture
The application uses Next.js and TypeScript for the web layer, MySQL for persistent data, Mapbox for location search and routing, Zod for input validation, and Recharts for administrative analytics. The database is deliberately central to the design. Its schema covers users, role-specific profiles, vehicles, locations, rides, assignments, payments, ratings, complaints, wallets, transactions, earnings, payouts, status history, and administrative alerts.
RideFlow demonstrates more than basic create, read, update, and delete operations. The SQL layer includes indexes for frequent lookups, views for operational reporting, stored procedures for core workflows, triggers for related state changes, a scheduled event for expiring promotions, and role-based grant examples. This made the project a practical exercise in deciding which rules belong in application code and which benefit from database enforcement.
Handling the Ride Lifecycle
A ride begins with validated pickup, destination, vehicle type, distance, duration, and optional promotion data. Fare calculation combines a base rate with per-kilometre and per-minute rates, applies a surge multiplier, then limits any promotion discount before producing the final amount. When a rider confirms, the system stores the two locations, creates the ride, and searches for an online verified driver with a matching verified vehicle. Driver location freshness, proximity, and rating influence the selection order.
The driver then moves the trip through explicit states: accepted, en route, in progress, and completed. Separate endpoints handle each transition so that permissions and prerequisites can be checked at every step. Status history makes those transitions traceable instead of overwriting the only record of what happened.
Reliability and Tradeoffs
Some workflows call stored procedures, while safe application-level fallbacks handle the same operations when a procedure is unavailable during setup or evaluation. Transactions protect multi-step writes such as creating a ride and its driver assignment. Foreign keys and checks protect relationships and numeric values at the database level.
The current project is designed as a substantial lab implementation rather than a production dispatch network. Driver matching uses a direct proximity calculation, payments are represented as application records rather than a live banking integration, and a real deployment would need stronger geospatial indexing, background jobs, observability, rate limiting, and real-time event delivery. Those boundaries are useful: they show which parts are complete demonstrations and which would need a different scale of infrastructure.
What This Project Demonstrates
RideFlow brings together database design, full-stack TypeScript development, authentication, maps, validation, transactional workflows, and role-based product design. Its main engineering lesson is that a multi-role system becomes manageable when state transitions and data ownership are made explicit.