Setup
Everything you need before deploying to DigitalOcean: the packages, a team, and a personal access token stored in a profile.
Prerequisites
Section titled “Prerequisites”- Node.js 24.11.1+ or Bun
- A DigitalOcean account
- Docker, to build App images
Create a project directory
Section titled “Create a project directory”mkdir my-app && cd my-app && pnpm initmkdir my-app && cd my-app && bun init -ymkdir my-app && cd my-app && npm init -ymkdir my-app && cd my-app && yarn init -yInstall
Section titled “Install”pnpm add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodebun add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodenpm install https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodeyarn add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodeCreate a token
Section titled “Create a token”Everything you create belongs to a team, and a token reaches one team. Pick the team in the control panel’s top-left menu, then:
- Go to API → Tokens and click Generate New Token.
- Choose Full Access: a Stack creates many kinds of resources.
- Copy the token. DigitalOcean shows it only once.
Give production its own team, and its own token, so it stays apart from everything else. See Teams, projects and tokens.
Connect Alchemy
Section titled “Connect Alchemy”Store the token in a profile:
pnpm alchemy profile edit --add DigitalOceanbun alchemy profile edit --add DigitalOceannpx alchemy profile edit --add DigitalOceanyarn alchemy profile edit --add DigitalOceanAlchemy asks for the token, an optional API base URL, and an optional Spaces access key pair. Leave the Spaces key empty unless you already have one: each deploy then creates a temporary key for its bucket changes and deletes it afterwards.
To store a token from an environment variable instead, without prompts:
pnpm alchemy profile edit --add DigitalOcean --method stored --set apiToken=env:DIGITALOCEAN_TOKENbun alchemy profile edit --add DigitalOcean --method stored --set apiToken=env:DIGITALOCEAN_TOKENnpx alchemy profile edit --add DigitalOcean --method stored --set apiToken=env:DIGITALOCEAN_TOKENyarn alchemy profile edit --add DigitalOcean --method stored --set apiToken=env:DIGITALOCEAN_TOKENCheck what’s stored (secrets are hidden):
pnpm alchemy profile showbun alchemy profile shownpx alchemy profile showyarn alchemy profile showWith CI=true, Alchemy skips the profile and reads DIGITALOCEAN_TOKEN (or DIGITALOCEAN_ACCESS_TOKEN, then DIGITALOCEAN_API_KEY), an optional DIGITALOCEAN_API_BASE_URL, and an optional SPACES_ACCESS_KEY_ID and SPACES_SECRET_ACCESS_KEY. See CI.
DigitalOcean has no storage for Alchemy’s record of what each Stack created. Keep it next to your code with Alchemy.localState(), or share it with your team and CI through Cloudflare.state() or AWS.state(). See State Store.
import * as DigitalOcean from "@alchemy.run/digitalocean";import * as Alchemy from "alchemy";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MyApp", { providers: DigitalOcean.providers(), state: Alchemy.localState() }, Effect.gen(function* () { const host = yield* DigitalOcean.Droplet("Host", { region: "nyc3", size: "s-1vcpu-1gb", image: "ubuntu-24-04-x64", }); return { ip: host.ipv4 }; }),);Next, the tutorial builds an App step by step.