Baseflare uses one Worker per environment for true infrastructure isolation. A staging deployment has completely separate D1, R2, and Durable Object resources from production — there is no shared state between environments. When you deploy to a new environment for the first time, the CLI auto-provisions all required Cloudflare resources before uploading any code. Subsequent deploys to the same environment update the Worker and apply schema changes without re-provisioning.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nickruigrok/baseflare/llms.txt
Use this file to discover all available pages before exploring further.
Resource Naming Convention
All Cloudflare resources managed by Baseflare follow abf-{project}-{env} prefix. This prefix lets the CLI distinguish Baseflare-managed resources from any other resources in your Cloudflare account, so destructive operations like env destroy can safely target the right set.
| Resource | Name pattern | Example |
|---|---|---|
| Worker | bf-{project}-{env} | bf-my-app-production |
| D1 database | bf-{project}-{env}-db | bf-my-app-production-db |
| R2 bucket | bf-{project}-{env}-files | bf-my-app-production-files |
| DO namespace (realtime connections) | RealtimeConnectionDO | bound to the Worker |
| DO namespace (realtime subscriptions) | RealtimeSubscriptionDO | bound to the Worker |
| DO namespace (scheduler) | SchedulerDO | bound to the Worker |
my-app deployed to the production environment, the resulting resources are:
staging and production environments under the same project — they share nothing at the infrastructure level.
Environment Registry
The CLI stores a local record of all provisioned environments in.baseflare/project.json. This file is generated automatically on first deploy and updated whenever resources are added or modified. It should be added to your .gitignore — it contains Cloudflare resource IDs that are specific to your account and are not meant to be shared.
--env <name> flag through this registry. API calls use stable resource IDs where Cloudflare provides them — names are display values, drift checks, and recovery hints. If the registry file is missing or a named environment is not in it, the CLI falls back to Cloudflare name discovery (bf-{project}-*). If multiple matching resources are found during discovery, the CLI fails and asks you to link the environment explicitly by resource ID.
Add
.baseflare/ to your .gitignore. The registry file is generated per-machine and should never be committed to source control.BASEFLARE_URL Environment Variable
The frontend client reads the backend Worker URL from the BASEFLARE_URL environment variable. For local development, the CLI automatically writes this value to .env.local when you run npx baseflare dev:
BASEFLARE_URL in your hosting platform. Each environment gets its own URL pointing to its own Worker:
npx baseflare deploy command prints the environment Worker URL after a successful deploy, making it easy to copy:
Authentication Credentials
The CLI resolves Cloudflare credentials using the following precedence order:Environment variables (CI/CD)
If
CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are set in the environment, the CLI uses them directly. This is the recommended approach for automated pipelines where interactive login is not possible.npx baseflare dev prompts you to select which profile and account to use. After the first run, the selection is written to .env.local (BASEFLARE_PROFILE) and subsequent runs skip the prompt.
Environment Isolation
Inserting a document in staging does not affect production. Each environment has its own dedicated D1 database with its own data, its own R2 bucket, its own Durable Object instances, and its own Worker script. There is no shared state of any kind between environments.
- Run destructive test data in staging without touching production
- Deploy experimental schema changes to staging before rolling to production
- Restore a staging database from a snapshot without affecting production
- Grant team members access to staging while restricting production access
Planned CLI Commands
The followingbaseflare CLI commands cover environment and secrets management. They are part of the Phase 4 CLI implementation and are in active development.
The CLI is in active development. Some commands listed above are scaffolded and planned as part of Phase 4. See IMPLEMENTATION_PLAN.md for the full roadmap and delivery timeline.