import Terminal from "../../components/Terminal.astro";
import PackageManagers from "../../components/PackageManagers.astro"; export const pkgs = `alchemy@latest @alchemy.run/cloudflare@latest effect @effect/platform-bun @effect/platform-node`; :::tip Want the idea before the install? What is Alchemy? explains the model in a few minutes. Otherwise, read on and it's the next page. :::
Prerequisites
- Bun or Node.js 24.11.1+
- A Cloudflare account
Create a project
Install
Create your Stack
Every Alchemy program starts with a Stack — create alchemy.run.ts:
// alchemy.run.ts
import * as Alchemy from "alchemy";
import * as Cloudflare from "@alchemy.run/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.R2.Bucket("Bucket");
return {
bucketName: bucket.bucketName,
};
}),
); Deploy
Run alchemy deploy to create the Bucket on Cloudflare:
Connect Cloudflare first with alchemy profile edit --add Cloudflare.
Sign in with OAuth in the browser or paste an API token. The
credentials are saved to your default
profile at ~/.alchemy/profiles.json. No
environment variables required. Logging in only ever happens through the
profile command; a deploy with nothing configured fails with the exact
command to run.
Once you're authenticated, Alchemy shows a plan, asks for confirmation, and provisions the resource:
<Terminal content={`[u]Plan[/u]: [g]1 to create[/g] [g]+[/g] [b]Bucket[/b] d[/d]
Proceed? ◉ Yes ○ No [g]✓[/g] [b]Bucket[/b] d[/d] [g]created[/g] { [s2]bucketName: "myapp-bucket-a1b2c3d4e5", }`} />
That's it — you have a live R2 Bucket on Cloudflare.
Full command reference: CLI.
:::tip
To re-run the credential prompt later (e.g. to switch from OAuth to
an API token), use alchemy profile edit --reconfigure Cloudflare.
For a separate profile, run alchemy profile create prod followed by
alchemy profile edit --profile prod.
See Profiles for the full picture.
:::
Where next
You have a live Stack. What is Alchemy? explains what just happened and the model the rest of the docs build on. The tutorial then builds a full app on Cloudflare, starting from this exact Stack.