1---
2title: Setup
3description: Install Alchemy, create a Cloudflare account, and connect the two — OAuth or API token, saved to a local profile. No environment variables required.
4---
5
6import { Code, Tabs, TabItem } from "@astrojs/starlight/components";
7import { effectVersion } from "../../../versions";
8
9export const pkgs = `"alchemy@latest" "effect@${effectVersion}" "@effect/platform-bun@${effectVersion}" "@effect/platform-node@${effectVersion}"`;
10
11Everything you need before deploying to Cloudflare: the alchemy
12package, a Cloudflare account, and stored credentials.
13
14## Install
15
16Install <code>alchemy@latest</code> and <code>effect@{effectVersion}</code>
17in your project:
18
19<Tabs syncKey="pkgManager">
20 <TabItem label="bun" icon="bun">
21 <Code code={`bun add ${pkgs}`} lang="sh" />
22 </TabItem>
23 <TabItem label="npm" icon="npm">
24 <Code code={`npm install ${pkgs}`} lang="sh" />
25 </TabItem>
26 <TabItem label="pnpm" icon="pnpm">
27 <Code code={`pnpm add ${pkgs}`} lang="sh" />
28 </TabItem>
29 <TabItem label="yarn" icon="seti:yarn">
30 <Code code={`yarn add ${pkgs}`} lang="sh" />
31 </TabItem>
32</Tabs>
33
34Alchemy runs on [Bun](https://bun.sh) or Node.js 22+.
35
36## Create a Cloudflare account
37
38If you don't have one yet,
39[sign up for Cloudflare](https://dash.cloudflare.com/sign-up) — the
40free plan is enough for everything in the tutorial.
41
42## Connect alchemy to Cloudflare
43
44Connect Cloudflare (the `default` profile is created automatically on
45first use):
46
47```sh
48alchemy profile edit --add Cloudflare
49```
50
51For Cloudflare you can:
52
53- **Sign in with OAuth** — opens the browser, no tokens to manage.
54- **Paste an API token** — if you prefer explicit, scoped tokens.
55
56The OAuth flow asks whether you want to customize scopes — answer
57yes to pick exactly which ones to grant at a multiselect prompt (the
58default set covers typical use).
59
60Either way the result is saved to your **`default`**
61[profile](/environments/profiles) at `~/.alchemy/profiles.json` — no
62environment variables and no `wrangler login` required.
63
64To re-run the flow later:
65
66```sh
67# Re-run the interactive setup (e.g. switch from OAuth → API token)
68alchemy profile edit --reconfigure Cloudflare
69
70# Or manage every account in the profile from one menu
71alchemy profile edit
72```
73
74`profile edit` imports your stack file to discover which providers
75are available, so the menu matches the providers you actually use.
76
77## Profiles
78
79A profile is a named bundle of credentials. Commands use the built-in
80`default` profile unless you name another one explicitly.
81Pass `--profile <name>` or set `$ALCHEMY_PROFILE` to select one —
82handy for separating work and personal accounts, or staging and prod credentials:
83
84```sh
85# Log into a separate profile
86alchemy profile create prod
87alchemy profile edit --profile prod
88
89# Deploy with it
90alchemy deploy --stage prod --profile prod
91```
92
93Inspect what's stored (credentials are redacted) with:
94
95```sh
96alchemy profile show
97```
98
99See [Profiles](/environments/profiles) for the full picture.
100
101:::note[Running in CI?]
102CI environments can't do interactive logins. There, alchemy reads
103credentials from the environment instead: `CLOUDFLARE_ACCOUNT_ID`
104plus either `CLOUDFLARE_API_TOKEN` or `CLOUDFLARE_API_KEY` +
105`CLOUDFLARE_EMAIL` (or `CLOUDFLARE_ACCOUNT_EMAIL`). See the [CI guide](/environments/ci) for the full
106GitHub Actions setup.
107:::
108
109## Where next
110
111- [Tutorial part 1](/cloudflare/tutorial/part-1) — create a Stack,
112 deploy your first resource.
113- [Cloudflare overview](/cloudflare) — the map of resources and
114 guides.
115- [Secrets & env](/cloudflare/security/secrets-env) — wire `.env` values and
116 secrets into your Workers (deploy credentials live in your profile;
117 app secrets are bindings).