Set Up and Deploy
pnpm run setupSetup is the guided installer. On a fresh install it:
- Checks that Wrangler is authenticated.
- Creates the D1 database and R2 bucket, or reuses ones already configured.
- Applies database migrations.
- Generates and stores
BETTER_AUTH_SECRET. - Offers to configure email (optional; see Email).
- Deploys the API Worker.
- Sets
BETTER_AUTH_URLto the API’s real URL, only while it is still the pre-deploy placeholder. - Builds and deploys the Admin Worker against that API URL.
- Stores the Admin Worker’s URL as the
ADMIN_URLsecret and adds its origin toCORS_ORIGINS, then redeploys the API.
It ends by printing both Worker URLs and the commands for the next step, creating the Owner.
The deployment runs the release npm create checked out, which is always the latest one. Settings → Updates in the admin shows its version.
Setup once, then update
Section titled “Setup once, then update”| Command | When | What it does |
|---|---|---|
pnpm run setup |
Once, for the first deployment | Creates Cloudflare resources, secrets and configuration, then deploys |
pnpm run update |
For every new release after that | Moves the code to the latest release, applies migrations and redeploys. Never touches secrets, resources or configuration |
See Update the CMS for the full update flow.
Running setup again
Section titled “Running setup again”On an existing install, setup shows a status summary and a menu: continue without changes, update configuration, reconfigure everything, or cancel. It never overwrites a real BETTER_AUTH_URL, never rotates BETTER_AUTH_SECRET without an explicit confirmation (rotating it signs everyone out), and does not append a duplicate CORS origin.
Running setup again does not update the CMS to a newer release; use pnpm run update for that. To change one setting, use the pnpm run update -- --auth, --email, --domain family described there.
Name collisions
Section titled “Name collisions”D1, R2 and Worker names only need to be unique within your Cloudflare account. If a default name is already used there (for example by another deployment of the CMS in the same account), setup asks for a different name instead of failing or overwriting. It also refuses to deploy over a Worker that belongs to a different deployment. See Setup troubleshooting.