AgentGem β€” Client / Server Split

One codebase β†’ two entrypoints β†’ a pure client (no DB) that points at a server it chooses: public, or a private enterprise deployment.

β‘  BUILD β€” one codebase, two entrypoints (esbuild tree-shakes by entry) β‘‘ RUNTIME β€” the client points at a server it chooses server only esbuild esbuild deploys as deploys as (Γ—N) src/appCommon.ts shared: console + Share/Review/ Benchmark proxies Β· originGuard Β· MCP src/client.ts desktop entry (NEW) src/index.ts server entry src/serverAggregator.ts mountAggregator: Aggregator + auth + og + orgs Β· sole importer of pg / PGlite core/index.mjs β€” desktop bundle NO aggregator Β· NO auth NO pg Β· NO PGlite βœ“ (500 gone) server image (Fly Dockerfile) index.ts + full aggregator requires DATABASE_URL default base enterprise base (AGENTGEM_AGGREGATOR_URL) AgentGem Desktop pure API client Β· no database β€’ Console UI (React) β€’ Benchmark tab β†’ /api/benchmark β†’ benchmarkClient Β· anon GET β€’ share / review / ingest clients AGENTGEM_AGGREGATOR_URL selects which server this client uses never receives a DATABASE_URL server mode β€” operator sets DATABASE_URL api.agentgem.ai public Β· Fly (iad) Β· index.ts image Neon Postgres public network data k-anon Β· quarantine producers accruing (opt-in) (needs producer ingest β€” separate) api.⟨enterprise⟩.internal private deployment Β· same image Enterprise Postgres their own DATABASE_URL tenant-isolated never touches the public net Legend client (no DB) server / aggregator database (operator-owned) server-mode deployment

Client β€” src/client.ts

  • Pure API client: console + Share/Review/Benchmark proxies; the Benchmark tab calls benchmarkClient (anon GET) to the chosen server.
  • The aggregator path is unreachable from this entry, so esbuild ships the desktop bundle with no aggregator, auth, pg, or PGlite β€” the 500 is gone by construction.
  • Points at a server via AGENTGEM_AGGREGATOR_URL; never gets a DATABASE_URL.

Server β€” index.ts + serverAggregator.ts

  • mountAggregator() mounts the full /api/aggregator surface, auth, OG, orgs on DATABASE_URL Postgres.
  • Sole importer of the heavy server deps β€” keeps them out of the client entry.
  • Same image runs on Fly (public) and on any private enterprise host.

Two deployments, one image

  • Public api.agentgem.ai β†’ Neon, the k-anon network view (fills as producers opt in and ingest).
  • Private enterprise β†’ their own DATABASE_URL; data stays in their tenant, never mixes with the public network.
  • Enterprise desktops just set AGENTGEM_AGGREGATOR_URL to their API.