# ulric-r/cooptransport architecture

> Architecture diagram of the GitHub repository ulric-r/cooptransport, 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/ulric-r/cooptransport
- Repository: https://github.com/ulric-r/cooptransport

## Overview

CoopTransport is a cooperative transport-management system: passengers and staff use mobile or web clients to access trips, reserve seats, and manage operations; the backend exposes the API, with separate real-time tracking and queue channels. The README also identifies simulated payments, notifications, cooperative fleet management, and ranking as product capabilities. The sampled backend entry point confirms router and WebSocket registration, while the sampled clients show API access; implementation details for most services and workers were not sampled, so uncertain internal links are omitted.

Main entry points: [`backend/main.py`](https://github.com/ulric-r/cooptransport/blob/main/backend/main.py) (API application), [`frontend/App.tsx`](https://github.com/ulric-r/cooptransport/blob/main/frontend/App.tsx) (Mobile app), [`frontend_web/src/App.tsx`](https://github.com/ulric-r/cooptransport/blob/main/frontend_web/src/App.tsx) (Web app), [`frontend/src/store/api/baseQuery.ts`](https://github.com/ulric-r/cooptransport/blob/main/frontend/src/store/api/baseQuery.ts) (Mobile API access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_mobile["Mobile app<br/>[App.tsx]"]
  node_web["Web app<br/>[App.tsx]"]
  node_mobile_api["Mobile API access<br/>[baseQuery.ts]"]
  node_web_api["Web API client<br/>[client.ts]"]
end

subgraph group_api["REST API"]
  node_backend["API application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_coops["Coops and fleet<br/>[cooperatives.py]"]
  node_trips["Trips<br/>[trips.py]"]
  node_reservations["Reservations<br/>[reservations.py]"]
  node_queue["Waiting queue<br/>[waiting_queue.py]"]
  node_payments["Transactions<br/>[transactions.py]"]
  node_tracking["GPS tracking<br/>[tracking.py]"]
  node_alerts["Alerts and complaints<br/>[alerts.py]"]
  node_ranking["Ranking<br/>[ranking.py]"]
  node_database[("PostgreSQL store<br/>[database.py]")]
end

subgraph group_realtime["Realtime and jobs"]
  node_tracking_ws["Tracking WebSocket<br/>[tracking_ws.py]"]
  node_queue_ws["Queue WebSocket<br/>[queue_ws.py]"]
  node_workers["Background workers"]
  node_sms["SMS service<br/>[sms_service.py]"]
end

subgraph group_intelligence["Scoring and analysis"]
  node_ranking_service["Ranking service<br/>[ranking_service.py]"]
  node_ml_api["ML endpoints<br/>[ml.py]"]
  node_processing["ML and NLP"]
end

node_passengers(("Passengers and staff"))

node_passengers -->|"use"| node_mobile
node_passengers -->|"use"| node_web
node_mobile -->|"request via"| node_mobile_api
node_web -->|"request via"| node_web_api
node_mobile_api -->|"call API"| node_backend
node_web_api -->|"call API"| node_backend
node_backend -->|"mounts"| node_auth
node_backend -->|"mounts"| node_coops
node_backend -->|"mounts"| node_trips
node_backend -->|"mounts"| node_reservations
node_backend -->|"mounts"| node_queue
node_backend -->|"mounts"| node_payments
node_backend -->|"mounts"| node_tracking
node_backend -->|"mounts"| node_alerts
node_backend -->|"mounts"| node_ranking
node_backend -->|"mounts"| node_ml_api
node_backend -->|"registers"| node_tracking_ws
node_backend -->|"registers"| node_queue_ws

click node_mobile "https://github.com/ulric-r/cooptransport/blob/main/frontend/App.tsx"
click node_web "https://github.com/ulric-r/cooptransport/blob/main/frontend_web/src/App.tsx"
click node_mobile_api "https://github.com/ulric-r/cooptransport/blob/main/frontend/src/store/api/baseQuery.ts"
click node_web_api "https://github.com/ulric-r/cooptransport/blob/main/frontend_web/src/api/client.ts"
click node_backend "https://github.com/ulric-r/cooptransport/blob/main/backend/main.py"
click node_auth "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/auth.py"
click node_coops "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/cooperatives.py"
click node_trips "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/trips.py"
click node_reservations "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/reservations.py"
click node_queue "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/waiting_queue.py"
click node_payments "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/transactions.py"
click node_tracking "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/tracking.py"
click node_alerts "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/alerts.py"
click node_ranking "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/ranking.py"
click node_database "https://github.com/ulric-r/cooptransport/blob/main/backend/app/core/database.py"
click node_tracking_ws "https://github.com/ulric-r/cooptransport/blob/main/backend/app/websockets/tracking_ws.py"
click node_queue_ws "https://github.com/ulric-r/cooptransport/blob/main/backend/app/websockets/queue_ws.py"
click node_workers "https://github.com/ulric-r/cooptransport/tree/main/backend/app/workers"
click node_ranking_service "https://github.com/ulric-r/cooptransport/blob/main/backend/app/services/ranking_service.py"
click node_ml_api "https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/ml.py"
click node_processing "https://github.com/ulric-r/cooptransport/tree/main/processing/ml"
click node_sms "https://github.com/ulric-r/cooptransport/blob/main/backend/app/services/sms_service.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_mobile,node_web,node_mobile_api,node_web_api toneBlue
class node_backend,node_auth,node_coops,node_trips,node_reservations,node_queue,node_payments,node_tracking,node_alerts,node_ranking,node_database toneAmber
class node_tracking_ws,node_queue_ws,node_workers,node_sms toneMint
class node_ranking_service,node_ml_api,node_processing toneRose
class node_passengers toneIndigo
```

## Components

### User clients

- [Mobile app](https://github.com/ulric-r/cooptransport/blob/main/frontend/App.tsx): `frontend/App.tsx`
- [Web app](https://github.com/ulric-r/cooptransport/blob/main/frontend_web/src/App.tsx): `frontend_web/src/App.tsx`
- [Mobile API access](https://github.com/ulric-r/cooptransport/blob/main/frontend/src/store/api/baseQuery.ts): `frontend/src/store/api/baseQuery.ts`
- [Web API client](https://github.com/ulric-r/cooptransport/blob/main/frontend_web/src/api/client.ts): `frontend_web/src/api/client.ts`

### REST API

- [API application](https://github.com/ulric-r/cooptransport/blob/main/backend/main.py): `backend/main.py`
- [Authentication](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Coops and fleet](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/cooperatives.py): `backend/app/routers/cooperatives.py`
- [Trips](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/trips.py): `backend/app/routers/trips.py`
- [Reservations](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/reservations.py): `backend/app/routers/reservations.py`
- [Waiting queue](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/waiting_queue.py): `backend/app/routers/waiting_queue.py`
- [Transactions](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/transactions.py): `backend/app/routers/transactions.py`
- [GPS tracking](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/tracking.py): `backend/app/routers/tracking.py`
- [Alerts and complaints](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/alerts.py): `backend/app/routers/alerts.py`
- [Ranking](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/ranking.py): `backend/app/routers/ranking.py`
- [PostgreSQL store](https://github.com/ulric-r/cooptransport/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### Realtime and jobs

- [Tracking WebSocket](https://github.com/ulric-r/cooptransport/blob/main/backend/app/websockets/tracking_ws.py): `backend/app/websockets/tracking_ws.py`
- [Queue WebSocket](https://github.com/ulric-r/cooptransport/blob/main/backend/app/websockets/queue_ws.py): `backend/app/websockets/queue_ws.py`
- [Background workers](https://github.com/ulric-r/cooptransport/tree/main/backend/app/workers): `backend/app/workers`
- [SMS service](https://github.com/ulric-r/cooptransport/blob/main/backend/app/services/sms_service.py): `backend/app/services/sms_service.py`

### Scoring and analysis

- [Ranking service](https://github.com/ulric-r/cooptransport/blob/main/backend/app/services/ranking_service.py): `backend/app/services/ranking_service.py`
- [ML endpoints](https://github.com/ulric-r/cooptransport/blob/main/backend/app/routers/ml.py): `backend/app/routers/ml.py`
- [ML and NLP](https://github.com/ulric-r/cooptransport/tree/main/processing/ml): `processing/ml`

### Other components

- **Passengers and staff**

## Connections

- Passengers and staff → Mobile app: use
- Passengers and staff → Web app: use
- Mobile app → Mobile API access: request via
- Web app → Web API client: request via
- Mobile API access → API application: call API
- Web API client → API application: call API
- API application → Authentication: mounts
- API application → Coops and fleet: mounts
- API application → Trips: mounts
- API application → Reservations: mounts
- API application → Waiting queue: mounts
- API application → Transactions: mounts
- API application → GPS tracking: mounts
- API application → Alerts and complaints: mounts
- API application → Ranking: mounts
- API application → ML endpoints: mounts
- API application → Tracking WebSocket: registers
- API application → Queue WebSocket: registers
