Skip to main content
A complete coding convention template for production Cloudflare Workers applications with Hono framework, Drizzle ORM, and Turso edge database.

Download Template

Download as ZIP and extract to .trellis/spec/

What’s Included

CategoryFilesCoverage
Backend11 filesHono, Drizzle/Turso, API patterns, security, storage
Frontend7 files + examplesComponents, hooks, auth, design templates
Shared5 filesTypeScript, code quality, dependencies, timestamps
Guides3 filesOAuth consent flow, serverless connections
Pitfalls6 filesWorkers compat, cross-layer, env config, CSS

Template Structure

spec/
├── backend/
│   ├── index.md
│   ├── hono-framework.md
│   ├── database.md
│   ├── api-module.md
│   ├── api-patterns.md
│   ├── security.md
│   ├── storage.md
│   └── ...

├── frontend/
│   ├── index.md
│   ├── authentication.md
│   ├── components.md
│   ├── hooks.md
│   ├── directory-structure.md
│   ├── examples/frontend-design/
│   └── ...

├── guides/
│   ├── oauth-consent-flow.md
│   ├── serverless-connection-guide.md
│   └── ...

├── shared/
│   ├── typescript.md
│   ├── code-quality.md
│   ├── dependency-versions.md
│   └── ...

├── big-question/
│   ├── workers-nodejs-compat.md
│   ├── cross-layer-contract.md
│   ├── env-configuration.md
│   └── ...

└── README.md

Key Topics

Backend

  • Hono framework patterns (type-safe bindings, middleware, WebSocket)
  • Drizzle ORM + Turso/libSQL (batch ops, N+1 prevention, Workers pitfalls)
  • Cloudflare storage (R2, KV, Cache API for session caching)
  • Security (token generation, timing-safe comparison, OAuth redirect validation)
  • Structured JSON logging with request context

Frontend

  • React 19 + React Router v7 with Vite
  • Better Auth UI v3.x integration (SSR-safe, Cloudflare Workers considerations)
  • shadcn/ui components + Tailwind CSS v4
  • Design example templates (minimalist hero, maximalist dashboard, animations)

Guides

  • OAuth 2.1 consent flow with resource selection
  • Serverless connection debugging (stale connections, subrequest limits)

Common Pitfalls

  • Workers Node.js compatibility (nodejs_compat flag)
  • Cross-layer contract violations (data flows but never reaches client)
  • Build-time vs runtime environment variables
  • CSS debugging in Tailwind v4

Usage

  1. Download the ZIP file
  2. Extract to your project’s .trellis/spec/ directory
  3. Replace generic env var names with your actual bindings
  4. Customize for your specific conventions
  5. Remove sections that don’t apply

View on GitHub

Browse the template source code