How sulaimanshaik008-collab/corporate works
Purpose and Runtime Topology
A corporate ride-scheduling system with three role-specific portals: employees request and track rides, transport managers approve/schedule/assign fleet, and drivers execute trips. It runs as a React/Vite SPA calling a Java Spring Boot REST API backed by Supabase PostgreSQL.
• src/main.jsx
• src/main/java/com/ridescheduling/RideSchedulingApplication.java
• src/main/resources/application.yml
Frontend Entry, Session, and Routing
The browser starts the React app, whose app shell and auth context maintain session state. API calls are centralized through a client that injects/uses JWT-backed authentication; route guards separate authenticated and role-specific portal areas.
• src/App.jsx
• src/context/AuthContext.jsx
• src/api/apiClient.js
• src/components/ProtectedRoute.jsx
• src/components/RoleRoute.jsx
Role-oriented User Workflows
UI pages and API modules are organized by employee, manager, and driver workflows. Employee booking/tracking, manager scheduling/assignment, and driver trip execution are distinct frontend boundaries over the backend’s /api/employee, /api/manager, and /api/driver capabilities.
• src/pages/employee/BookRide.jsx
• src/pages/manager/ScheduleRide.jsx
• src/pages/manager/AssignRide.jsx
• src/pages/driver/CurrentTrip.jsx
HTTP, Authentication, and Authorization Boundary
Spring Security protects REST endpoints with JWT authentication, custom user loading, access-denied/unauthenticated handlers, and role-based authorization. Authentication is exposed separately from operational controllers, keeping login/registration and token issuance isolated from domain actions.
• src/main/java/com/ridescheduling/config/SecurityConfig.java
• src/main/java/com/ridescheduling/security/JwtAuthenticationFilter.java
• src/main/java/com/ridescheduling/security/JwtService.java
• src/main/java/com/ridescheduling/controller/AuthController.java
Ride Lifecycle and Operational State Machine
The central domain flow is a guarded ride lifecycle: request, manager approval/rejection, scheduling, driver/vehicle assignment, driver progress updates, completion, or eligible cancellation. Service-layer operations enforce transition and scheduling constraints, persist ride status history, and synchronize fleet availability at trip start/completion.
• src/main/java/com/ridescheduling/service/RideService.java
• src/main/java/com/ridescheduling/service/ManagerRideService.java
• src/main/java/com/ridescheduling/service/RideAssignmentService.java
• src/main/java/com/ridescheduling/service/DriverTripService.java
• src/main/java/com/ridescheduling/entity/RideStatusHistory.java
Domain Persistence and Database Boundary
JPA entities model users/profiles, drivers, vehicles, rides, bookings, status history, and notifications. Repository interfaces form the persistence boundary to PostgreSQL through JDBC/HikariCP; SQL schema exists both at repository root and runtime resources.
• src/main/java/com/ridescheduling/entity/Ride.java
• src/main/java/com/ridescheduling/entity/RideBooking.java
• src/main/java/com/ridescheduling/entity/Driver.java
• src/main/java/com/ridescheduling/repository/RideRepository.java
• src/main/resources/schema.sql
Tracking, Notifications, and API Contracts
Tracking services/controllers expose current and historical ride state for employees and managers. Notifications are persisted per user and surfaced in the SPA. Controllers return DTOs rather than entities, with centralized exception handling providing the API error boundary.
• src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java
• src/main/java/com/ridescheduling/service/RideTrackingHistoryService.java
• src/main/java/com/ridescheduling/service/NotificationService.java
• src/main/java/com/ridescheduling/dto/tracking/RideStatusHistoryResponse.java
• src/main/java/com/ridescheduling/exception/GlobalExceptionHandler.java
Main entry points: EmployeeTrackingController.java Role REST APIs · SecurityConfig.java JWT security boundary · RideRepository.java JPA repositories · App.jsx App shell & session
Components 17
React SPA
- SPA entry
src/main.jsx - App shell & session
src/App.jsx - Auth context · Maintains JWT-backed user session state.
src/context/AuthContext.jsx - Route guards · Separates authenticated and role-specific areas.
src/components/ProtectedRoute.jsx - Role workflow pages · Booking, scheduling, assignment, and active-trip workflows.
src/pages/employee/BookRide.jsx - API client · Sends API calls using JWT authentication.
src/api/apiClient.js
Spring Boot API
- Spring Boot runtime
src/main/java/com/ridescheduling/RideSchedulingApplication.java - JWT security boundary · Authenticates JWTs and authorizes roles before REST access.
src/main/java/com/ridescheduling/config/SecurityConfig.java - Authentication API · Isolates login, registration, and token issuance.
src/main/java/com/ridescheduling/controller/AuthController.java - Role REST APIs · Employee, manager, and driver capabilities under separate API areas.
src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java - Ride lifecycle services · Guards request through approval, scheduling, assignment, execution, completion, and cancellation.
src/main/java/com/ridescheduling/service/RideService.java - Tracking & notifications · Provides ride history and persisted user notifications.
src/main/java/com/ridescheduling/service/RideTrackingHistoryService.java - DTOs & API errors · Controllers return DTOs and centralized handling formats failures.
src/main/java/com/ridescheduling/dto/tracking/RideStatusHistoryResponse.java
Persistence
- JPA repositories
src/main/java/com/ridescheduling/repository/RideRepository.java - Ride domain model · Models rides, bookings, fleet, users, history, and notifications.
src/main/java/com/ridescheduling/entity/Ride.java - Supabase PostgreSQL · Runtime schema and application data store.
src/main/resources/schema.sql
Other components
- Browser users · Employees, managers, and drivers use role-specific portals.
Connections 20
- Browser users → SPA entry: loads
- SPA entry → App shell & session: mounts
- App shell & session → Auth context: uses
- App shell & session → Route guards: routes through
- Route guards → Role workflow pages: permits role access
- Role workflow pages → API client: calls
- Auth context → API client: supplies session token
- API client → JWT security boundary: HTTPS /api requests
- Spring Boot runtime → JWT security boundary: hosts
- JWT security boundary → Authentication API: protects
- JWT security boundary → Role REST APIs: authorizes
- Authentication API → DTOs & API errors: returns
- Role REST APIs → Ride lifecycle services: operates rides
- Role REST APIs → Tracking & notifications: reads tracking
- Role REST APIs → DTOs & API errors: returns
- Ride lifecycle services → Tracking & notifications: records status changes
- Ride lifecycle services → JPA repositories: persists lifecycle and fleet
- Tracking & notifications → JPA repositories: reads history and stores alerts
- JPA repositories → Ride domain model: maps
- JPA repositories → Supabase PostgreSQL: JPA/JDBC via HikariCP