# fenderrex/chair architecture

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

- Interactive diagram: https://gitdiagram.com/fenderrex/chair
- Repository: https://github.com/fenderrex/chair
- Video tour (about a minute): https://gitdiagram.com/fenderrex/chair/video

## Overview

This is a Flask/MySQL rideshare demonstration with separate passenger, driver, and admin experiences. Its central workflow is route/fare estimation, ride request, nearby-driver offers, acceptance, trip lifecycle updates, and live client updates. The graph also preserves documented messaging, location ingestion and simulation, admin operations, signup, payments, identity, and surveys. Some subsystem links rely on README statements because their source was not excerpted; edges are omitted where the caller relationship was not evidenced.

Main entry points: [`app/trips/routes.py`](https://github.com/fenderrex/chair/blob/main/app/trips/routes.py) (Trip routes), [`app/static/js/driver.js`](https://github.com/fenderrex/chair/blob/main/app/static/js/driver.js) (Driver screen), [`app/dispatch/proximity.py`](https://github.com/fenderrex/chair/blob/main/app/dispatch/proximity.py) (Driver dispatch), [`app/location/pipeline.py`](https://github.com/fenderrex/chair/blob/main/app/location/pipeline.py) (Location ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experiences"]
  node_passenger_ui["Passenger screen<br/>[passenger.js]"]
  node_driver_ui["Driver screen<br/>[driver.js]"]
  node_admin_ui["Admin screen<br/>[admin.js]"]
  node_auth["Signup and auth<br/>[services.py]"]
end

subgraph group_ride["Ride workflow"]
  node_trip_api["Trip routes<br/>[routes.py]"]
  node_route_fare["Route and fare<br/>[services.py]"]
  node_trip_requests["Request handling"]
  node_dispatch["Driver dispatch<br/>[proximity.py]"]
  node_trip_lifecycle["Trip lifecycle<br/>[lifecycle.py]"]
  node_trip_state["Trip state<br/>[state.py]"]
  node_trip_stream["Live trip updates<br/>[stream.py]"]
  node_messages["Trip messaging<br/>[services.py]"]
end

subgraph group_operations["Operations and location"]
  node_driver_ops["Driver services<br/>[services.py]"]
  node_location["Location ingestion<br/>[pipeline.py]"]
  node_gps["GPS provider<br/>[gps.py]"]
  node_demo_motion["Demo simulation<br/>[demo_service.py]"]
  node_admin_ops["Admin operations<br/>[services.py]"]
  node_identity["Identity processing<br/>[services.py]"]
  node_payments["Payments<br/>[services.py]"]
  node_surveys["Trip surveys<br/>[routes.py]"]
end

subgraph group_persistence["Data and integrations"]
  node_mysql[("MySQL data<br/>[extensions.py]")]
  node_trip_model["Trip records<br/>[models.py]"]
  node_driver_model["Driver records<br/>[models.py]"]
  node_user_model["User records<br/>[models.py]"]
  node_socketio["Socket.IO<br/>[extensions.py]"]
end

node_passenger(("Passenger"))
node_driver(("Driver"))
node_admin(("Admin"))

node_passenger -->|"uses"| node_passenger_ui
node_driver -->|"uses"| node_driver_ui
node_admin -->|"uses"| node_admin_ui
node_passenger_ui -->|"requests rides"| node_trip_api
node_trip_api -->|"estimates route"| node_route_fare
node_trip_api -->|"creates requests"| node_trip_requests
node_trip_requests -->|"offers rides"| node_dispatch
node_driver -->|"accepts offer"| node_dispatch
node_driver_ui -->|"acts on trips"| node_trip_api
node_trip_api -.->|"updates lifecycle"| node_trip_lifecycle
node_trip_lifecycle -.->|"changes state"| node_trip_state
node_trip_api -->|"publishes snapshots"| node_trip_stream
node_trip_stream -->|"broadcasts updates"| node_socketio
node_passenger_ui -->|"messages driver"| node_messages
node_driver_ui -->|"messages passenger"| node_messages
node_messages -->|"stores messages"| node_mysql
node_gps -->|"submits coordinates"| node_location
node_location -->|"updates location"| node_driver_model
node_driver_ops -->|"manages drivers"| node_driver_model
node_driver_ui -->|"sends GPS"| node_location
node_admin_ui -->|"manages platform"| node_admin_ops
node_admin_ops -->|"reads trip activity"| node_trip_model
node_admin -->|"controls simulation"| node_demo_motion
node_demo_motion -.->|"feeds simulated locations"| node_location
node_passenger -->|"signs up"| node_auth
node_auth -->|"persists account"| node_user_model
node_identity -.->|"stores identity data"| node_mysql
node_payments -.->|"stores payment data"| node_mysql
node_surveys -->|"stores survey data"| node_mysql
node_trip_requests -.->|"persists requests"| node_trip_model
node_dispatch -->|"checks candidates"| node_driver_model
node_dispatch -->|"creates offers"| node_trip_model

click node_passenger_ui "https://github.com/fenderrex/chair/blob/main/app/static/js/passenger.js"
click node_driver_ui "https://github.com/fenderrex/chair/blob/main/app/static/js/driver.js"
click node_admin_ui "https://github.com/fenderrex/chair/blob/main/app/static/js/admin.js"
click node_auth "https://github.com/fenderrex/chair/blob/main/app/auth/services.py"
click node_trip_api "https://github.com/fenderrex/chair/blob/main/app/trips/routes.py"
click node_route_fare "https://github.com/fenderrex/chair/blob/main/app/maps/services.py"
click node_trip_requests "https://github.com/fenderrex/chair/blob/main/app/trips/requests_service.py"
click node_dispatch "https://github.com/fenderrex/chair/blob/main/app/dispatch/proximity.py"
click node_trip_lifecycle "https://github.com/fenderrex/chair/blob/main/app/trips/lifecycle.py"
click node_trip_state "https://github.com/fenderrex/chair/blob/main/app/trips/state.py"
click node_trip_stream "https://github.com/fenderrex/chair/blob/main/app/trips/stream.py"
click node_messages "https://github.com/fenderrex/chair/blob/main/app/messages/services.py"
click node_driver_ops "https://github.com/fenderrex/chair/blob/main/app/drivers/services.py"
click node_location "https://github.com/fenderrex/chair/blob/main/app/location/pipeline.py"
click node_gps "https://github.com/fenderrex/chair/blob/main/app/location/providers/gps.py"
click node_demo_motion "https://github.com/fenderrex/chair/blob/main/app/broker/demo_service.py"
click node_admin_ops "https://github.com/fenderrex/chair/blob/main/app/admin/services.py"
click node_identity "https://github.com/fenderrex/chair/blob/main/app/id_processing/services.py"
click node_payments "https://github.com/fenderrex/chair/blob/main/app/payments/services.py"
click node_surveys "https://github.com/fenderrex/chair/blob/main/app/surveys/routes.py"
click node_mysql "https://github.com/fenderrex/chair/blob/main/app/extensions.py"
click node_trip_model "https://github.com/fenderrex/chair/blob/main/app/trips/models.py"
click node_driver_model "https://github.com/fenderrex/chair/blob/main/app/drivers/models.py"
click node_user_model "https://github.com/fenderrex/chair/blob/main/app/users/models.py"
click node_socketio "https://github.com/fenderrex/chair/blob/main/app/extensions.py"

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_passenger_ui,node_driver_ui,node_admin_ui,node_auth toneBlue
class node_trip_api,node_route_fare,node_trip_requests,node_dispatch,node_trip_lifecycle,node_trip_state,node_trip_stream,node_messages toneAmber
class node_driver_ops,node_location,node_gps,node_demo_motion,node_admin_ops,node_identity,node_payments,node_surveys toneMint
class node_mysql,node_trip_model,node_driver_model,node_user_model,node_socketio toneRose
class node_passenger,node_driver,node_admin toneIndigo
```

## Components

### User experiences

- [Passenger screen](https://github.com/fenderrex/chair/blob/main/app/static/js/passenger.js): `app/static/js/passenger.js`
- [Driver screen](https://github.com/fenderrex/chair/blob/main/app/static/js/driver.js): `app/static/js/driver.js`
- [Admin screen](https://github.com/fenderrex/chair/blob/main/app/static/js/admin.js): `app/static/js/admin.js`
- [Signup and auth](https://github.com/fenderrex/chair/blob/main/app/auth/services.py): `app/auth/services.py`

### Ride workflow

- [Trip routes](https://github.com/fenderrex/chair/blob/main/app/trips/routes.py): `app/trips/routes.py`
- [Route and fare](https://github.com/fenderrex/chair/blob/main/app/maps/services.py): `app/maps/services.py`
- [Request handling](https://github.com/fenderrex/chair/blob/main/app/trips/requests_service.py): `app/trips/requests_service.py`
- [Driver dispatch](https://github.com/fenderrex/chair/blob/main/app/dispatch/proximity.py): `app/dispatch/proximity.py`
- [Trip lifecycle](https://github.com/fenderrex/chair/blob/main/app/trips/lifecycle.py): `app/trips/lifecycle.py`
- [Trip state](https://github.com/fenderrex/chair/blob/main/app/trips/state.py): `app/trips/state.py`
- [Live trip updates](https://github.com/fenderrex/chair/blob/main/app/trips/stream.py): `app/trips/stream.py`
- [Trip messaging](https://github.com/fenderrex/chair/blob/main/app/messages/services.py): `app/messages/services.py`

### Operations and location

- [Driver services](https://github.com/fenderrex/chair/blob/main/app/drivers/services.py): `app/drivers/services.py`
- [Location ingestion](https://github.com/fenderrex/chair/blob/main/app/location/pipeline.py): `app/location/pipeline.py`
- [GPS provider](https://github.com/fenderrex/chair/blob/main/app/location/providers/gps.py): `app/location/providers/gps.py`
- [Demo simulation](https://github.com/fenderrex/chair/blob/main/app/broker/demo_service.py): `app/broker/demo_service.py`
- [Admin operations](https://github.com/fenderrex/chair/blob/main/app/admin/services.py): `app/admin/services.py`
- [Identity processing](https://github.com/fenderrex/chair/blob/main/app/id_processing/services.py): `app/id_processing/services.py`
- [Payments](https://github.com/fenderrex/chair/blob/main/app/payments/services.py): `app/payments/services.py`
- [Trip surveys](https://github.com/fenderrex/chair/blob/main/app/surveys/routes.py): `app/surveys/routes.py`

### Data and integrations

- [MySQL data](https://github.com/fenderrex/chair/blob/main/app/extensions.py): `app/extensions.py`
- [Trip records](https://github.com/fenderrex/chair/blob/main/app/trips/models.py): `app/trips/models.py`
- [Driver records](https://github.com/fenderrex/chair/blob/main/app/drivers/models.py): `app/drivers/models.py`
- [User records](https://github.com/fenderrex/chair/blob/main/app/users/models.py): `app/users/models.py`
- [Socket.IO](https://github.com/fenderrex/chair/blob/main/app/extensions.py): `app/extensions.py`

### Other components

- **Passenger**
- **Driver**
- **Admin**

## Connections

- Passenger → Passenger screen: uses
- Driver → Driver screen: uses
- Admin → Admin screen: uses
- Passenger screen → Trip routes: requests rides
- Trip routes → Route and fare: estimates route (evidence: `app/trips/routes.py`)
- Trip routes → Request handling: creates requests
- Request handling → Driver dispatch: offers rides (evidence: `app/trips/requests_service.py`)
- Driver → Driver dispatch: accepts offer
- Driver screen → Trip routes: acts on trips (evidence: `app/trips/routes.py`)
- Trip routes → Trip lifecycle: updates lifecycle
- Trip lifecycle → Trip state: changes state
- Trip routes → Live trip updates: publishes snapshots (evidence: `app/trips/routes.py`)
- Live trip updates → Socket.IO: broadcasts updates (evidence: `app/trips/stream.py`)
- Passenger screen → Trip messaging: messages driver
- Driver screen → Trip messaging: messages passenger
- Trip messaging → MySQL data: stores messages
- GPS provider → Location ingestion: submits coordinates (evidence: `app/location/providers/gps.py`)
- Location ingestion → Driver records: updates location
- Driver services → Driver records: manages drivers (evidence: `app/drivers/services.py`)
- Driver screen → Location ingestion: sends GPS
- Admin screen → Admin operations: manages platform
- Admin operations → Trip records: reads trip activity (evidence: `app/admin/services.py`)
- Admin → Demo simulation: controls simulation
- Demo simulation → Location ingestion: feeds simulated locations
- Passenger → Signup and auth: signs up
- Signup and auth → User records: persists account
- Identity processing → MySQL data: stores identity data
- Payments → MySQL data: stores payment data
- Trip surveys → MySQL data: stores survey data (evidence: `app/surveys/routes.py`)
- Request handling → Trip records: persists requests (evidence: `app/trips/requests_service.py`)
- Driver dispatch → Driver records: checks candidates (evidence: `app/dispatch/proximity.py`)
- Driver dispatch → Trip records: creates offers (evidence: `app/dispatch/proximity.py`)
