# redwan786/dhaka-tesla-pool-v2 architecture

> Architecture diagram of the GitHub repository redwan786/dhaka-tesla-pool-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redwan786/dhaka-tesla-pool-v2
- Repository: https://github.com/redwan786/dhaka-tesla-pool-v2

## Overview

Dhaka Tesla Pool is a ride-pooling application: passengers choose Dhaka zones, estimate fares, request and track rides; drivers review compatible requests, accept them into capacity-limited pools, and advance pool status through completion. The web client communicates with the Express API, which owns authentication, authorization, validation, fare and lifecycle rules, and persistence. The README documents transactional seat allocation and PostgreSQL row locking; sampled code confirms controller-to-service calls but does not expose every domain service implementation, so uncertain internal wiring is omitted.

Main entry points: [`apps/api/src/routes/index.ts`](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/routes/index.ts) (API routes), [`apps/web/app`](https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/app) (Web app), [`apps/web/lib/api/client.ts`](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/lib/api/client.ts) (Typed API client), [`apps/web/components/passenger`](https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/components/passenger) (Passenger UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_app["Web app"]
  node_passenger_ui["Passenger UI"]
  node_driver_ui["Driver UI"]
  node_auth_ui["Auth UI"]
  node_auth_provider["Session provider<br/>[auth-provider.tsx]"]
  node_api_client["Typed API client<br/>[client.ts]"]
end

subgraph group_api["API access"]
  node_api_app["Express API<br/>[app.ts]"]
  node_api_routes["API routes<br/>[index.ts]"]
end

subgraph group_ride["Ride operations"]
  node_passenger_routes["Passenger routes"]
  node_passenger_controller["Passenger controller"]
  node_passenger_service["Passenger service"]
  node_geography_routes["Geography routes"]
  node_geography_controller["Geography controller"]
  node_geography_service["Geography service"]
  node_pool_routes["Pool routes<br/>[pool.routes.ts]"]
  node_pool_controller["Pool controller<br/>[pool.controller.ts]"]
  node_pool_service["Pool service<br/>[pool.service.ts]"]
  node_driver_routes["Driver routes<br/>[driver.routes.ts]"]
  node_driver_controller["Driver controller"]
  node_driver_service["Driver service<br/>[driver.service.ts]"]
end

subgraph group_identity["Identity"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_auth_controller["Auth controller<br/>[auth.controller.ts]"]
  node_auth_service["Auth service<br/>[auth.service.ts]"]
end

subgraph group_data["Persistence"]
  node_database[("PostgreSQL")]
end

node_passenger(("Passenger"))
node_driver(("Driver"))

node_passenger -->|"uses"| node_web_app
node_driver -->|"uses"| node_web_app
node_web_app -->|"renders"| node_passenger_ui
node_web_app -->|"renders"| node_driver_ui
node_web_app -->|"renders"| node_auth_ui
node_web_app -->|"uses session"| node_auth_provider
node_passenger_ui -->|"requests data"| node_api_client
node_driver_ui -->|"requests data"| node_api_client
node_auth_ui -->|"submits credentials"| node_api_client
node_auth_provider -->|"loads session"| node_api_client
node_api_client -->|"sends JSON"| node_api_app
node_api_app -->|"mounts"| node_api_routes
node_api_routes -->|"dispatches"| node_auth_routes
node_api_routes -->|"dispatches"| node_passenger_routes
node_api_routes -->|"dispatches"| node_geography_routes
node_api_routes -->|"dispatches"| node_pool_routes
node_api_routes -->|"dispatches"| node_driver_routes
node_auth_routes -->|"invokes"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_passenger_routes -->|"invokes"| node_passenger_controller
node_passenger_controller -->|"calls"| node_passenger_service
node_geography_routes -->|"invokes"| node_geography_controller
node_geography_controller -->|"calls"| node_geography_service
node_pool_routes -->|"invokes"| node_pool_controller
node_pool_controller -->|"calls"| node_pool_service
node_driver_routes -->|"invokes"| node_driver_controller
node_driver_controller -->|"calls"| node_driver_service
node_auth_service -->|"reads and writes"| node_database
node_passenger_service -->|"persists rides"| node_database
node_geography_service -->|"loads zones"| node_database
node_pool_service -->|"allocates pools"| node_database
node_driver_service -->|"reads and updates"| node_database

click node_web_app "https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/app"
click node_passenger_ui "https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/components/passenger"
click node_driver_ui "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/components/driver/driver-dashboard.tsx"
click node_auth_ui "https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/components/auth"
click node_auth_provider "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/providers/auth-provider.tsx"
click node_api_client "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/lib/api/client.ts"
click node_api_app "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/app.ts"
click node_api_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/routes/index.ts"
click node_auth_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.routes.ts"
click node_auth_controller "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.controller.ts"
click node_auth_service "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.service.ts"
click node_passenger_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.routes.ts"
click node_passenger_controller "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.controller.ts"
click node_passenger_service "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.service.ts"
click node_geography_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.routes.ts"
click node_geography_controller "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.controller.ts"
click node_geography_service "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.service.ts"
click node_pool_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.routes.ts"
click node_pool_controller "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.controller.ts"
click node_pool_service "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.service.ts"
click node_driver_routes "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.routes.ts"
click node_driver_controller "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.controller.ts"
click node_driver_service "https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.service.ts"

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_web_app,node_passenger_ui,node_driver_ui,node_auth_ui,node_auth_provider,node_api_client toneBlue
class node_api_app,node_api_routes toneAmber
class node_passenger_routes,node_passenger_controller,node_passenger_service,node_geography_routes,node_geography_controller,node_geography_service,node_pool_routes,node_pool_controller,node_pool_service,node_driver_routes,node_driver_controller,node_driver_service toneMint
class node_auth_routes,node_auth_controller,node_auth_service toneRose
class node_database,node_passenger,node_driver toneIndigo
```

## Components

### Web experience

- [Web app](https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/app): `apps/web/app`
- [Passenger UI](https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/components/passenger): `apps/web/components/passenger`
- [Driver UI](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/components/driver/driver-dashboard.tsx): `apps/web/components/driver/driver-dashboard.tsx`
- [Auth UI](https://github.com/redwan786/dhaka-tesla-pool-v2/tree/master/apps/web/components/auth): `apps/web/components/auth`
- [Session provider](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/providers/auth-provider.tsx): `apps/web/providers/auth-provider.tsx`
- [Typed API client](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/web/lib/api/client.ts): `apps/web/lib/api/client.ts`

### API access

- [Express API](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/app.ts): `apps/api/src/app.ts`
- [API routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/routes/index.ts): `apps/api/src/routes/index.ts`

### Ride operations

- [Passenger routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.routes.ts): `apps/api/src/modules/passenger/passenger.routes.ts`
- [Passenger controller](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.controller.ts): `apps/api/src/modules/passenger/passenger.controller.ts`
- [Passenger service](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/passenger/passenger.service.ts): `apps/api/src/modules/passenger/passenger.service.ts`
- [Geography routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.routes.ts): `apps/api/src/modules/geography/geography.routes.ts`
- [Geography controller](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.controller.ts): `apps/api/src/modules/geography/geography.controller.ts`
- [Geography service](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/geography/geography.service.ts): `apps/api/src/modules/geography/geography.service.ts`
- [Pool routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.routes.ts): `apps/api/src/modules/pool/pool.routes.ts`
- [Pool controller](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.controller.ts): `apps/api/src/modules/pool/pool.controller.ts`
- [Pool service](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/pool/pool.service.ts): `apps/api/src/modules/pool/pool.service.ts`
- [Driver routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.routes.ts): `apps/api/src/modules/driver/driver.routes.ts`
- [Driver controller](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.controller.ts): `apps/api/src/modules/driver/driver.controller.ts`
- [Driver service](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/driver/driver.service.ts): `apps/api/src/modules/driver/driver.service.ts`

### Identity

- [Auth routes](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.routes.ts): `apps/api/src/modules/auth/auth.routes.ts`
- [Auth controller](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.controller.ts): `apps/api/src/modules/auth/auth.controller.ts`
- [Auth service](https://github.com/redwan786/dhaka-tesla-pool-v2/blob/master/apps/api/src/modules/auth/auth.service.ts): `apps/api/src/modules/auth/auth.service.ts`

### Persistence

- **PostgreSQL**

### Other components

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

## Connections

- Passenger → Web app: uses
- Driver → Web app: uses
- Web app → Passenger UI: renders
- Web app → Driver UI: renders
- Web app → Auth UI: renders
- Web app → Session provider: uses session
- Passenger UI → Typed API client: requests data
- Driver UI → Typed API client: requests data
- Auth UI → Typed API client: submits credentials
- Session provider → Typed API client: loads session
- Typed API client → Express API: sends JSON
- Express API → API routes: mounts
- API routes → Auth routes: dispatches
- API routes → Passenger routes: dispatches
- API routes → Geography routes: dispatches
- API routes → Pool routes: dispatches
- API routes → Driver routes: dispatches
- Auth routes → Auth controller: invokes
- Auth controller → Auth service: calls
- Passenger routes → Passenger controller: invokes
- Passenger controller → Passenger service: calls
- Geography routes → Geography controller: invokes
- Geography controller → Geography service: calls
- Pool routes → Pool controller: invokes
- Pool controller → Pool service: calls
- Driver routes → Driver controller: invokes
- Driver controller → Driver service: calls
- Auth service → PostgreSQL: reads and writes
- Passenger service → PostgreSQL: persists rides
- Geography service → PostgreSQL: loads zones
- Pool service → PostgreSQL: allocates pools
- Driver service → PostgreSQL: reads and updates
