← All blocks
Multi-language code example with output
code-example · explainer-tabbed-code · code-example-tabs
npx shadcn@latest add @plus-ui/code-example-tabsDefault content
{
"eyebrow": "Deployments",
"title": "Create a production deployment",
"description": "The same request from the CLI, the Node and Python SDKs, or plain HTTP. Every route authenticates with a token from `RIVET_TOKEN` and returns the deployment while it builds.",
"steps": [
"Rivetlane checks out `main` at its latest commit and reads `rivetlane.toml`.",
"The build runs with the `production` scope of your environment variables.",
"The deployment is returned immediately with `status: building`; poll it or stream logs with `rivet logs --follow`.",
"When the build passes, traffic moves to the new deployment with zero downtime."
],
"link": {
"label": "Deployments API reference",
"href": "#"
},
"labels": {
"languages": "Language",
"copy": "Copy",
"copied": "Copied"
},
"samples": [
{
"label": "CLI",
"file": "Terminal",
"language": "shell",
"code": "# Uses RIVET_TOKEN when set, otherwise your rivet login session\n$ rivet deploy --prod --project storefront",
"output": {
"label": "Output",
"language": "shell",
"code": "→ Building storefront@a41c9e2 (main)\n✓ Build completed in 38s\n✓ Deployed to production\n https://storefront.rivetlane.app\n dpl_7Hq2xKfR · 41s"
}
},
{
"label": "Node",
"file": "deploy.ts",
"language": "ts",
"code": "import { Rivetlane } from \"@rivetlane/sdk\"\n\nconst rivet = new Rivetlane({ token: process.env.RIVET_TOKEN })\n\nconst deployment = await rivet.deployments.create({\n project: \"storefront\",\n branch: \"main\",\n target: \"production\",\n})\n\nconsole.log(deployment.id, deployment.status)",
"output": {
"label": "Output",
"language": "shell",
"code": "dpl_7Hq2xKfR building"
}
},
{
"label": "Python",
"file": "deploy.py",
"language": "python",
"code": "import os\nfrom rivetlane import Rivetlane\n\nrivet = Rivetlane(token=os.environ[\"RIVET_TOKEN\"])\n\ndeployment = rivet.deployments.create(\n project=\"storefront\",\n branch=\"main\",\n target=\"production\",\n)\n\nprint(deployment.id, deployment.status)",
"output": {
"label": "Output",
"language": "shell",
"code": "dpl_7Hq2xKfR building"
}
},
{
"label": "curl",
"file": "Terminal",
"language": "shell",
"code": "$ curl https://api.rivetlane.dev/v1/deployments \\\n -H \"Authorization: Bearer $RIVET_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"project\": \"storefront\", \"branch\": \"main\", \"target\": \"production\"}'",
"output": {
"label": "Response",
"language": "json",
"code": "{\n \"id\": \"dpl_7Hq2xKfR\",\n \"project\": \"storefront\",\n \"branch\": \"main\",\n \"commit\": \"a41c9e2\",\n \"target\": \"production\",\n \"status\": \"building\",\n \"url\": \"https://storefront-a41c9e2.rivetlane.app\",\n \"created_at\": \"2026-10-09T14:02:11Z\"\n}",
"status": {
"code": 201,
"text": "Created"
}
}
}
]
}