Devflare Docs
Configuration Devflare

Keep runtime posture and deployment shape in authored config instead of scattered deploy conventions

Use config for account context, compatibility posture, assets, deployment routes, WebSocket proxy rules, migrations, observability, limits, and preview cron behavior instead of rediscovering those settings in scripts later.

Devflare exposes several config lanes that are not about file discovery at all. These keys shape runtime identity, Cloudflare compatibility, deployment routing, assets, release behavior, and operational posture, so they belong in authored config where the team can review them accurately.

Best for
Projects that need explicit runtime posture and delivery shape beyond the basic file surfaces
Forced compatibility flags
and
Routing split
is app routing, while top-level is Cloudflare deployment routing
Preview cron default
defaults to

Set runtime identity and compatibility posture explicitly

Not every package needs the full advanced runtime section on day one, but once remote bindings, compatibility drift, or account-aware operations matter, these settings should move into config instead of living in loose scripts and remembered defaults.

The important habit is that runtime posture should be reviewable in source control. If a package relies on a specific compatibility date or a specific Cloudflare account, that fact should be obvious before the deploy step runs.

KeyUse it whenImportant behavior
Remote bindings, name-based resource lookup, or account-aware commands should target one Cloudflare account explicitly.Remote AI and Vectorize flows need a clear account, and config-level becomes one resolution lane for account-aware operations and config-driven resource resolution.
The package should pin runtime behavior instead of inheriting date drift.Devflare defaults it to the current date when you omit it, so explicit pinning is the safer choice once the package is real.
You need extra Workers compatibility flags beyond the default posture.Devflare always includes and , so custom flags should be deliberate additions instead of copy-by-habit repetition.

Do not restate the forced flags unless you are making a point

Devflare already includes and . Keep focused on the extra posture your package actually needs.

Choose the Cloudflare endpoint model first

Cloudflare documents three inbound endpoint models for Workers: Custom Domains, normal Workers routes, and the automatic route. They are not interchangeable, and Devflare keeps that distinction in the top-level config instead of inventing a second routing vocabulary.

Use a Custom Domain when the Worker is the origin for a whole hostname. Use a normal Workers route when a Worker should sit in front of an existing proxied hostname, match a wildcard host, or match a path prefix. Use for getting started or preview-style reachability, and disable it when production should only be reachable through your own domain.

GoalDevflare config shapeCloudflare behavior
Worker owns every path on one hostnameCustom Domains match the exact hostname; paths and query strings do not participate in the match.
Worker intercepts a path or wildcard host in a Cloudflare zoneNormal routes use route patterns, may include , and the most specific matching route wins.
Worker remains reachable on the account subdomainDefault generated Wrangler config keeps .Cloudflare assigns ; Cloudflare recommends routes or custom domains for production.

Routes can sit in front of Custom Domains

Cloudflare treats a Worker on a Custom Domain as an origin. A more specific normal route on the same hostname can run first, then call to invoke the Custom Domain Worker behind it.

Same-zone fetch is different for routes and Custom Domains

Cloudflare documents that Custom Domains can be invoked by same-zone , while normal routes cannot be the target of same-zone and should use service bindings for Worker-to-Worker calls.

Custom Domain for a Worker-owned hostname

Workers route for path or wildcard matching

Disable workers.dev when only custom endpoints should serve production

Keep deployment shape in config, not in app routing or shell scripts

Several config keys answer deployment questions rather than application-routing questions. Keeping those lanes separate is what stops app URLs, Cloudflare routes, and dev-only WebSocket proxy behavior from collapsing into one blurry story.

If the package serves static assets, mounts a custom domain, or proxies Durable Object WebSockets in development, that shape should live in config beside the rest of the deployment contract.

Custom Domains are host-only: use with a bare hostname such as . For wildcard or path matching such as or , use a normal Workers route with or instead.

