Note
This repository is featured on the official Hono website.
For more information, please refer to the official Better Auth or Hono documentation.
If you encounter any issues or have questions, feel free to open an issue.
A TypeScript-based lightweight authentication service optimized for Cloudflare Workers, built with:
This service uses three types of environment variable files for CLI tools, local development, and production deployment.
Used locally by CLI tools such as:
- Drizzle CLI
 - Better Auth CLI
 
BETTER_AUTH_URL=http://localhost:8801
BETTER_AUTH_SECRET=<YOUR_BETTER_AUTH_SECRET>
DATABASE_URL=<YOUR_DATABASE_URL>Used by Wrangler in local development.
pnpm run dev  # Runs `wrangler dev`, loading variables from .dev.varsBETTER_AUTH_URL=http://localhost:8801
BETTER_AUTH_SECRET=<YOUR_BETTER_AUTH_SECRET>
DATABASE_URL=<YOUR_DATABASE_URL>Used during deployment to register secrets on Cloudflare.
pnpm run deploy  # Runs `wrangler secret bulk .dev.vars.production && wrangler deploy --minify`BETTER_AUTH_URL=<YOUR_WORKER_URL>
BETTER_AUTH_SECRET=<YOUR_BETTER_AUTH_SECRET>
DATABASE_URL=<YOUR_DATABASE_URL>This project only provides a starting point, not a production-ready setup. For real-world use, you’ll need to configure things like CORS, rate limiting, plugins, etc. I’ve kept the setup minimal and simple, following official docs, so you can easily customize it to fit your needs.