API service
Location: backend/apps/api
Key behaviors:
- Global API prefix:
api/v1 - Health endpoint:
GET /healthz - Swagger UI:
GET /docs
Domain modules under backend/apps/api/src/modules:
- alerts
- assignment
- auth
- device
- org
- pond
- site
- telemetry-query
- users
flowchart TB
subgraph API Service
Controller[Controllers]
Service[Services]
Module[Feature modules]
end
Controller --> Service
Service --> Module
Module --> DB[(PostgreSQL)]
Module --> Contracts[Shared contracts]
Module --> Auth[Auth/JWT]
Ingestion worker
Location: backend/apps/ingestion-worker
Key behaviors:
- Health endpoint:
GET /healthz - MQTT ingestion pipeline under
src/workers/ingestion
The worker runs an HTTP server on WORKER_HEALTH_PORT for health checks while
processing MQTT telemetry in the background.
Request/response flow (API)
sequenceDiagram
autonumber
participant Client
participant API as API Service
participant Auth as Auth Guard
participant Controller
participant Service
participant DB as PostgreSQL
Client->>API: HTTP request
API->>Auth: Validate JWT (if protected)
Auth-->>API: Allow/deny
API->>Controller: Route handler
Controller->>Service: Call domain service
Service->>DB: Query/command
DB-->>Service: Result
Service-->>Controller: Response DTO
Controller-->>Client: HTTP response