Getting Started
Prerequisites
Section titled “Prerequisites”- Bun (recommended) or Node.js 22+
- A Cloudflare account
Create a project
Section titled “Create a project”mkdir my-app && cd my-app && bun init -ymkdir my-app && cd my-app && npm init -ymkdir my-app && cd my-app && pnpm initmkdir my-app && cd my-app && yarn init -yInstall
Section titled “Install”bun add alchemy@2.0.0-beta.30 effect@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-bun@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-node@>=4.0.0-beta.58 || >=4.0.0npm install alchemy@2.0.0-beta.30 effect@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-bun@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-node@>=4.0.0-beta.58 || >=4.0.0pnpm add alchemy@2.0.0-beta.30 effect@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-bun@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-node@>=4.0.0-beta.58 || >=4.0.0yarn add alchemy@2.0.0-beta.30 effect@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-bun@>=4.0.0-beta.58 || >=4.0.0 @effect/platform-node@>=4.0.0-beta.58 || >=4.0.0Create your Stack
Section titled “Create your Stack”Every Alchemy program starts with a Stack — create alchemy.run.ts:
import * as Alchemy from "alchemy";import * as Cloudflare from "alchemy/Cloudflare";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MyApp", { providers: Cloudflare.providers(), state: Cloudflare.state(), }, Effect.gen(function* () { const bucket = yield* Cloudflare.R2Bucket("Bucket");
return { bucketName: bucket.bucketName, }; }),);Deploy
Section titled “Deploy”Run alchemy deploy to create the Bucket on Cloudflare:
bun alchemy deploynpx alchemy deploypnpm alchemy deployyarn alchemy deployThe first time you deploy, Alchemy walks each provider in your stack
(here, Cloudflare) through an interactive login and saves the
credentials to your default profile at
~/.alchemy/profiles.json. For Cloudflare you can sign in with
OAuth in the browser or paste an API token — no environment
variables required.
Once you’re authenticated, Alchemy shows a plan, asks for confirmation, and provisions the resource:
Plan: 1 to create + Bucket (Cloudflare.R2Bucket) Proceed? ◉ Yes ○ No ✓ Bucket (Cloudflare.R2Bucket) created { bucketName: "myapp-bucket-a1b2c3d4e5", }
That’s it — you have a live R2 Bucket on Cloudflare.