For the complete documentation index, see llms.txt. Prefer markdown by appending.mdto documentation URLs or sendingAccept: text/markdown.
Conventions
Follow Edge Kit's conventions for module layout, typed imports, server boundaries, localized copy, and the lint checks that enforce them.
You're not required to follow these conventions; they're simply a standard set of practices used in Edge Kit. If you like them, we encourage you to keep them during your usage of the kit so you have a consistent code style that you and your teammates understand.
Single package
Edge Kit is one package, so there's no decision about where shared code goes. Keep infrastructure adapters in src/lib, product features in src/modules, and let src/routes only compose them. See Project structure.
Imports and paths
- From the app: use the
@/alias, which maps tosrc/(e.g.@/lib/log,@/modules/billing/...). There is no other alias. - Env config:
env.config.tslives outsidesrc/, so import it by relative path with the.tsextension. - Cloudflare bindings: import
envfromcloudflare:workers. - i18n: keep the
.jsextension in imports from@/lib/i18n.
import env from "../../env.config.ts"; // typed secrets (envin + Zod)
import { env as bindings } from "cloudflare:workers"; // env.DB, env.KV, ...
import { m } from "@/lib/i18n/messages.js";Client and server code
- UI talks to the server through
createServerFnhandlers, usually in*.functions.ts. - Files named
*.server.tsread D1, secrets, and bindings. Never import them from client components. - TanStack Query options live in
*.queries.ts. - Link targets come from
src/config/paths.ts, not inline string literals.
Use paths configuration for shared route constants and server functions for the client/server boundary.
TypeScript
- Functional and declarative. No classes, no enums (use
as constmaps), noany. - Prefer
interfacefor object shapes andtypefor unions and derived types. - Validate with Zod 4.
- Use guard clauses and early returns over nested conditionals.
Internationalization
All user-facing copy goes through Paraglide. The lint rules require translated strings in JSX.
- Short reusable labels are unprefixed:
save,email,home. - View-specific copy uses a dotted prefix:
auth.login.title. - Every segment is camelCase.
- Keep
messages/en.jsonandmessages/es.jsonin sync.
UI
- Kumo components are imported by subpath (
@cloudflare/kumo/components/button), never from the package root, to keep the bundle small. - Icons come from
@phosphor-icons/react. - Shared app-level UI lives in
src/modules/common. - Use Tailwind CSS utilities, no inline styles.
Tooling
We don't enforce complex rules that aren't relevant to the project, giving you more freedom to customize things. To enforce these conventions, we use:
- Oxfmt is a Prettier-compatible tool used to enforce code formatting, import sorting, and Tailwind class order.
- Oxlint is an ESLint-compatible tool used to enforce code quality. It runs type-aware, so it doubles as your type check.
- TypeScript is used to enforce type safety.
Code health
GitHub Actions
By default, Edge Kit sets up GitHub Actions in .github/workflows:
tests- runsformat,lint, andteston every pull request.e2e- runs Playwright against Chrome, Firefox, and Safari (WebKit). On pull requests it only runs when the PR has thee2elabel.publish-web- runs the tests, then deploys the Worker withpnpm run deploy(manual trigger).
Git hooks
A pre-commit hook checks staged files for formatting and linting errors. It's configured using Lefthook:
pre-commit:
parallel: true
commands:
format:
run: pnpm format:fix {staged_files}
lint:
run: pnpm lint:fix {staged_files}Feel free to customize it, e.g. to validate commit messages with commitlint:
commit-msg:
commands:
"lint commit message":
run: pnpm commitlint --edit {1}How is this guide?
Last updated on
AI-assisted development
Use Cursor, Claude Code, ChatGPT Codex, or Antigravity with Edge Kit. Rules, skills, and workflows for TanStack Start on Cloudflare Workers.
Common commands
Common pnpm, Wrangler, and D1 commands for daily Edge Kit work. Dev server, builds, linting, migrations, tests, and deploys.