Skip to content

feat: deploy with alchemy — typed alchemy.run.ts replacing deployment.jsonc + deploy.mjs - #1

Draft
sam-goodwin wants to merge 1 commit into
cloudflare:mainfrom
sam-goodwin:sam/alchemy-deploy
Draft

feat: deploy with alchemy — typed alchemy.run.ts replacing deployment.jsonc + deploy.mjs#1
sam-goodwin wants to merge 1 commit into
cloudflare:mainfrom
sam-goodwin:sam/alchemy-deploy

Conversation

@sam-goodwin

@sam-goodwin sam-goodwin commented Aug 5, 2026

Copy link
Copy Markdown

Adopt alchemy as the recommended deployment path: one typed alchemy.run.ts replaces deployment.jsonc + scripts/deploy.mjs. The wrangler flow stays intact as the alternative.

// alchemy.run.ts
export default Alchemy.Stack(
  "MyCompanyOS",
  { providers: Cloudflare.providers(), state: Cloudflare.state() },
  Effect.gen(function* () {
    const errorReporter = yield* Cloudflare.Worker("ErrorReporter", {
      main: "./packages/error-reporter/src/index.ts",
      workersDev: false,
    });

    const os = yield* OperatingSystem("OS", {
      domain: "os.example.com",
      admins: ["you@example.com"],
      auth: { access: { aud: "<AUDIENCE_TAG>", iss: "https://<TEAM>.cloudflareaccess.com" } },
      gatekeepers: [
        Context({ sharingDomain: "production" }),
        Gatekeeper({
          name: "custom",
          package: "custom-gatekeeper",   // entry, flags, DO migrations derive from its wrangler.jsonc
          env: { CUSTOM_NAME: "…", CUSTOM_MESSAGE: "…" },
        }),
      ],
      ai: {
        providers: { anthropic: Config.redacted("ANTHROPIC_API_KEY") },
        workersAi: true,
      },
      backend: {
        services: [{
          binding: "ERROR_REPORTER",
          worker: errorReporter,
          entrypoint: "ErrorReporter",
          props: { service: "workshop", environment: "production" },
        }],
      },
      frontend: { env: { VITE_FRONTEND_ERROR_REPORTING: "true" } },
    });

    return { url: os.url };
  }),
);
pnpm exec alchemy deploy    # KV, R2, and the AI Gateway + token + keys are provisioned, not referenced
pnpm exec alchemy destroy

Requires a submodule bump to a cloudflare-os commit containing packages/alchemy, deployed with an alchemy release including Cloudflare.WorkerEntrypoint (alchemy#1097).

🤖 Generated with Claude Code

….jsonc + deploy.mjs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant