A Convex component that serves a built web app (static files, and optionally server-rendered pages) from a Convex deployment. It started from Convex's static-hosting component and grew into a different design around Cloudflare's asset Worker.
packages/convex-hosting: the published component and CLI.src/component: code that runs inside the component on Convex.src/client:routeAll, which apps call from theirconvex/http.ts.src/cli: theconvex-hostingcommand:deploy, andupload, its inner step.src/workers-sdk: Cloudflare's asset worker, its test cases, and its integration fixtures, copied from cloudflare/workers-sdk at their upstream paths byscripts/sync-workers-sdk.ts. Never edit it by hand.pnpm run test:fixturesruns the fixtures against local deployments.
packages/convex-hosting-tanstack-start: the Vite plugin and server entry that render TanStack Start pages in a Convex HTTP action.packages/convex-auth-tanstack-start: Convex Auth cookie sessions for TanStack Start on any host, and itsconvexAuth()Vite plugin. Nothing in it is about hosting.examples/tanstack-spa: TanStack Start in SPA mode, served with the single-page-application fallback.examples/tanstack-ssr: TanStack Start pages rendered in a Convex HTTP action.examples/tanstack-ssr-workers: the same app as a Cloudflare Worker. Its diff fromexamples/tanstack-ssris committed asexamples/tanstack-ssr-workers.patch; after a commit that changes either example, runpnpm run examples:diffand commit the patch, or CI fails.examples/hello-world-assets-only: Cloudflare's static-site template (create-cloudflarehello-world-assets-only), oneindex.html, no build.examples/hello-world-assets-only-workersis the template as a Worker, withexamples/hello-world-assets-only-workers.patchkept like the SSR pair's.
Run from the repository root with pnpm 11 and the Node version in .node-version.
pnpm install: install dependencies. The component'spreparescript builds it.pnpm run build: build the packages and the examples.pnpm run check: format check, lint, typecheck, and tests. Build first: the examples typecheck against the built component.pnpm run format: format with oxfmt.pnpm exec vp test run <path>: run one test file.
- Vite+ owns formatting (oxfmt), linting (oxlint), and tests (import from
vite-plus/test). Do not add ESLint, Prettier, or a separate Vitest config. - Keep the
tscbuild for the component. Convex addresses component functions by file path, so the package ships one output file per source module. - Client APIs in
src/clientuse the*Generictypes such asGenericActionCtx. - Give every Convex function argument and return validators. Use
internalQuery,internalMutation, andinternalActionfor functions that apps must not call directly; an app can call only a component's public functions. - Shared dependency versions live in the
cataloginpnpm-workspace.yaml. - Releases: a version bump on
mainmakesrelease.ymlstage the package on npm; a maintainer approves it with 2FA. SeeCONTRIBUTING.md. - An app-side script, build step, type file, or wrapper in an example or a consuming app that exists because a package or the adapter lacks something is a package bug. Fix it in the package in the same cycle; do not keep the workaround in the app.
- Never use the U+2014 em dash character. Use commas, colons, parentheses, or separate sentences.