Apollon GPS Tracking System
Apollon is a real-time GPS tracking system for logistics and cargo, built on Peplink router hardware. It provides REST, GraphQL and WebSocket APIs for live position tracking, trip management and client administration.
Architecture
┌──────────────┐
│ Peplink │
│ Router │
└──────┬───────┘
│
┌─────────────┐ ┌──────┴───────┐ ┌────────────────┐
│ Next.js │────▶│ Rust API │────▶│ PostgreSQL │
│ Frontend │ │ (Actix-web) │ │ (Relational) │
└──────┬──────┘ └──────────────┘ └────────────────┘
│ ┌────────────────┐
│ WebSocket (direct) │ TimescaleDB │
└─────────────────────────────────▶│ (GPS Series) │
└────────────────┘
Data Flow:
Browser → fetch() → Next.js API Routes → gql() → Rust API /v1/gqlBrowser → WebSocket → Rust API /v1/ws(direct, no proxy)
Core Components
| Component | Technology | Purpose |
|---|---|---|
| API | Rust (Actix-web, sqlx, async-graphql) | REST + GraphQL + WebSocket server |
| Web | Next.js 16, React 19, shadcn/ui, Tailwind CSS 4 | Frontend with live map and trip management |
| Shared API | @elcto/api (TypeScript) | GraphQL client, WebSocket client, types |
| Shared UI | @elcto/ui (React) | Map, Spinner, ThemeToggle components |
| Database | PostgreSQL 18 | Clients, trips, categories, contacts |
| Time-Series | TimescaleDB | GPS locations with hypertable compression |
| GPS Source | Peplink Router API | Hardware GPS with automatic token auth |
Monorepo Structure
shared/
api/ @elcto/api — GraphQL client, WebSocket, types
ui/ @elcto/ui — Map, Spinner, ThemeToggle
platform/
api/ Rust API (10 crates)
web/ Next.js 16 frontend
docs/ Documentation (Docusaurus)
Crate Structure
The Rust API is organized as a Cargo workspace with 10 crates:
| Crate | Purpose |
|---|---|
apollon-common | Shared types, error handling, API response format |
apollon-config | TOML + env var configuration loading |
apollon-db | Database models and sqlx queries |
apollon-rest | REST handlers, middleware (auth, rate limit, security) |
apollon-graphql | GraphQL schema, queries, mutations |
apollon-websocket | WebSocket server for live speed broadcasting |
apollon-peplink | Peplink router client with token management |
apollon-forwarding | GPS data forwarding to external services |
apollon-telemetry | Tracing and Sentry integration |
api | Main binary, server startup, background loops |
API Protocols
- REST — 23 endpoints under
/v1with OpenAPI documentation - GraphQL — Full schema at
/v1/gqlwith GraphiQL IDE - WebSocket — Live speed broadcasting at
/v1/ws