tl;dr - I’m building a Cloudflare-native application and want to use Cloudflare’s declarative Durable Object exports with Alchemy v2. This would let me adopt existing Durable Object namespaces without moving or losing their data.
I have draft PRs open in both Alchemy and Distilled, but I wanted to document the use case and make sure the direction makes sense. No hard feelings if this gets closed.
---- FROM HERE DOWN IS AI SLOP ----
Current limitation
Cloudflare’s declarative metadata.exports represents live Durable Object classes and lifecycle tombstones in one desired-state map. It can describe class creation, deletion, renaming, and transfers without maintaining an ordered migration history in application code.
Cloudflare.Worker currently derives legacy metadata.migrations automatically from Durable Object bindings. There is no public Worker prop for the declarative exports contract.
As a result, an application cannot opt into declarative lifecycle management or safely move an existing Alchemy-managed Worker from legacy migrations to declarative exports.
Feature request
Add an opt-in durableObjectExports prop:
yield* Cloudflare.Worker("Api", {
main: "./worker.ts",
durableObjectExports: {
Counter: {
type: "durable-object",
storage: "sqlite",
},
},
env: {
Counter: Cloudflare.DurableObject("Counter"),
},
});
When the prop is present:
- Send the declaration as the Worker upload’s
exports metadata
- Treat the map as the complete Durable Object lifecycle declaration
- Stop generating legacy migration arrays for that Worker
- Allow one-way adoption from legacy migrations without moving existing data
- Reject returning an adopted Worker to the legacy migration flow
- Include the declaration in Worker diffing and pre-create behavior
- Prevent lifecycle changes from riding a gradual rollout
Workers that omit the prop should retain the existing automatic migration behavior.
Implementation
Draft Alchemy implementation: alchemy-run/alchemy#989
Required generated SDK support: alchemy-run/distilled#394
tl;dr - I’m building a Cloudflare-native application and want to use Cloudflare’s declarative Durable Object exports with Alchemy v2. This would let me adopt existing Durable Object namespaces without moving or losing their data.
I have draft PRs open in both Alchemy and Distilled, but I wanted to document the use case and make sure the direction makes sense. No hard feelings if this gets closed.
---- FROM HERE DOWN IS AI SLOP ----
Current limitation
Cloudflare’s declarative
metadata.exportsrepresents live Durable Object classes and lifecycle tombstones in one desired-state map. It can describe class creation, deletion, renaming, and transfers without maintaining an ordered migration history in application code.Cloudflare.Workercurrently derives legacymetadata.migrationsautomatically from Durable Object bindings. There is no public Worker prop for the declarative exports contract.As a result, an application cannot opt into declarative lifecycle management or safely move an existing Alchemy-managed Worker from legacy migrations to declarative exports.
Feature request
Add an opt-in
durableObjectExportsprop:When the prop is present:
exportsmetadataWorkers that omit the prop should retain the existing automatic migration behavior.
Implementation
Draft Alchemy implementation: alchemy-run/alchemy#989
Required generated SDK support: alchemy-run/distilled#394