Teams, projects and tokens
Everything you create on DigitalOcean belongs to a team: its Apps, Droplets, clusters, buckets and agents, its one Container Registry, and its bill. Every account starts with a personal team, and a company creates more and invites its members.
A team is the boundary for access. A personal access token is created for one team and reaches everything in it, so the token decides where a deploy goes. The runtimes you deploy get narrower keys: each binding gives its runtime a key that reaches one resource.
Projects group, teams isolate
Section titled “Projects group, teams isolate”A project groups resources inside a team for the control panel: new resources land in the default project, and you can move them. Projects don’t separate access or billing. Use separate teams for that.
import * as DigitalOcean from "@alchemy.run/digitalocean";
export const Shop = DigitalOcean.Project("Shop", { description: "The shop's resources" });Sign in with a token
Section titled “Sign in with a token”Create a personal access token in the control panel under API → Tokens → Generate New Token. Choose Full Access, since a Stack creates many kinds of resources. DigitalOcean shows the token once.
Then store it in a profile:
pnpm alchemy profile edit --add DigitalOceanbun alchemy profile edit --add DigitalOceannpx alchemy profile edit --add DigitalOceanyarn alchemy profile edit --add DigitalOceanThe profile also takes an optional Spaces access key pair. Without one, each deploy creates a temporary Spaces key, uses it for its bucket changes, and deletes it when the deploy ends. See Setup.
One team per environment
Section titled “One team per environment”A stage decides what you deploy. The profile’s token decides where. Give production its own team, so its members, its registry and its bill are separate, and its own profile:
pnpm alchemy profile create prodpnpm alchemy profile edit --profile prod --add DigitalOceanpnpm alchemy deploy --stage prod --profile prodbun alchemy profile create prodbun alchemy profile edit --profile prod --add DigitalOceanbun alchemy deploy --stage prod --profile prodnpx alchemy profile create prodnpx alchemy profile edit --profile prod --add DigitalOceannpx alchemy deploy --stage prod --profile prodyarn alchemy profile create prodyarn alchemy profile edit --profile prod --add DigitalOceanyarn alchemy deploy --stage prod --profile prodMany stages can share a development team, each with its own resources.
Keys your runtimes get
Section titled “Keys your runtimes get”DigitalOcean signs no identity for a running App or Function, so a runtime can’t exchange one for access. Instead each binding creates a key that reaches only its resource and gives it to the runtime as a secret:
DigitalOcean.Spaces.GetObject(Uploads)creates a Spaces key withreadaccess to that one bucket, andPutObjectone withreadwrite.DigitalOcean.Functions.InvokeFunction(Resize)creates a Functions access key for that function’s namespace.DigitalOcean.GenAI.InvokeAgent(Support)creates an agent API key for that agent.
A few services can’t create narrower keys through the API: Serverless Inference takes a model access key you create in the control panel, and Sandboxes and Harness Runtime sessions take a token you pass. Those bindings take the value as Config.Redacted(...). See Secrets.
With CI=true, Alchemy skips the profile and reads the token from DIGITALOCEAN_TOKEN (or DIGITALOCEAN_ACCESS_TOKEN, then DIGITALOCEAN_API_KEY), and an optional Spaces key pair from SPACES_ACCESS_KEY_ID and SPACES_SECRET_ACCESS_KEY. Use a separate token for CI, so you can delete it without touching yours. See CI.
Values your runtimes read while they run, like a third-party API key, are covered in Secrets.