Set Up and Deploy
pnpm run setupSetup is the installer for a first deployment. It:
- Checks that Wrangler is authenticated.
- Creates or configures the D1 database and the R2 bucket.
- Applies database migrations.
- Generates and stores the Better Auth secret.
- Deploys the API Worker and determines its real URL.
- Sets
BETTER_AUTH_URLto that URL. - Builds and deploys the Admin Worker.
- Adds the Admin Worker origin to the API’s CORS allow-list.
When it finishes it prints the deployed Worker URLs.
Running setup again
Section titled “Running setup again”Setup detects an existing installation and offers: continue without changes, update a configuration area, reconfigure everything, or cancel. It does not re-create resources that exist, and it does not overwrite a BETTER_AUTH_URL that is already set to a real value.
For routine code updates use pnpm run update instead.
Name collisions
Section titled “Name collisions”If a D1 database, R2 bucket or Worker name is already used in your Cloudflare account, setup asks for a different name rather than overwriting it. See Setup troubleshooting.