Skip to content

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.

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.

src/project.ts
import * as DigitalOcean from "@alchemy.run/digitalocean";
export const Shop = DigitalOcean.Project("Shop", { description: "The shop's resources" });

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:

Terminal window
pnpm alchemy profile edit --add DigitalOcean

The 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.

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:

Terminal window
pnpm alchemy profile create prod
pnpm alchemy profile edit --profile prod --add DigitalOcean
pnpm alchemy deploy --stage prod --profile prod

Many stages can share a development team, each with its own resources.

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 with read access to that one bucket, and PutObject one with readwrite.
  • 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.