Better auth example with next js, cf, d1. Implements
- Magic Link
- Social Sign-On
- Passkey
- Session & Account Management
- Install
pnpm install
- Create D1 Database
npx wrangler d1 create my_database
-
Add the binding to
wrangler.toml
-
Run the migration
npx wrangler d1 migrations apply my_database --local
-
Fill environment variables (see .dev.vars.example)
-
Run
pnpm dev