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