Skip to content
Public template

About

Template for standalone Cloudflare Workers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

worker-template

Template for standalone Cloudflare Workers.

Stack

  • Vite+ (vp) — dev server, build, test, lint, format, and type checking in one toolchain
  • cf — the Cloudflare CLI (1.0 release candidate), for dev, build, deploy and everything Cloudflare
  • @cloudflare/vite-plugin 2.0, with cloudflare.config.ts from cf/config
  • Vitest with @cloudflare/vitest-plugin, running tests inside workerd against the config in cloudflare.config.ts. No Wrangler
  • TypeScript, pnpm

Commands

pnpm dev      # dev server (with the Cloudflare local explorer at /cdn-cgi/local/explorer)
pnpm test     # test the Worker in workerd
pnpm check    # format, lint, and type check
pnpm fix      # same, but auto-fix
pnpm build    # production build
pnpm types    # regenerate Env and runtime types
pnpm deploy   # build and deploy via cf

Configuration

  • cloudflare.config.ts — the Worker itself: name, entrypoint, compatibility, bindings. Env types are inferred from the bindings you declare here and generated into .cloudflare/types/ by cf workers types (run on install, or with pnpm types).
  • vite.config.ts — Vite, oxlint, and oxfmt.
  • vitest.config.ts — tests, via cloudflareTest({ config: true }), which reads cloudflare.config.ts.

Template setup

This is a template repository. After creating a repo from it, follow the setup steps in AGENTS.md — or just ask Claude to do it.

About

Template for standalone Cloudflare Workers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages