Skip to content

CLI reference

Short, wrangler-consistent verbs. Every command below accepts --help.

Scaffold a new app.

Flag
--pm <manager> pnpm, npm, yarn, or bun (default: detected)
--auth-providers <list> Comma-separated OAuth providers to scaffold: google, github
--skip-install Write files without installing dependencies
Terminal window
npx @flare/cli create shop --auth-providers google,github

Generate (or update) a resource — see what it emits and the field grammar.

Flag
--fields <fields> e.g. "name:string, email:string!, status:enum(lead,customer)"
--force Overwrite a hand-edited generated block
Terminal window
npx flare gen resource Contact --fields "name:string, email:string!, company:belongsTo(Company)?"

Scaffold a migration by hand, or diff the current schema.

Flag
--from-schema Diff current tables instead of writing a blank migration
Terminal window
npx flare gen migration backfill_contact_status
npx flare gen migration add_phone_to_contacts --from-schema

Write (or update) a resource-level policy.

Flag
--roles <roles> Roles allowed to read, create, and update, e.g. admin,staff
--delete-roles <roles> Roles allowed to delete (default: the first --roles entry)
--force Overwrite a hand-edited roles block
Terminal window
npx flare gen policy Invoice --roles admin,staff --delete-roles admin

Add Stripe billing: the Plan, Customer and Purchase resources, their policies, Checkout, the Customer Portal, the webhook, and /dashboard/billing.

Flag
--provider <provider> Payment provider. Only stripe is supported.
--mode <mode> Only subscriptions, which also covers one-time checkout
--force Overwrite hand-edited generated blocks, including a hand-edited Customer fields block
--skip-install Write the files without installing the stripe dependency
--skip-migration Skip generating the migration
Terminal window
npx flare gen billing --provider stripe --mode subscriptions

Add security: security.config.ts, the SecurityEvent resource and policy, the request guard in lib/security.ts, the /admin/security dashboard, and the KV, Durable Object and rate-limit bindings in wrangler.jsonc.

Flag
--force Overwrite hand-edited generated blocks
--skip-migration Skip generating the migration
Terminal window
npx flare gen security

Mirror this app’s Stripe Products (those with metadata flare_app=<package name>) and their active prices into the Plan table. Deactivate plans whose price is gone. Configure the Customer Portal to allow switching between the synced plans.

Flag
--remote Write to the deployed database
--env <name> Wrangler environment
--all Import every active Product, not only this app’s
Terminal window
npx flare billing:sync-plans --remote

Remove a resource’s generated files. Refuses on hand-written code outside generated blocks, or while another resource still references it — see the codegen overwrite contract.

Flag
--force Delete even when files contain hand-written code
Terminal window
npx flare rm resource Tag

Register an additional role users can be assigned. admin and staff are seeded by the initial migration.

Flag
--label <label> Display label (default: humanized name)
--remote Target the deployed database
--env <name> Wrangler environment
Terminal window
npx flare role:add support --label "Customer support"

Set a user’s role — e.g. make the first admin. Refuses an unregistered role name.

Flag
--remote Target the deployed database
--env <name> Wrangler environment
Terminal window
npx flare user:role you@example.com admin --remote

Apply pending D1 migrations (local by default — shared state with flare dev/flare start).

Flag
--remote Target the deployed database
--env <name> Wrangler environment
--database <binding> Which D1 binding, when the app has more than one

Undo the most recently applied migrations — see migrations & seeds for exactly how downs are resolved.

Flag
--steps <n> How many migrations to roll back (default 1)
--remote Target the deployed database (requires --yes)
--yes Confirm a remote rollback
--env <name> Wrangler environment
--database <binding> Which D1 binding

Run seed files from seeds/ against the local D1 database.

Terminal window
npx flare seed # every seed, file-name order
npx flare seed contacts # just seeds/contacts.seed.ts

Create seeds/<name>.seed.ts, with example rows if the name matches a resource.

Flag
--resource <name> Write example rows for this resource explicitly

Regenerate every derived file from the descriptors and report drift — see drift & sync-types.

Flag
--check Change nothing; exit 1 if anything is out of sync (CI)
--force Overwrite generated blocks that were edited by hand

These forward straight through to the app’s own installs — see deploying to Cloudflare for what deploy adds on top.

Command Runs
flare dev vinext dev
flare build vinext build
flare start wrangler dev --config dist/server/wrangler.json --persist-to .wrangler/state (runs flare build first if there’s no build yet)
flare deploy Migrations → vinext-cloudflare deploy → secrets → zone security rules

flare deploy additionally accepts --skip-migrations, --skip-secrets, --skip-security, --env <name>, and --preview (shorthand for --env preview).