초기 관제 시스템 뼈대 구성

This commit is contained in:
2026-06-06 14:58:54 +09:00
parent d982777718
commit cab7394b1f
29 changed files with 3221 additions and 1 deletions

29
docs/ARCHITECTURE.md Normal file
View File

@@ -0,0 +1,29 @@
# Architecture
```mermaid
flowchart LR
phone["Android driver app"] -->|POST /api/v1/locations| api["CargoRadar API"]
api --> latest["latest-locations.json"]
api --> history["locations.jsonl"]
web["Control web"] -->|GET latest/history| api
api -->|SSE /api/v1/events| web
```
## MVP Data Flow
1. The Android app starts a foreground location service.
2. The service uploads location JSON with `X-Device-Token`.
3. The server validates the token against `drivers.json`.
4. The server stores the newest location per driver and appends history.
5. The control web reads the latest positions and listens for SSE updates.
## Storage
The MVP uses simple files:
- `drivers.json`: driver registry and device tokens.
- `latest-locations.json`: current position by driver.
- `locations.jsonl`: append-only location history.
This keeps the first version easy to deploy on Synology NAS. PostgreSQL with
PostGIS is the planned upgrade path once route/history queries become central.