Low Level Design (LLD): Ride Sharing Application | Swiggy / MMT

Posted
11 Jan 2026
196 reads

Summary

This post details the Low Level Design (LLD) for a Ride Sharing Application, outlining the core problem statement, functional requirements, and a structured approach to its implementation.

How it went

Problem Statement

The application allows users to share rides on a route.

  • Users can either offer a shared ride (Driver) or consume a shared ride (Passenger).
  • Users can search and select one from multiple available rides on a route with the same source and destination.

Usecases:

  • Application should allow to register users:
    create_user(name:"John",gender:M,age:26)
  • Users should be able to add vehicle (a user can have multiple vehicles):
    create_vehicle(name:"John", vehicle:"swift", regNo:"KA-09-32321")
  • Users should be able offer rides:
    offer_ride(name: "John", vehicle: "swift", seats_available: 3, origin: Bangalore, destination: Mysore, start: 'March 21, 2024, 10 AM', duration: 3h)
  • Users should be able to select rides based on origin, destination, and selection preference:
    select_ride(name:"smith",origin:bangalore,destination:mysore,seats_requierd:2,earliest_ending_ride)

Users can have preferences like:

  • Earliest ending ride or lowest duration ride
  • Preferred Vehicle (Activa/Polo/XUV)
  • Most Vacant.

Users should be able to get all the rides offered and taken by the user.

Solution ->

Video link - https://youtu.be/SOZ69p16pmw?si=yvb2Jn3V_FkI4lvo

Entities Involved

  • User
  • Vehicle
  • Ride
  • RideStatus
  • VehicleType

Service

  • UserService
  • VehicleService
  • RideService

Repository

  • UserRepository
  • VehicleRepository
  • RideRepository

Ride Strategies

  • RideStrategy -> selectRide(List<Ride> rides)
  • EarliestEndingRideStrategy
  • LowestDurationRideStrategy
  • MostVacantRideStrategy
  • PreferredVehicleRideStrategy

RideSharingFacade

RideSharingDemo

Entitiy Fields

1. User Entity

  • name (String)
  • gender (String)
  • age (int)

Vehicle Entity

  • vehicleOwnerName (String)
  • vehicleName (String)
  • vehicleType (VehicleType - optional)
  • regNo (String)

Ride Entity

  • ride_id (String)
  • origin (String)
  • destination (String)
  • vehicleForRide (Vehicle)
  • totalSeatsForRide (Integer)
  • rideStatus (RideStatus)
  • rideUser (User)
  • rideFare (Integer - optional)
  • startTime (LocalDateTime)
  • durationHours (Integer)
  • Plus computed field: endTime (via getEndTime() method)

RideStatus Enum

  • START, IN_PROGRESS, COMPLETE

VehicleType Enum

  • CAR, BIKE

Questions asked (1)

  1. 01

    Low Level Design: Ride Sharing Application

    System Design · Hard

    The application allows users to share rides on a route.

    • Users can either offer a shared ride (Driver) or consume a shared ride (Passenger).
    • Users can search and select one from multiple available rides on a route with the same source and destination.

    Usecases:

    • Application should allow to register users:
      create_user(name:"John",gender:M,age:26)
    • Users should be able to add vehicle (a user can have multiple vehicles):
      create_vehicle(name:"John", vehicle:"swift", regNo:"KA-09-32321")
    • Users should be able offer rides:
      offer_ride(name: "John", vehicle: "swift", seats_available: 3, origin: Bangalore, destination: Mysore, start: 'March 21, 2024, 10 AM', duration: 3h)
    • Users should be able to select rides based on origin, destination, and selection preference:
      select_ride(name:"smith",origin:bangalore,destination:mysore,seats_requierd:2,earliest_ending_ride)

    Users can have preferences like:

    • Earliest ending ride or lowest duration ride
    • Preferred Vehicle (Activa/Polo/XUV)
    • Most Vacant.

    Users should be able to get all the rides offered and taken by the user.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Swiggy / Makemytrip recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!