Replaces routine use of `scripts/seed-router-config.ts` and `scripts/seed-streaming-tts.ts` with `POST /api/admin/config/router`. Operators can now patch one provider at a time without shelling into the Railway runner; the seed scripts stay as break-glass tools for cold-boot and disaster recovery. The endpoint accepts a discriminated-union slice list (openrouter / azure / dashscope-cosyvoice / streaming-tts), envelope-encrypts plaintext keys in-process (never echoed back), and supports merge/reset modes plus dryRun. Writes go through the existing configKV + Redis `configkv:invalidate` channel so multi-instance deployments pick up changes within the pub/sub propagation window. Guarded by the existing `authGuard + adminGuard` pair (`ADMIN_EMAILS` allowlist + verified email).
@proj-airi/server
HTTP and WebSocket backend for AIRI. This app owns auth, billing, chat synchronization, gateway forwarding, and server-side observability export.
What It Does
- Serves the Hono-based API and WebSocket endpoints.
- Uses Postgres as the source of truth for users, billing, and durable state.
- Uses Redis for cache, KV, Pub/Sub, and Streams.
- Forwards GenAI requests to the configured upstream gateway and records billing from usage.
- Exports traces, metrics, and logs through OpenTelemetry.
How To Use It
Install dependencies from the repo root and run scoped commands:
pnpm -F @proj-airi/server typecheck
pnpm -F @proj-airi/server exec vitest run
pnpm -F @proj-airi/server build
For local observability infrastructure, use:
docker compose -f apps/server/docker-compose.otel.yml up -d
ADDITIONAL_TRUSTED_ORIGINS (LAN / Capacitor dev)
When the mobile dev server uses a non-localhost origin (for example https://10.x.x.x:5273 from cap copy ios / capacitor.config.json), set ADDITIONAL_TRUSTED_ORIGINS in apps/server/.env.local to a comma-separated list of exact origins (parsed and normalized at startup). Example:
ADDITIONAL_TRUSTED_ORIGINS=https://10.0.0.129:5273,https://198.18.0.1:5273
Restart the API server after changing this variable.