Repository navigation
Backlog
Labels
enhancementNew feature or requestrisk:contractPublic contract: needs a changeset telling users what to changestate:needs-triageWaiting for the triager
Description
Motivation
Deploying the blog to an edge runtime (Kody/workerd) forced us to bypass the CMS entirely on the read path — hand-rolled SELECT … FROM cms_documents + a hand-written renderer — because importing anything from @tanstack/cms-core/server dragged in the whole engine (~1 MB) and wouldn't instantiate reliably. A read-only page (/, /post/:id) should be serveable with the CMS's own abstractions in a tiny bundle.
Why it's heavy today
@tanstack/cms-core/serveris a barrel — importinggetStorage/queryDocumentspulls dispatcher, auth, media, interfaces, scheduling, etc.- The embedded PGlite default is referenced via a literal
import('@tanstack/cms-store-postgres/pglite')instorage.ts, so the WASM runtime (witheval) lands in the graph even when a different store is configured. nodeImport/runtimeImportuse non-literalimport(specifier), which defeats edge bundlers' static analysis and is outright rejected by strict server sandboxes (workerd).store-postgresstatically pullsnode:fs/node:path(legacy-store + export paths) that a reader never exercises.- Module-scope zod/config construction adds instantiation cost.
Proposal
- A dedicated lightweight read entry (e.g.
@tanstack/cms-core/read) exposing published-document queries + the block/field renderers, with no engine side-effects, no embedded-store reference, nonode:*, no non-literalimport(), no WASM. - Make the embedded PGlite default fully opt-in (no static/literal reference unless configured).
- Replace the dynamic-import helpers with literal, tree-shakeable imports.
- Ship an "edge read" recipe in docs.
Acceptance
- A worker importing only the read entry + renderers bundles to < ~50 KB, with zero
node:*, WASM,eval, or non-literalimport()— verified by a bundle-audit test. - The render path produces the same HTML a hand-rolled renderer does for the standard block types.
Context
Came out of deploying a TanStack CMS blog to Kody: the read path is great on the edge, but only after dropping the engine. This issue is the "make reads first-class on the edge" half. The companion platform-side blocker (running the write/admin engine on Kody) is tracked separately.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestrisk:contractPublic contract: needs a changeset telling users what to changestate:needs-triageWaiting for the triager
Activity
jherr commentedon Dec 2, 2026
Companion platform-side blocker (running the write/admin engine on Kody): #64. This issue is the edge-reads half.
cms-triager commentedon Dec 2, 2026
I didn't triage this issue. GitHub shows the author
jherrwith association CONTRIBUTOR, and I couldn't confirm that a repository maintainer appliedstate:needs-triage. Under the station rules, a maintainer needs to authorise triage before I proceed. If you are a maintainer with private org membership, set your membership to public or have a collaborator re-applystate:needs-triage, and this will be picked up again.jherr commentedon Dec 2, 2026
Investigation: why the read path is 1.7 MB
Bundled just
queryReadableDocuments/getStoragefrom@tanstack/cms-core/server(esbuild, workerd conditions,node:*/react external):server.tsbarrel) is still 816 KB / 337 files — so it's module layering, not the barrel.eval), QuickJS@jitl/quickjs-wasmfile(~290 KB, the AI code-mode isolate),@tanstack/ai(~240 KB), MCP SDK+core (~240 KB), zod v3+v4 (~380 KB), sucrase (~90 KB, a TS compiler).eval×4, non-literalimport()×2,node:async_hooks|crypto|fs|path.First-party bridge edges (the cut points)
core/src/server/storage.ts→@tanstack/cms-store-postgres/pglite(embedded default store → WASM/eval). Literalimport(), so bundlers include it.core/src/ops.ts→core/src/lib/webmcp.ts→@modelcontextprotocol/sdk; and the AI/agent/code-mode chain →@tanstack/ai→ QuickJS + sucrase.access-context.ts(the read fn) →../config/./access, whose transitive value-graph reaches the above.config.tsis the hub nearly everything imports.Plan
ops.ts, nolib/webmcp, no AI/agent/code-mode, no embedded store.storage.ts(so WASM/evalnever enter a graph that didn't configure it).@tanstack/cms-core/readentry exporting the slim query + renderers./readbundles < ~50 KB with zeronode:*, WASM,eval, or non-literalimport().Branch:
feat/edge-read-entry. This is a careful module-layering change to central modules (config.ts/access-context.ts/storage.ts) — public-contract (new entry) + needs a changeset — so it lands incrementally with the bundle-audit test as the guardrail.