Introduction
Verge Kit is a foundation for building full-stack applications with Astro and Cloudflare Workers.
It starts with the pieces most full-stack apps need: server-rendered Astro, D1, Drizzle, Better Auth, email, middleware, Zod validation, Astro Actions, and a plain Tailwind UI base. The project stays close to Astro, Cloudflare, Drizzle, Better Auth, and Tailwind instead of adding a large custom framework layer.
Included
- Astro server app with strict TypeScript
- Cloudflare Workers adapter
- Cloudflare D1 as the supported runtime database
- Drizzle schema and migrations
- Better Auth with email/password, email verification, reset password, and D1 storage
- Better Auth admin plugin
roles for
admin,moderator,user, andbanned - Register, login, logout, email verification, forgot password, and reset password flows
- Middleware that loads auth state into typed
Astro.locals - Public-by-default route auth with opt-in protected pages and APIs
- Custom 404 and 500 error pages
- API response helpers
- Zod request parsing
- Astro Actions example
- CSRF origin checks through Astro config
- Email providers for console, Cloudflare Email, Resend, Mailgun, and explicit Node SMTP usage
- Auth email templates with
@backstro/email - Tailwind CSS v4 and local Astro UI components
- Lucide Astro icons
- Vitest, happy-dom, oxlint, and verification scripts
Setup Flow
New projects start with:
npm create vergekit@latest my-app
cd my-app
npm installLocal development uses .dev.vars for local secrets, wrangler.jsonc for
committed non-secret Worker configuration, and Wrangler secrets for deployed
secret values. Apply D1 migrations before running auth flows, then optionally
create a verified user with the admin role with npm run init:admin.
App structure
src/
actions/ Astro Actions
auth/ Better Auth setup and route rules
components/ local Astro UI components
config/ source-level app and auth policy
db/ Drizzle schema, clients, and query seams
email/ providers and auth email templates
lib/http/ JSON and Zod parsing helpers
pages/ Astro pages and API routes
middleware.ts auth locals and route protection