Concepts
Organizations and projects
An organization holds its members and its projects. A project is one app, with its own dev, staging, prod and preview environments, and its own deployments, keys, schedules and queues.
On this page
The model#
| Layer | What it holds |
|---|---|
| Organization | Its members, each an owner or a member, and its projects. |
| Project | One app. Its ref is proj_ and 20 lower case letters and digits. An organization can have any number. |
| Environment | dev, staging, prod and preview/<branch>, in each project. Each has its own current deployment, variables, API keys, schedules and queues. See Environments. |
A person is known by their email. An owner invites and removes members and creates projects. A member uses the organization's projects. An organization always keeps at least one owner.
Environment names#
A project's environments are named by its ref and their slug, such as proj_0123456789abcdefghij:prod or proj_0123456789abcdefghij:preview/feat-x. That full slug is the environment a run carries.
- An API key may name its own environment by its short slug, such as
"environment": "prod", or by its full one. - A task sees the short slug,
prodorpreview/<branch>, inctx.environment.slugand inBOKJOY_ENVIRONMENT, as on Trigger.dev. - Projects never share runs or keys. A run ID that a trigger with
scope: 'environment'derives comes from the full slug, so two projects never derive the same child. - Queue names are per environment, so two projects can each have a
db-writersqueue without sharing its limit. - A preview inherits its own project's
stagingvariables.
Who reaches what#
| Credential | Reaches |
|---|---|
Environment API key, bjk_... | Its own environment's runs, schedules and queues. See API keys. |
Personal access token, bju_... | What its person reaches: the environments, variables, API keys, runs and schedules of their organizations' projects. Use it with the HTTP API and the CLI. |
| Public access token | The runs it names, in a browser. See Realtime in the browser. |
Anything else answers 404, the same as something that does not exist: a key from one project on another project's run, or a member on another organization's project.
- Access is read on every request. Removing a member takes effect on their next request, with their tokens too.
- Open run streams are checked on every ping, every 15 seconds. A stream closes with code 1008 and
access revokedonce its person is removed from the run's organization, or its personal access token or API key is revoked.
With a personal access token in DC_API_TOKEN, the CLI acts as you, in your organizations' projects:
export DC_API_TOKEN=bju_...durable-compute projects listdurable-compute orgs invite acme dev@acme.com --role memberdurable-compute projects create acme web --name "Web"durable-compute api-keys create --env proj_0123456789abcdefghij:prod --name "web app"A new project gets its dev, staging and prod environments at once.
Projects share the workers fairly#
Each free worker slot goes to the project holding the fewest slots at that moment, and between projects with the same count, to the one whose oldest waiting run is oldest. So a project that floods its queues holds another project's next run back by at most the time one of its own runs takes to end. When only one project has work waiting, it gets every slot.
Inside a project, runs start in the order they became ready, across its environments, as they do in a project on its own.
A project's concurrency limit#
A project can have a concurrency limit: at most that many of its runs execute at once, over all its environments and queues. It is Trigger.dev's environment concurrency limit, held for the whole project. Runs past it wait, and other projects' runs are not affected. A run counts while it holds a queue slot, by the same rule as queue limits. Queue limits still apply inside the project.
A project has no limit unless one is set. A lowered limit applies to runs already waiting, and runs already going keep going.