| name | platform-stack |
| description | Apply when choosing runtime/framework/deploy targets or scaffolding an app, API, route, webhook, or deployment — covers Bun with TypeScript, Cloudflare Workers, D1, Firebase Storage, Resend, and Stripe webhooks. Load whenever setting up endpoints, configuring runtime, or planning deployment. |
🚀 Platform & Stack
🧰 Runtime & language
- Bun preferred (Node compatible where needed), always TypeScript with strict settings.
- Use TS best practices: explicit return types on public methods,
unknown over any, discriminated unions for state, readonly where it holds.
- Prefer Bun-native APIs (
Bun.serve, bun:test, Bun.file) over npm shims when they exist.
🌐 Cloudflare Worker webhook endpoint
Keep handlers thin — they verify Stripe signatures, parse input, call services from /lib, and shape responses. No business logic in handlers.
Services are injected/wired at a Composite Root, then handed to handlers/routes — not constructed inside handlers. Add Hono only if the project explicitly installs/adopts it.
☁️ Deploy to Cloudflare
Default deploy target is Cloudflare (Workers + D1 free tier for this project). Keep code Workers-compatible:
- No Node-only APIs in the hot path that Workers can't run.
- Use Drizzle's SQLite/D1 adapters as appropriate per environment.
- Keep secrets in Cloudflare env bindings, not in code.
📦 Packages
Per CLAUDE.md: never hand-edit the manifest to add a dependency. Use bun install <pkg> (or npm install). Let the tool resolve and lock.
🔍 When unsure
Per CLAUDE.md: go online for answers, don't spelunk node_modules. And never claim it builds until you've actually run the build.