* perf(api): split monolithic edge function into per-domain functions
The catch-all api/[domain]/v1/[rpc].ts eagerly imported all 21 domain
handlers and their dependencies (~93 modules) on every cold start,
even though each request only targets one domain.
Split into 21 per-domain edge functions (api/seismology/v1/[rpc].ts,
api/market/v1/[rpc].ts, etc.) so Vercel bundles each domain separately.
Cold start now only loads the code for the requested domain (~1/21th).
- Extract shared gateway logic (CORS, rate limiting, API key validation,
POST→GET compat, error boundary, cache tiers) into server/gateway.ts
- Create 21 thin domain files that each import only their own handler
- Reduce catch-all to a lightweight 404 for unknown domains
Closes#179.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(gateway): remove duplicate process declaration and use canonical ServerOptions type
- Remove local `declare const process` — already in server/env.d.ts (PR #752)
- Import ServerOptions from generated service_server instead of redefining a subset
- Document centralised RPC_CACHE_TIER trade-off
- Annotate empty catch in POST→GET compat path
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Elie Habib <elie.habib@gmail.com>