Expand description
Modules§
- frontend
- Serves the static web frontend.
- grounding
- AI grounding endpoint: extractive answers over ranked search results.
- metrics
- Prometheus metrics for the REST API.
- tavily
- Tavily-compatible
/searchendpoint. - tools
- Page extraction and engine-test endpoints.
Structs§
- AppError
- An API error with a JSON-friendly representation: bad request,
unauthorized, rate limited, body too large, or an internal
phronafailure. - AppState
- Shared server state: the search client, rate limiter, API key and
per-request bounds. Construct with
AppState::new. - Header
Auth - Header-only auth for GET endpoints. Query-string
api_keyparameters are rejected with a 400: credentials in URLs leak through logs, proxies and referrers and are a classic SSRF/credential-theft vector. - Json
Body - JSON body extractor whose rejection (missing body, malformed JSON,
wrong content type) is a JSON 400 instead of axum’s defaults. Bodies
larger than the configured
server.max_body_bytesare rejected with a 413 before deserialization. - Json
Query - Query-string extractor whose rejection is a JSON 400 instead of axum’s default plain-text response.
Functions§
- router
- Build the axum router from a
PhronaConfig: the search client (profile / timeout / proxies / concurrency), the API key, themax_resultsclamp, the rate limit and the body-size cap all come from the config. - serve
- Serve the REST API on
addr. Blocks until the server stops (Ctrl+C or SIGTERM trigger a graceful shutdown that drains in-flight requests). - shutdown_
signal - Wait for Ctrl+C or SIGTERM, then return so the server can drain in-flight requests gracefully.