Module api

Module api 

Source
Expand description

HTTP API server for operational visibility.

Provides endpoints for monitoring stargazer’s internal state, querying captured data, and manual Tier 3 session management. This is NOT the primary data consumer — the Rdio API server handles transcription downstream. The routes here exist so operators (and kubernetes health probes) can answer “is capture working?” and “what did we miss?” at a glance.

§Endpoints

RouteMethodPurpose
/healthGETKubernetes liveness/readiness probe
/metricsGETTier statistics: reflectors, streams, upload queue
/api/reflectorsGETList reflectors with status and activity scores
/api/reflectors/{callsign}/activityGETRecent activity for one reflector
/api/reflectors/{callsign}/nodesGETNodes currently linked to a reflector
/api/activityGETRecent activity across all reflectors
/api/streamsGETQuery captured streams with filters
/api/upload-queueGETPending upload status
/api/tier3/connectPOSTManually promote a reflector to Tier 3 (501 stub)
/api/tier3/{callsign}/{module}DELETEDisconnect a Tier 3 session (501 stub)

§Error handling

Database errors are logged at warn level and surfaced to the caller as 500 Internal Server Error with no body. The raw sqlx::Error is never leaked — it can contain connection strings, schema details, or constraint names that would be useful to an attacker.

§Operational ownership

The server is spawned by stargazer::run as a top-level tokio task. On shutdown it is aborted; no graceful drain is attempted because all endpoints are idempotent reads.

Modules§

routes 🔒
HTTP handler functions for the stargazer operational API.

Functions§

build_router 🔒
Builds the axum Router with all routes and shared state.
serve 🔒
Starts the HTTP API server and listens for requests.