A TypeScript starter template for building Cloudflare Workers using Hono framework with Drizzle ORM and Zod validation.
- 🔥 Hono - Fast, Lightweight, Web-standards web framework
- 🔧 Drizzle ORM - TypeScript ORM for SQL databases
- ✨ Zod - TypeScript-first schema validation
- 👷 Cloudflare Workers - Serverless platform
- ⚡ Vitest for testing
- 📘 TypeScript support
- 🎨 ESLint + Prettier for code formatting
@antfu/eslint-config
- 🔄 Husky + lint-staged for git hooks
├── .github/ # GitHub-specific configurations
│ └── workflows/ # Automation workflows for testing, deployment, etc.
├── .husky/ # Git hooks (e.g., pre-commit)
├── .vscode/ # VS Code workspace-specific settings
├── src/
│ ├── config/ # Configuration files
│ ├── db/ # Database related code
│ │ └── schema/ # Drizzle schema definitions
│ ├── middlewares/ # Hono middlewares
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ └── index.ts # Entry point
├── tests/ # Test files
├── .env.example # Environment variables
|── .dev.vars.example # Environment variables example
├── .lintstagedrc # Configuration for lint-staged (pre-commit).
├── drizzle.config.ts # Drizzle configuration
|── eslint.config.mjs # eslint configuration
├── package.json # Project metadata and dependencies.
├── tsconfig.json # TypeScript configuration
└── wrangler.toml # Cloudflare Workers configuration
-
Clone the repository:
git clone https://github.com/yourusername/cloudflare-hono-drizzle-zod-starter-pack
-
Install dependencies:
bun install
-
Setting up environment files
-
Copy the example files to create your environment files:
cp .env.example .env.example cp .dev.vars.example .dev.vars
-
Update the values in both files:
-
.env
requires:DB_URL=your_database_connection_url
-
.dev.vars
requires:SECRET_KEY=your_secret_key DB_URL=your_database_connection_url
-
-
Run development server:
bun run dev
-
Deploy to Cloudflare Workers:
bunx wrangler login bun run deploy
bun run dev
- Start development serverbun run deploy
- Deploy to Cloudflare Workersbun run lint
- Run ESLintbun run lint:fix
- Fix ESLint errorsbun run db:generate
- Generate Drizzle migrationsbun run db:migrate
- Run database migrations
Required environment variables in .env
:
DB_URL=your_database_url
MIT License © 2025-PRESENT Musanna AL Akil