Přehled architektury dispečerského systému CITYA pro taxi služby a dopravu na zavolání.
CITYA je komplexní platforma pro správu taxi služeb, která zahrnuje:
| Komponenta | Technologie | Verze |
|---|---|---|
| Runtime | .NET | 8.0 |
| Framework | ASP.NET Core | 8.0 |
| ORM | Entity Framework Core | 8.0 |
| Real-time | SignalR | 8.0 |
| Autentizace | JWT Bearer | - |
| Hashování hesel | BCrypt | prefix |
| Komponenta | Technologie | Verze |
|---|---|---|
| Framework | Vue.js | 3.x |
| UI Framework | Quasar | 2.x |
| Jazyk | TypeScript | 5.x |
| Build tool | Vite | 6.x |
| State management | Pinia | 2.x |
| HTTP klient | Axios | - |
| Komponenta | Technologie |
|---|---|
| Framework | Flutter |
| Jazyk | Dart |
| Platformy | iOS, Android |
| Komponenta | Technologie | Verze |
|---|---|---|
| Databáze | PostgreSQL | 13 |
| GIS rozšíření | PostGIS | 3.x |
| Cache | Redis | 7.x |
| Reverse Proxy | Traefik | 3.x |
| Kontejnerizace | Docker | 24+ |
| Orchestrace | Docker Compose | 2.x |
| Tabulka | Popis |
|---|---|
User |
Uživatelé systému (dispečeři, admini) |
GeoArea |
Geografické oblasti provozu |
GeoAreaUser |
Vazba uživatelů na oblasti |
Ride |
Jednotlivé jízdy |
RideBooking |
Rezervace jízd |
Driver |
Řidiči |
Vehicle |
Vozidla |
Shift |
Směny řidičů |
Company |
Dopravní společnosti |
CITYA využívá PostGIS pro práci s geografickými daty:
-- Příklad: Najít jízdy v oblasti
SELECT r.*
FROM "Ride" r
JOIN "GeoArea" a ON ST_Contains(a."Boundary", r."DepartureCoords")
WHERE a."Code" = PRAGUE;
/api/v2/
├── auth/
│ ├── login POST - Přihlášení
│ └── refresh POST - Obnovení tokenu
├── areas/
│ ├── GET - Seznam oblastí
│ └── {id}/ - Detail oblasti
├── areas-secrets/
│ └── GET - API klíče pro oblast
├── rides/
│ ├── GET - Seznam jízd
│ ├── POST - Vytvoření jízdy
│ └── {id}/
│ ├── GET - Detail jízdy
│ ├── PUT - Aktualizace
│ └── cancel POST - Zrušení
├── drivers/
│ ├── GET - Seznam řidičů
│ └── {id}/status PUT - Změna stavu
├── shifts/
│ ├── GET - Seznam směn
│ └── POST - Vytvoření směny
└── reports/
└── GET - Reporty a statistiky
Pro správné fungování frontendu je nutná CORS konfigurace:
# Traefik middleware
headers:
accesscontrolallowmethods: GET,POST,PUT,DELETE,PATCH,OPTIONS
accesscontrolallowheaders: Content-Type,Authorization,X-Requested-With,Area,area,App,app
accesscontrolalloworiginlist: https://dispatcher.citya.io
accesscontrolallowcredentials: true
CITYA používá SignalR pro real-time aktualizace:
| Hub | Událost | Popis |
|---|---|---|
| RidesHub | RideCreated |
Nová jízda vytvořena |
| RidesHub | RideUpdated |
Stav jízdy změněn |
| RidesHub | RideCanceled |
Jízda zrušena |
| DriversHub | DriverLocationUpdated |
Pozice řidiče |
| DriversHub | DriverStatusChanged |
Stav řidiče (online/offline) |
Použití:
Konfigurace:
DISPATCHER_GOOGLE_MAPS_API_KEY=AIza...
PAS_GOOGLE_MAPS_API_KEY=AIza...
Alternativní geocoding provider pro ČR:
Buckety:
| Bucket | Účel |
|---|---|
{tenant}-cdn |
CDN pro statické soubory |
citya-revgeo-storage |
Cache reverse geocoding |
{tenant}-area-features |
GeoJSON features oblastí |
Podporovaní poskytovatelé:
| Prostředí | URL | Účel |
|---|---|---|
| Development | localhost | Lokální vývoj |
| Stage | *.stage.citya.io | Testování |
| Production | *.citya.io | Produkce |
┌─────────────────────────────────────────────────────┐
│ Traefik │
│ (Reverse Proxy + SSL) │
├─────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Dispatcher │ │ Backend │ │
│ │ (nginx) │ │ (.NET) │ │
│ │ :80 │ │ :8080 │ │
│ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ │
│ │ PostgreSQL │ │ Redis │ │
│ │ + PostGIS │ │ │ │
│ │ :5432 │ │ :6379 │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────┘
Každá služba implementuje health check endpoint:
| Služba | Endpoint | Metoda |
|---|---|---|
| Backend | /health |
curl |
| Dispatcher | / |
wget |
| PostgreSQL | pg_isready |
CLI |
| Redis | redis-cli ping |
CLI |
# Produkce - GCP Secret Manager
gcloud secrets versions access latest --secret=citya-production-main-secrets
# Lokální vývoj - .env soubory
.env.backend # API klíče a connection strings
Doporučené metriky pro monitoring:
| Metrika | Popis |
|---|---|
rides_total |
Celkový počet jízd |
rides_active |
Aktivní jízdy |
drivers_online |
Online řidiči |
api_request_duration |
Latence API |
websocket_connections |
Aktivní WS spojení |
| Komponenta | Škálování |
|---|---|
| Backend | 2-4 instance |
| Redis | Single instance + replika |
| PostgreSQL | Primary + Read replica |
| Dispatcher | CDN + single instance |