# AGENTS — TanStack CMS blog on Kody ## Runtime contract - `kody.app.entry` = `./src/entry.ts`, default-exported `{ fetch }`, receives the mount-stripped Request. Kody bundles source with esbuild; no Vite/Nitro. - No TCP / no `node:*` / no filesystem in the isolate. Postgres is reached with `@neondatabase/serverless` (`Pool` over WebSocket) — set `neonConfig.webSocketConstructor = WebSocket` at module scope. - Secrets: `packageSecrets.get('DATABASE_URL')` (real value on hosted runs; placeholder under `kody dev`). Build the pool lazily on first request. ## Store wiring (stage 2+) - Pass a `pool` (Neon) to `createPostgresStorage({ pool })` — NOT a `connectionString`, which makes store-postgres build stock `pg` (won't load on workerd). Neon's `Pool` satisfies store-postgres `PgPoolLike` structurally (`connect()` → client with `query`/`release`, plus `on`/`end`). - `@tanstack/*` deps are pinned to pkg.pr.new commit URLs (not on npm yet). ## React SSR - Import `renderToReadableStream` from `react-dom/server.edge` (bare `react-dom/server` resolves to the Node build and crashes on load). - Two graphs: server entry may import `kody:runtime`; the browser client bundle must not. Hydrate `#root` with the same data the server embedded. ## Images - No native/WASM. Use Jimp (pure JS) behind the CMS `media.imageTransformer` seam; lean on the transform cache and cap input dimensions. ## Smoke - Stage 1: `appFetch` `GET /` → `{ ok: true, version: "PostgreSQL …" }`. `GET /healthz` → `{ ok: true }`.