# leyang050317/greenpool architecture

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

- Interactive diagram: https://gitdiagram.com/leyang050317/greenpool
- Repository: https://github.com/leyang050317/greenpool

## Overview

GreenPool is a carpooling application for drivers to publish and manage trips and passengers to find trips, request seats, and pay; it also supports vehicle-document onboarding, trip routing, ratings, safety, notifications, and tourist attractions. The main workflow runs from trip publication through booking and payment to post-trip ratings. Sampled controller excerpts and the SOURCE INDEX support the booking, trip, routing, and rating links; README statements establish Stripe and OCR behavior. Other listed capabilities are represented, but their internal links are omitted where source evidence was not shown.

Main entry points: [`app/Http/Controllers/Passenger/PassengerBookingController.php`](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Passenger/PassengerBookingController.php) (Passenger bookings), [`app/Services/PaymentService.php`](https://github.com/leyang050317/greenpool/blob/main/app/Services/PaymentService.php) (Payment handling), [`app/Http/Controllers/Driver/VehicleController.php`](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/VehicleController.php) (Vehicle onboarding), [`app/Http/Controllers/Driver/TripController.php`](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/TripController.php) (Trip management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Accounts and vehicles"]
  node_auth["Account access"]
  node_profiles["Profiles"]
  node_vehicles["Vehicle onboarding"]
  node_ocr["Document OCR"]
  node_vehicle_data[("Vehicles<br/>[Vehicle.php]")]
end

subgraph group_journeys["Trips and bookings"]
  node_trip_manage["Trip management<br/>[TripController.php]"]
  node_trip_data[("Trips<br/>[Trip.php]")]
  node_routing["Trip routing"]
  node_booking["Passenger bookings"]
  node_booking_data[("Bookings<br/>[Booking.php]")]
  node_chat["Booking chat<br/>[ChatController.php]"]
end

subgraph group_money_feedback["Payments and ratings"]
  node_payments["Payment handling<br/>[PaymentService.php]"]
  node_stripe_checkout["Stripe checkout"]
  node_stripe_webhook["Stripe webhook"]
  node_payment_data[("Payments<br/>[Payment.php]")]
  node_ratings["Ratings"]
  node_rating_data[("Rating records<br/>[Rating.php]")]
end

subgraph group_support_safety["Safety and support"]
  node_emergency["Emergency response"]
  node_notifications["Notifications"]
  node_faq["FAQ assistant"]
end

subgraph group_discovery["Attractions"]
  node_attractions["Tourist attractions"]
  node_attraction_data[("Attraction records<br/>[Attraction.php]")]
end

node_passenger(("Passenger"))
node_driver(("Driver"))
node_web(("Web interface"))
node_google_maps["Google Maps"]
node_stripe["Stripe"]
node_places["Google Places"]

node_passenger -->|"requests seats"| node_booking
node_driver -->|"manages trips"| node_trip_manage
node_web -.->|"signs in"| node_auth
node_web -.->|"edits profile"| node_profiles
node_driver -.->|"registers vehicle"| node_vehicles
node_vehicles -->|"scans documents"| node_ocr
node_vehicles -->|"saves vehicle"| node_vehicle_data
node_trip_manage -->|"saves trips"| node_trip_data
node_trip_manage -->|"calculates route"| node_routing
node_routing -->|"requests places"| node_google_maps
node_booking -->|"searches trips"| node_trip_data
node_booking -->|"calculates route"| node_routing
node_booking -->|"creates booking"| node_booking_data
node_booking -.->|"notifies driver"| node_notifications
node_booking -->|"checks payment limits"| node_payments
node_passenger -.->|"pays fare"| node_payments
node_payments -->|"reads and writes"| node_payment_data
node_payments -.->|"starts checkout"| node_stripe_checkout
node_stripe_checkout -->|"creates session"| node_stripe
node_stripe -->|"sends signed event"| node_stripe_webhook
node_stripe_webhook -.->|"marks paid"| node_payment_data
node_booking -.->|"opens post-trip ratings"| node_ratings
node_ratings -->|"saves rating"| node_rating_data
node_ratings -->|"notifies reviewee"| node_notifications
node_driver -.->|"reports emergency"| node_emergency
node_booking -.->|"opens trip chat"| node_chat
node_passenger -.->|"asks questions"| node_faq
node_faq -.->|"uses places data"| node_google_maps
node_passenger -.->|"explores attractions"| node_attractions
node_attractions -->|"looks up places"| node_places
node_attractions -->|"reads attractions"| node_attraction_data

click node_auth "https://github.com/leyang050317/greenpool/tree/main/app/Http/Controllers/Auth"
click node_profiles "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/ProfileController.php"
click node_vehicles "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/VehicleController.php"
click node_ocr "https://github.com/leyang050317/greenpool/tree/main/app/Services/Ocr"
click node_vehicle_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Vehicle.php"
click node_trip_manage "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/TripController.php"
click node_trip_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Trip.php"
click node_routing "https://github.com/leyang050317/greenpool/blob/main/app/Services/Routing/TripDistanceService.php"
click node_booking "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Passenger/PassengerBookingController.php"
click node_booking_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Booking.php"
click node_chat "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/ChatController.php"
click node_payments "https://github.com/leyang050317/greenpool/blob/main/app/Services/PaymentService.php"
click node_stripe_checkout "https://github.com/leyang050317/greenpool/blob/main/app/Services/StripeCheckoutService.php"
click node_stripe_webhook "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/StripeWebhookController.php"
click node_payment_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Payment.php"
click node_ratings "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/RatingController.php"
click node_rating_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Rating.php"
click node_emergency "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/EmergencyController.php"
click node_notifications "https://github.com/leyang050317/greenpool/blob/main/app/Services/NotificationDeliveryService.php"
click node_faq "https://github.com/leyang050317/greenpool/blob/main/app/Services/GeminiFaqService.php"
click node_attractions "https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/AttractionController.php"
click node_attraction_data "https://github.com/leyang050317/greenpool/blob/main/app/Models/Attraction.php"

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_auth,node_profiles,node_vehicles,node_ocr,node_vehicle_data toneBlue
class node_trip_manage,node_trip_data,node_routing,node_booking,node_booking_data,node_chat toneAmber
class node_payments,node_stripe_checkout,node_stripe_webhook,node_payment_data,node_ratings,node_rating_data toneMint
class node_emergency,node_notifications,node_faq toneRose
class node_attractions,node_attraction_data,node_passenger,node_driver,node_web,node_google_maps,node_stripe,node_places toneIndigo
```

## Components

### Accounts and vehicles

- [Account access](https://github.com/leyang050317/greenpool/tree/main/app/Http/Controllers/Auth): `app/Http/Controllers/Auth`
- [Profiles](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/ProfileController.php): `app/Http/Controllers/ProfileController.php`
- [Vehicle onboarding](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/VehicleController.php): `app/Http/Controllers/Driver/VehicleController.php`
- [Document OCR](https://github.com/leyang050317/greenpool/tree/main/app/Services/Ocr): `app/Services/Ocr`
- [Vehicles](https://github.com/leyang050317/greenpool/blob/main/app/Models/Vehicle.php): `app/Models/Vehicle.php`

### Trips and bookings

- [Trip management](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Driver/TripController.php): `app/Http/Controllers/Driver/TripController.php`
- [Trips](https://github.com/leyang050317/greenpool/blob/main/app/Models/Trip.php): `app/Models/Trip.php`
- [Trip routing](https://github.com/leyang050317/greenpool/blob/main/app/Services/Routing/TripDistanceService.php): `app/Services/Routing/TripDistanceService.php`
- [Passenger bookings](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/Passenger/PassengerBookingController.php): `app/Http/Controllers/Passenger/PassengerBookingController.php`
- [Bookings](https://github.com/leyang050317/greenpool/blob/main/app/Models/Booking.php): `app/Models/Booking.php`
- [Booking chat](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/ChatController.php): `app/Http/Controllers/ChatController.php`

### Payments and ratings

- [Payment handling](https://github.com/leyang050317/greenpool/blob/main/app/Services/PaymentService.php): `app/Services/PaymentService.php`
- [Stripe checkout](https://github.com/leyang050317/greenpool/blob/main/app/Services/StripeCheckoutService.php): `app/Services/StripeCheckoutService.php`
- [Stripe webhook](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/StripeWebhookController.php): `app/Http/Controllers/StripeWebhookController.php`
- [Payments](https://github.com/leyang050317/greenpool/blob/main/app/Models/Payment.php): `app/Models/Payment.php`
- [Ratings](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/RatingController.php): `app/Http/Controllers/RatingController.php`
- [Rating records](https://github.com/leyang050317/greenpool/blob/main/app/Models/Rating.php): `app/Models/Rating.php`

### Safety and support

- [Emergency response](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/EmergencyController.php): `app/Http/Controllers/EmergencyController.php`
- [Notifications](https://github.com/leyang050317/greenpool/blob/main/app/Services/NotificationDeliveryService.php): `app/Services/NotificationDeliveryService.php`
- [FAQ assistant](https://github.com/leyang050317/greenpool/blob/main/app/Services/GeminiFaqService.php): `app/Services/GeminiFaqService.php`

### Attractions

- [Tourist attractions](https://github.com/leyang050317/greenpool/blob/main/app/Http/Controllers/AttractionController.php): `app/Http/Controllers/AttractionController.php`
- [Attraction records](https://github.com/leyang050317/greenpool/blob/main/app/Models/Attraction.php): `app/Models/Attraction.php`

### Other components

- **Passenger**
- **Driver**
- **Web interface**
- **Google Maps**
- **Stripe**
- **Google Places**

## Connections

- Passenger → Passenger bookings: requests seats (evidence: `app/Http/Controllers/Passenger/PassengerBookingController.php`)
- Driver → Trip management: manages trips (evidence: `app/Http/Controllers/Driver/TripController.php`)
- Web interface → Account access: signs in
- Web interface → Profiles: edits profile
- Driver → Vehicle onboarding: registers vehicle
- Vehicle onboarding → Document OCR: scans documents (evidence: `app/Http/Controllers/Driver/VehicleController.php`)
- Vehicle onboarding → Vehicles: saves vehicle (evidence: `app/Http/Controllers/Driver/VehicleController.php`)
- Trip management → Trips: saves trips (evidence: `app/Http/Controllers/Driver/TripController.php`)
- Trip management → Trip routing: calculates route (evidence: `app/Http/Controllers/Driver/TripController.php`)
- Trip routing → Google Maps: requests places
- Passenger bookings → Trips: searches trips (evidence: `app/Http/Controllers/Passenger/PassengerBookingController.php`)
- Passenger bookings → Trip routing: calculates route (evidence: `app/Http/Controllers/Passenger/PassengerBookingController.php`)
- Passenger bookings → Bookings: creates booking (evidence: `app/Http/Controllers/Passenger/PassengerBookingController.php`)
- Passenger bookings → Notifications: notifies driver
- Passenger bookings → Payment handling: checks payment limits (evidence: `app/Http/Controllers/Passenger/PassengerBookingController.php`)
- Passenger → Payment handling: pays fare
- Payment handling → Payments: reads and writes (evidence: `app/Services/PaymentService.php`)
- Payment handling → Stripe checkout: starts checkout
- Stripe checkout → Stripe: creates session
- Stripe → Stripe webhook: sends signed event
- Stripe webhook → Payments: marks paid
- Passenger bookings → Ratings: opens post-trip ratings
- Ratings → Rating records: saves rating (evidence: `app/Http/Controllers/RatingController.php`)
- Ratings → Notifications: notifies reviewee (evidence: `app/Http/Controllers/RatingController.php`)
- Driver → Emergency response: reports emergency
- Passenger bookings → Booking chat: opens trip chat
- Passenger → FAQ assistant: asks questions
- FAQ assistant → Google Maps: uses places data
- Passenger → Tourist attractions: explores attractions
- Tourist attractions → Google Places: looks up places (evidence: `app/Http/Controllers/AttractionController.php`)
- Tourist attractions → Attraction records: reads attractions (evidence: `app/Http/Controllers/AttractionController.php`)