KeyWhat it controlsCommon use
Static asset directory plus optional binding namePoint Devflare at one static directory and keep asset delivery visible in source.
Cloudflare deployment route patternsAttach the Worker to host or zone patterns at deploy time.
Dev-mode Durable Object WebSocket proxy patternsForward development WebSocket paths into Durable Object namespaces explicitly.

Top-level is not the same thing as

controls your app route tree. Top-level controls Cloudflare deployment routing. Keep those ideas separate so the package stays reviewable.

Custom Domains are not wildcard routes

Cloudflare Custom Domains match the hostname exactly and ignore paths. Do not add when ; a request to any path on that hostname will already invoke the Worker.

One place for runtime posture and deployment-facing settings

Declare zone-scoped resources instead of clicking them into the dashboard

Everything else Devflare provisions is account-scoped. Email Routing rules and DNS records are not: they belong to a zone, which is a different identifier reached by a different lookup and gated by a different token scope. The key is where they are declared, and a deploy reconciles them.

The key is a domain rather than a zone id, because a domain is what an author knows. Devflare walks the domain labels up to the apex to find the zone, so is configured under its own name and its records land in the zone. A relative record name resolves against the domain it was declared under, not the zone apex — for a subdomain those differ, and the apex would be the wrong place.

Rules reconcile on the address they claim and records on their type and name, so deploying twice is a no-op rather than a pile of duplicates. Nothing is ever deleted: a zone almost always carries rules and records this config never mentioned.

Zone work runs at two points of a deploy. Sending onboarding, enabling routing, destination addresses, and rules and catch-alls, and DNS are reconciled before Wrangler uploads, after the account resources, so a config error fails before any zone is touched. A rule or catch-all whose action is waits until the upload has succeeded, because Cloudflare refuses a route naming a Worker that does not exist yet — which is exactly the first deploy of a Worker that routes mail to itself. A write Cloudflare answers with that error (code 2016) is retried three times, a few seconds apart, in case Email Routing has not seen the new Worker yet. If the upload fails or cannot be proven, those routes are not attempted and the failure names them; if one of them fails after a good upload, the deploy fails and says the Worker was uploaded, which route was not set, and which Worker it hands mail to. A gradual rollout sets them after its traffic split. One cost: a route to a different Worker that does not exist now fails after this Worker has shipped, not before.

and are different Cloudflare products that happen to share a zone. Routing is inbound — what happens to mail arriving for the domain. Sending is outbound — whether a binding may send from an address here. A domain that does both is onboarded to both, separately, and a subdomain gets its own DKIM key rather than inheriting the apex one. Sending readiness is reported rather than waited on: Cloudflare writes the records at onboarding and they take minutes to propagate, so a deploy that failed on them would fail one that did everything right.

DeclaredWhat a deploy doesWhat it will not do
Checks the domain is onboarded and able to send, and reports its DNS readiness.Onboard it without — it fails and names the fix instead.
Creates any rule whose address is not already claimed — a rule only after the upload.Rewrite one that exists and points elsewhere — it reports the difference instead.
Sets it, but only when it differs from what is live — a catch-all only after the upload.Touch it at all when the key is omitted.
Turns Email Routing on for the zone.Turn it on without this — a zone with routing off fails the deploy instead.
Creates a missing record, and rewrites one that drifted in content, TTL or MX priority.Guess which record it owns when several already share that type and name.

Declaring a DNS record means owning it

A declared record that drifted in content, TTL or MX priority is rewritten to match, because that is what declarative means — and it is what turns a staged DMARC rollout into a config edit rather than a dashboard visit. The consequence is that you must not declare a record another system writes.

Cloudflare writes and LOCKS its own records when a domain is onboarded to Email Routing or Email Sending: the and SPF on , the DKIM key at , and a DMARC policy at . Check what is already there before declaring anything in that set — a DMARC record in particular may already exist and belong to Cloudflare.

A type and name pair is a record SET, not one record

