lean_ctx/gateway_server/mod.rs
1//! Self-hosted org gateway — the **Gateway pillar** deployment mode.
2//!
3//! Bundles the LLM proxy (`crate::proxy`), the per-request usage store
4//! (Postgres `usage_events`), and the admin console into one deployable
5//! server process.
6//!
7//! # Cross-pillar coupling
8//!
9//! `serve.rs` calls `proxy::start_proxy` to start the LLM proxy and wires
10//! `proxy::usage_sink` for async Postgres persistence. The proxy in turn
11//! mounts `gateway_server::user_api` and `gateway_server::mcp::proxy` routes
12//! (feature-gated). This bidirectional dependency is intentional: the
13//! gateway is a single process, not two services.
14//!
15//! # Invariants
16//!
17//! - **Local-Free**: compiled in or out via `--features gateway-server`,
18//! never gated by account/license/plan (Local-Free Invariant).
19//! - **Fail-open**: a slow or down Postgres degrades metering, never live
20//! LLM traffic.
21
22pub mod admin_api;
23pub mod admin_status;
24pub mod admin_timeseries;
25pub mod admin_ui;
26pub mod doctor;
27pub mod evidence;
28pub mod init;
29pub mod keys_cli;
30pub mod mcp;
31pub mod report;
32pub mod security;
33pub mod serve;
34pub mod store;
35pub mod user_api;