Skip to content
Flare 0.8.0: money, percent, rating, timezone, currency and seven more field types.See them all

Setting up Cloudflare

Less than you would expect. You do not create a database, a bucket or a namespace by hand — Wrangler provisions them on the first deploy from what is already in wrangler.jsonc.

1. A Cloudflare account. Free to make at dash.cloudflare.com/sign-up. No card needed to sign up, and no domain needed: every Worker gets a <app>.<your-subdomain>.workers.dev URL.

2. Log Wrangler in, once per machine:

Terminal window
npx wrangler login

That opens a browser and authorises the CLI. Nothing else is needed for flare deploy to work.

3. Decide on the Workers Paid plan. $5/month. You can skip it to start, but read the CPU limit first — server-rendering React pages exceeds the free plan’s 10 ms of CPU per request, which shows up as intermittent 503s (error code: 1102). Most people should just pay the $5.

On the first deploy, Wrangler provisions anything in wrangler.jsonc that does not exist yet, and Flare does the rest:

Thing How it appears
D1 database <app>-db Provisioned on first deploy; no database_id is written in the config
R2 bucket <app>-storage Provisioned on first deploy
KV namespace for the data cache Provisioned on first deploy
Durable Object for realtime Created from the migration in wrangler.jsonc
Migrations flare deploy applies remote D1 migrations before the new code goes live, and aborts the deploy if one fails
BETTER_AUTH_SECRET Generated and uploaded if it isn’t set remotely — never your local dev secret

So the whole first deploy is:

Terminal window
npx wrangler login # once per machine
npx flare deploy

wrangler login needs a browser. On a build server, use an API token instead:

Terminal window
export CLOUDFLARE_API_TOKEN=…
export CLOUDFLARE_ACCOUNT_ID=…
npx flare deploy

Create the token at My Profile → API Tokens → Create Token. The Edit Cloudflare Workers template covers a normal deploy; add D1 Edit if your deploy applies migrations, and Workers R2 Storage Edit if it provisions the bucket.

None of these are needed to deploy. Each turns something on:

Secret Turns on
RESEND_API_KEY, MAIL_FROM Real email. Without them, mail is printed to the console instead of failing — see the email guide
GOOGLE_CLIENT_ID / _SECRET, and the other providers Social sign-in buttons; they only render once the pair is set
STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET Billing

Set one with:

Terminal window
npx wrangler secret put RESEND_API_KEY

flare deploy lists the ones you haven’t set, so you never have to remember this list.

Optional — workers.dev works fine. To use a domain, add it to Cloudflare (Add a site, then point your registrar at the nameservers Cloudflare gives you), then add a route in wrangler.jsonc:

{
"routes": [{ "pattern": "shop.example.com", "custom_domain": true }]
}

SSL is issued automatically. Set BETTER_AUTH_URL to the same origin so sign-in links point at the right place.

  • A card, to start. The free plan needs no payment method.
  • A domain. workers.dev gives you a working HTTPS URL.
  • To create the database, bucket or namespace. The first deploy does it.
  • A CI provider. flare deploy from your machine is a complete deploy.