An apex routinely holds an SPF record AND a vendor verification string; and hold several by design. So when more than one record already exists for a declared type and name, Devflare refuses rather than picking one: rewriting the wrong one destroys an unrelated record, and for SPF it also leaves the domain with two SPF records, which is a permanent error for the whole domain under RFC 7208.

It resolves the ambiguity only when it can do so safely — exactly one record carrying its own comment, or exactly one whose content already matches. Otherwise it names the count and stops, and you either remove the extras or mark the one it should own with that comment.

Enabling Email Routing rewrites the zone MX records

That changes where all mail for the domain is delivered, which is too large a side effect to follow from someone adding a forwarding rule. So it is never inferred: is the authorization, and without it a zone with routing off fails the deploy and says what to do. Existing mail flow for a domain is not something a deploy should be able to redirect by accident.

reads the live zone but changes nothing in it

Every zone mutation is substituted in describe-only mode, enabling included, while the reads still happen for real — so the plan reflects the actual mix of what exists and what does not, without a single write. Routes to a Worker are listed with the rest, marked as after the upload. Preview-scoped deploys have no zone resources at all: a rule or a record is shared by the whole domain and would outlive the branch that created it.

Email routing and DNS as authored config

Subscribe a Queue to platform events in config

declares which platform events Cloudflare should publish onto which of your Queues — R2 object writes, Workers Builds results, Email Sending delivery outcomes. The queue is named rather than identified, and Devflare resolves the id; declare the queue in and the same deploy provisions it first, because a subscription cannot create its own.

They are matched on the pair of source and queue, never on name. A name is cosmetic, and a subscription created by hand in the dashboard will not carry the one Devflare would have written — matching on it would add a second subscription beside the working one, and both would deliver, doubling every event onto the queue. Nothing is deleted or updated: a subscription is a live delivery path, and changing which events it carries is a decision rather than a reconciliation.

The array takes the SHORT form

, not the that arrives ON the queue. The prefixed string is what a consumer reads off the message; a subscription that asks for it subscribes to nothing, and does so silently — no error, no events, and a queue that simply stays empty.

is a passthrough, and that is deliberate

Cloudflare publishes eight source types in its API schema and ships ten in wrangler, and Email Sending — generally available and documented since July 2026 — appears in neither. A modelled union would therefore reject sources that work, so the object is forwarded verbatim instead.

Which leaves the question of what to put in it for a source Cloudflare has not documented. Do not guess: the sample event payloads use camelCase while every verified request shape uses snake_case, so and are a coin flip that fails at deploy time. Create one subscription in the dashboard and deploy — when a declared subscription matches nothing, Devflare prints the source of every subscription the account already has, exactly as Cloudflare stores it. Copy those field names.

One queue, one source, the events between them

Put release and operational controls in source control too

Once a package has Durable Object history, production traffic expectations, or explicit preview behavior, the runtime contract is no longer just “what files exist?” It also includes how that package should be migrated, sampled, and limited at runtime.

These settings belong in the same config as the Worker surfaces. They are part of the deployable contract, not just garnish around it.

KeyWhy it exists
Choose whether branch-scoped preview deploys keep cron triggers instead of omitting them to avoid shared-schedule conflicts.
Declare CPU expectations in config rather than treating them as after-the-fact deploy tuning.
/ Keep tracing or sampling posture explicit for the environments that need it.
Track Durable Object class lifecycle in the same source-controlled package that owns those classes.

Durable Object migrations still deserve explicit release thinking

Keep migrations authored in config and remember that plain preview uploads do not apply Durable Object migrations. If the preview must exercise real Durable Object lifecycle changes, use the preview strategy that matches that reality.

Previous

Previews

Use for bindings that should belong to one preview scope. Devflare materializes names like , provisions or reuses the preview-only resources it can manage, and lets you clean them up by the same scope later without touching production resources.

Next

Runtime context

Use explicit event parameters at handler boundaries, then use , , , , , , and inside helper code that runs during the same request or job.