SDK Code Recipes
Common patterns and production examples using@qumo-deploy/sdk.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Production patterns for project provisioning, credential minting, relay discovery, and budget monitoring.
@qumo-deploy/sdk.
import { QumoClient } from "@qumo-deploy/sdk";
const client = new QumoClient({
baseUrl: "https://api.qumo.dev",
apiKey: process.env.QUMO_API_KEY!,
});
async function mintRelayToken() {
// Issue a short-lived token valid for 1 hour with relay session scope
const cred = await client.credentials.issue({
scopes: ["relay:session"],
ttl_seconds: 3600,
});
console.log("Token:", cred.token);
console.log("Expires at:", cred.expires_at);
// Read assigned edge relays and fallback hosts
if (cred.relays && cred.relays.length > 0) {
const primaryRelay = cred.relays[0];
console.log(`Connecting to relay: ${primaryRelay.url} (${primaryRelay.region})`);
}
}
mintRelayToken();
import { QumoClient } from "@qumo-deploy/sdk";
const client = new QumoClient({
baseUrl: "https://api.qumo.dev",
token: process.env.QUMO_TOKEN!,
});
async function createProjectEnvironment() {
// Create production project
const prodProject = await client.projects.create({
name: "streaming-app-prod",
environment: "production",
});
console.log(`Created prod project: ${prodProject.id}`);
// Create local relay test project
const testProject = await client.projects.create({
name: "streaming-app-test",
environment: "test",
});
console.log(`Created test project: ${testProject.id}`);
}
import { QumoClient } from "@qumo-deploy/sdk";
const client = new QumoClient({
baseUrl: "https://api.qumo.dev",
token: process.env.QUMO_TOKEN!,
});
async function setupCiBot(tenantId: string) {
// 1. Create a bot principal
const bot = await client.bots.create({
tenant_id: tenantId,
name: "github-actions-deployer",
description: "Automated deployment runner",
});
// 2. Grant project.admin IAM binding to the bot
await client.iam.grant({
role_id: "roles/project.admin",
member: `bot:${bot.id}`,
resource_type: "tenant",
resource_id: tenantId,
});
console.log(`Bot created and configured: bot:${bot.id}`);
}