# sulaimanshaik008-collab/corporate architecture

> Architecture diagram of the GitHub repository sulaimanshaik008-collab/corporate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sulaimanshaik008-collab/corporate
- Repository: https://github.com/sulaimanshaik008-collab/corporate

## Overview

#### 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: [`src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java`](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java) (Role REST APIs), [`src/main/java/com/ridescheduling/config/SecurityConfig.java`](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/config/SecurityConfig.java) (JWT security boundary), [`src/main/java/com/ridescheduling/repository/RideRepository.java`](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/repository/RideRepository.java) (JPA repositories), [`src/App.jsx`](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/App.jsx) (App shell & session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa_entry["SPA entry<br/>React/Vite bootstrap<br/>[main.jsx]"]
  node_app_shell["App shell &amp; session<br/>React routing/context<br/>[App.jsx]"]
  node_auth_context["Auth context<br/>session state<br/>[AuthContext.jsx]"]
  node_route_guards["Route guards<br/>access control UI<br/>[ProtectedRoute.jsx]"]
  node_role_portals["Role workflow pages<br/>employee/manager/driver UI<br/>[BookRide.jsx]"]
  node_api_client["API client<br/>authenticated HTTP client<br/>[apiClient.js]"]
end

subgraph group_backend["Spring Boot API"]
  node_api_runtime["Spring Boot runtime<br/>application bootstrap"]
  node_security["JWT security boundary<br/>Spring Security"]
  node_auth_api["Authentication API<br/>auth controller"]
  node_role_apis["Role REST APIs<br/>operational controllers"]
  node_ride_lifecycle["Ride lifecycle services<br/>domain state machine<br/>[RideService.java]"]
  node_tracking_notifications["Tracking &amp; notifications<br/>application services"]
  node_api_contracts["DTOs &amp; API errors<br/>API boundary"]
end

subgraph group_data["Persistence"]
  node_repositories["JPA repositories<br/>persistence boundary"]
  node_domain_model["Ride domain model<br/>JPA entities<br/>[Ride.java]"]
  node_postgres[("Supabase PostgreSQL<br/>database<br/>[schema.sql]")]
end

node_browser(("Browser users<br/>client"))

node_browser -->|"loads"| node_spa_entry
node_spa_entry -->|"mounts"| node_app_shell
node_app_shell -->|"uses"| node_auth_context
node_app_shell -->|"routes through"| node_route_guards
node_route_guards -->|"permits role access"| node_role_portals
node_role_portals -->|"calls"| node_api_client
node_auth_context -->|"supplies session token"| node_api_client
node_api_client -->|"HTTPS /api requests"| node_security
node_api_runtime -->|"hosts"| node_security
node_security -->|"protects"| node_auth_api
node_security -->|"authorizes"| node_role_apis
node_auth_api -->|"returns"| node_api_contracts
node_role_apis -->|"operates rides"| node_ride_lifecycle
node_role_apis -->|"reads tracking"| node_tracking_notifications
node_role_apis -->|"returns"| node_api_contracts
node_ride_lifecycle -->|"records status changes"| node_tracking_notifications
node_ride_lifecycle -->|"persists lifecycle and fleet"| node_repositories
node_tracking_notifications -->|"reads history and stores alerts"| node_repositories
node_repositories -->|"maps"| node_domain_model
node_repositories -->|"JPA/JDBC via HikariCP"| node_postgres

click node_spa_entry "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main.jsx"
click node_app_shell "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/App.jsx"
click node_auth_context "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/context/AuthContext.jsx"
click node_route_guards "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/components/ProtectedRoute.jsx"
click node_role_portals "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/pages/employee/BookRide.jsx"
click node_api_client "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/api/apiClient.js"
click node_api_runtime "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/RideSchedulingApplication.java"
click node_security "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/config/SecurityConfig.java"
click node_auth_api "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/controller/AuthController.java"
click node_role_apis "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java"
click node_ride_lifecycle "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/service/RideService.java"
click node_tracking_notifications "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/service/RideTrackingHistoryService.java"
click node_api_contracts "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/dto/tracking/RideStatusHistoryResponse.java"
click node_repositories "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/repository/RideRepository.java"
click node_domain_model "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/entity/Ride.java"
click node_postgres "https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/resources/schema.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_spa_entry,node_app_shell,node_auth_context,node_route_guards,node_role_portals,node_api_client toneBlue
class node_api_runtime,node_security,node_auth_api,node_role_apis,node_ride_lifecycle,node_tracking_notifications,node_api_contracts toneAmber
class node_repositories,node_domain_model,node_postgres toneMint
class node_browser toneNeutral
```

## Components

### React SPA

- [SPA entry](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main.jsx): React/Vite bootstrap · `src/main.jsx`
- [App shell & session](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/App.jsx): React routing/context · `src/App.jsx`
- [Auth context](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/context/AuthContext.jsx): session state · Maintains JWT-backed user session state. · `src/context/AuthContext.jsx`
- [Route guards](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/components/ProtectedRoute.jsx): access control UI · Separates authenticated and role-specific areas. · `src/components/ProtectedRoute.jsx`
- [Role workflow pages](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/pages/employee/BookRide.jsx): employee/manager/driver UI · Booking, scheduling, assignment, and active-trip workflows. · `src/pages/employee/BookRide.jsx`
- [API client](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/api/apiClient.js): authenticated HTTP client · Sends API calls using JWT authentication. · `src/api/apiClient.js`

### Spring Boot API

- [Spring Boot runtime](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/RideSchedulingApplication.java): application bootstrap · `src/main/java/com/ridescheduling/RideSchedulingApplication.java`
- [JWT security boundary](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/config/SecurityConfig.java): Spring Security · Authenticates JWTs and authorizes roles before REST access. · `src/main/java/com/ridescheduling/config/SecurityConfig.java`
- [Authentication API](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/controller/AuthController.java): auth controller · Isolates login, registration, and token issuance. · `src/main/java/com/ridescheduling/controller/AuthController.java`
- [Role REST APIs](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java): operational controllers · Employee, manager, and driver capabilities under separate API areas. · `src/main/java/com/ridescheduling/controller/EmployeeTrackingController.java`
- [Ride lifecycle services](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/service/RideService.java): domain state machine · Guards request through approval, scheduling, assignment, execution, completion, and cancellation. · `src/main/java/com/ridescheduling/service/RideService.java`
- [Tracking & notifications](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/service/RideTrackingHistoryService.java): application services · Provides ride history and persisted user notifications. · `src/main/java/com/ridescheduling/service/RideTrackingHistoryService.java`
- [DTOs & API errors](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/dto/tracking/RideStatusHistoryResponse.java): API boundary · Controllers return DTOs and centralized handling formats failures. · `src/main/java/com/ridescheduling/dto/tracking/RideStatusHistoryResponse.java`

### Persistence

- [JPA repositories](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/repository/RideRepository.java): persistence boundary · `src/main/java/com/ridescheduling/repository/RideRepository.java`
- [Ride domain model](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/java/com/ridescheduling/entity/Ride.java): JPA entities · Models rides, bookings, fleet, users, history, and notifications. · `src/main/java/com/ridescheduling/entity/Ride.java`
- [Supabase PostgreSQL](https://github.com/sulaimanshaik008-collab/corporate/blob/main/src/main/resources/schema.sql): database · Runtime schema and application data store. · `src/main/resources/schema.sql`

### Other components

- **Browser users**: client · Employees, managers, and drivers use role-specific portals.

## Connections

- 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
