This repository contains a full ride-booking system with:
- Main Backend Service (
Uber-Spring-2025) for business logic and persistence - Realtime WebSocket Service (
Uber-Websocket-Service) for driver/passenger live events - Frontend App (
UberFrontend-master) for driver and passenger experiences
Uber-Complete-Project/
├── Uber-Spring-2025/ # REST API, booking logic, Redis geo, gRPC server/client
├── Uber-Websocket-Service/ # STOMP WebSocket gateway + gRPC server/client
└── UberFrontend-master/ # Vanilla JS client (driver/passenger modes)
| Layer | Technology |
|---|---|
| Frontend | HTML, CSS, Vanilla JavaScript, SockJS, STOMP |
| Main Backend | Java 21, Spring Boot 3.5, Spring Data JPA, Validation, Redis |
| WebSocket Service | Java 17, Spring Boot, Spring WebSocket/STOMP |
| Inter-service RPC | gRPC + Protobuf |
| Datastores | MySQL (bookings, drivers, passengers), Redis GEO (driver:geo) |
| Build/Test | Gradle, JUnit |
flowchart LR
P[Passenger UI<br/>UberFrontend-master] -->|REST /api/*| B[Uber-Spring-2025<br/>Port 8080]
D[Driver UI<br/>UberFrontend-master] -->|REST /api/*| B
D -->|SockJS/STOMP<br/>/ws-uber| W[Uber-Websocket-Service<br/>Port 8082]
P -->|SockJS/STOMP<br/>/ws-uber| W
B -->|JPA| M[(MySQL)]
B -->|Redis GEO| R[(Redis)]
B -->|gRPC notifyRide / cancelRideNotification<br/>verifyTripCompletion / notifyDriverCompletion<br/>Port 9091| W
W -->|gRPC acceptRide<br/>Port 9090| B
- Driver UI calls
POST /api/v1/location/driverlocation. - Backend stores driver coordinates in Redis GEO key
driver:geo.
- Passenger UI calls
POST /api/bookings. - Backend creates booking with status
PENDINGin MySQL. - Backend fetches nearby drivers from Redis within ~10 km.
- Backend calls WebSocket service over gRPC
notifyRide(...)withdriverIds. - WebSocket service publishes
/topic/new-ride/{driverId}to each driver.
- Driver UI sends STOMP message to
/app/ride-acceptancewith{driverId, bookingId}. - WebSocket service calls backend gRPC
acceptRide(...). - Backend validates driver availability, assigns driver, sets booking
CONFIRMED. - Backend calls gRPC
cancelRideNotification(...)for other nearby drivers. - WebSocket service publishes
/topic/ride-cancelled/{driverId}so other driver screens remove the request.
- Driver UI sends periodic live location to
/app/driver-location. - WebSocket service broadcasts
/topic/ride-location/{bookingId}. - Passenger UI subscribes and tracks driver movement.
- Driver requests completion via
POST /api/bookings/{id}/complete-request. - Backend sets
REQUESTED_COMPLETION, calls gRPCverifyTripCompletion. - Passenger receives
/topic/verify-trip/{passengerId}and confirms. - Passenger confirms via
POST /api/bookings/{id}/complete-confirm. - Backend sets
COMPLETED, marks driver available, and notifies driver on/topic/trip-completed/{driverId}.
sequenceDiagram
participant PassengerUI
participant DriverUI
participant Backend as Uber-Spring-2025
participant Redis
participant WS as Uber-Websocket-Service
participant MySQL
DriverUI->>Backend: POST /api/v1/location/driverlocation
Backend->>Redis: GEOADD driver:geo
PassengerUI->>Backend: POST /api/bookings
Backend->>MySQL: Insert booking (PENDING)
Backend->>Redis: GEOSEARCH nearby drivers
Backend->>WS: gRPC notifyRide(driverIds, bookingId)
WS-->>DriverUI: /topic/new-ride/{driverId}
DriverUI->>WS: STOMP /app/ride-acceptance
WS->>Backend: gRPC acceptRide(driverId, bookingId)
Backend->>MySQL: Update booking (CONFIRMED + driverId)
Backend->>WS: gRPC cancelRideNotification(otherDrivers)
WS-->>DriverUI: /topic/ride-cancelled/{driverId}
| From | To | Protocol | Contract |
|---|---|---|---|
| Backend | WebSocket Service | gRPC | RideNotificationService.notifyRide |
| Backend | WebSocket Service | gRPC | cancelRideNotification |
| Backend | WebSocket Service | gRPC | verifyTripCompletion, notifyDriverCompletion |
| WebSocket Service | Backend | gRPC | RideService.acceptRide |
| Frontend | Backend | REST | /api/bookings, /api/drivers, /api/passengers, /api/v1/location/* |
| Frontend | WebSocket Service | STOMP/SockJS | /app/* send + /topic/* subscribe |
/app/ride-acceptance/app/driver-location/app/chat
/topic/new-ride/{driverId}/topic/ride-cancelled/{driverId}/topic/verify-trip/{passengerId}/topic/trip-completed/{driverId}/topic/ride-location/{bookingId}/topic/chat/{bookingId}
stateDiagram-v2
[*] --> PENDING
PENDING --> CONFIRMED: Driver accepts
CONFIRMED --> IN_PROGRESS
IN_PROGRESS --> REQUESTED_COMPLETION: Driver requests completion
REQUESTED_COMPLETION --> COMPLETED: Passenger confirms
PENDING --> CANCELLED
CONFIRMED --> CANCELLED
- Start MySQL and Redis.
- Start backend:
cd Uber-Spring-2025 ./gradlew bootRun - Start websocket service:
cd Uber-Websocket-Service ./gradlew bootRun - Start frontend:
cd UberFrontend-master python3 -m http.server 8000 - Open:
- Passenger:
http://localhost:8000/index.html?role=passenger&passengerId=1 - Driver:
http://localhost:8000/index.html?role=driver&driverId=1
- Passenger:
- gRPC contracts are shared in
src/main/proto/booking.protoin both services. - Backend gRPC server runs on 9090 and talks to WebSocket gRPC server on 9091.
- Redis is used for driver proximity search, not long-term booking storage.
- MySQL is the source of truth for bookings, passengers, and drivers.