Better Auth + shadcn SPA on Cloudflare, in one command
A Copier template for a Cloudflare Worker that serves Better Auth and a shadcn/ui login SPA, backed by D1. Hono, Drizzle, and Vite wired up. Generate, deploy, done.
A Copier template for a Cloudflare Worker that serves Better Auth and a shadcn/ui login SPA, backed by D1. Hono, Drizzle, and Vite wired up. Generate, deploy, done.
A Copier template for a Cloudflare Worker that serves Better Auth and a shadcn/ui login SPA, backed by Cloudflare D1.
/api/auth/* and the drizzle-orm/d1 adapterassets bindingwrangler.jsonc with the D1 binding, SPA fallback, and run_worker_first: ["*/api/**"]$ uvx copier copy gh:<owner>/<this-repo> ./my-auth-app # or from a local checkout $ uvx copier copy path/to/this-template ./my-auth-app
You will be asked for a project_slug (kebab-case name for the Worker and package), app_title and app_tagline (text shown in the login card), and worker_name / d1_database_name (defaults derived from the slug). After generation, Copier runs install and build, then prints the commands to create the D1 database and deploy.
The default rendered project is vanilla Cloudflare + D1, right for about 90 percent of projects. When it is not, a rendered project can move selected pieces onto your own infra without a rewrite. Each escape hatch is documented:
/api/* and the SPA.Can I swap D1 for my own Postgres later without a rewrite?
Yep. The self-hosted-database doc walks through swapping D1 for Postgres via Hyperdrive and a Cloudflare Tunnel. The Worker stays put.
Made this our default starter for internal tools. The shadcn login screen out of the box is chef's kiss.
New escape hatches, auth providers, and Cloudflare features. No spam, just the changelog.
Had Better Auth + D1 deployed in minutes. The wrangler.jsonc being preconfigured is the real time-saver.