This repo was generated from the react-router-cloudflare-d1
template
You can start a react-router project from this repo by running:
npx create-react-router@latest --template matthewlynch/better-auth-react-router-cloudflare-d1
- Run
cp .dev-example.vars .dev.vars
to create an .env file you can use to override variables defined inwrangler.toml
or set secret values you don't want to check into source control - Update the
name
field inwranlger.toml
- Install dependencies
pnpm install
- Create a database by running
wrangler d1 create <name>
and updatewranlger.toml
with the UUID and name for the database - Add your GitHub OAuth Client ID/Secret & optionally your Cloudflare Account ID/Database UUID/Token to
.dev.vars
(you only need this when you want to view data via Drizzle Studio for your remote database) - Run
pnpm typegen
any time you make changes towranlger.toml
to ensure types from bindings and module rules are up to date for type safety - Run
pnpm db:warm
to ensure wrangler has created a local database - Run
pnpm db:migrate
to apply the migration files to your local database - Run
pnpm dev
to start the app
- Make changes to the
better-auth
config in./app/auth/auth.server.ts
- Run
pnpm auth:db:generate
to create thebetter-auth
drizzle schema file./database/auth-schema.ts
- Run
pnpm db:generate
to create migration files - Run
pnpm db:migrate
to apply the migration files to your local database
Built with ❤️ by Matt