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 (technical preview), for deploys and everything Cloudflare
  • @cloudflare/vite-plugin 2.0, with cloudflare.config.ts from cf/config
  • Vitest in Node, with integration tests running the built Worker in Miniflare. No Wrangler
  • TypeScript, pnpm

Commands

pnpm dev      # dev server (with the Cloudflare local explorer at /cdn-cgi/local/explorer)
pnpm test     # build, then test the Worker in Miniflare
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).
  • compatibility.ts — compatibility date and flags, shared with the test runtime.
  • vite.config.ts — everything else: Vite, Vitest, oxlint, and oxfmt in one file.

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