@cargo-ai/cdk) lets you describe a whole Cargo workspace in
TypeScript and deploy it like infrastructure-as-code — the same model as Pulumi
or the AWS CDK, but for Cargo resources.
You write define* calls; the CDK figures out the dependency order, creates or
updates each resource, and records what it made in a committed cargo.state.json
so the next deploy only changes what changed.
Define resources
Every Cargo resource has a
define* builder. Wire them together by passing
one resource’s token into another.Deploy
plan, deploy, --prune, --refresh, import and destroy — the full
reconcile lifecycle.State & drift
How
cargo.state.json works, the lock file, and detecting changes made
outside the CDK.CLI
The CDK ships as
cargo-ai cdk in the Cargo CLI.Install
A first workspace
Create a directory and add a resource file. Importing a file is registration — there’s no manifest to maintain.my-workspace/contacts.ts
How it works
- Handles & tokens.
define*returns a handle whose outputs (uuid,datasetUuid,url, …) are deferred tokens. Passing a token into another resource is what creates a dependency edge — the dependency graph is just your variable graph. - State. Every deploy writes
cargo.state.json(commit it). It’s the authoritative link from a code resource to the real uuid Cargo assigned it. - Idempotent. Each resource is content-hashed; a re-deploy with no code changes is a no-op. Change one resource and only it updates.

