SDKs
JavaScript / TypeScript
Official Deployzy SDK for Node.js and TypeScript.
Install
npm install deployzy-sdkQuick start
import { Deployzy } from 'deployzy-sdk';const client = new Deployzy({ authtoken: 'sm_live_...' });const tunnels = await client.tunnels.list();const requests = await client.inspect.list(tunnels[0].url);const result = await client.inspect.replay(tunnels[0].url, requests[0].id);Live traffic streaming
const stream = client.inspect.subscribe('https://myapp.deployzy.app');for await (const req of stream) { console.log(`${req.method} ${req.path} -> ${req.statusCode}`);}stream.close();Deploy a project
// Build from a GitHub repo (or pass { image: 'nginx:alpine' } to run a prebuilt image)const project = await client.projects.create({ name: 'api', subdomain: 'api', repo: 'you/api', env: { NODE_ENV: 'production' },});await client.projects.deploy(project.id);const final = await client.projects.waitForDeploy(project.id);console.log(final.status); // "running" or "failed"const projects = await client.projects.list();await client.projects.logs(project.id);API keys
const keys = await client.apiKeys.list();const { apiKey, info } = await client.apiKeys.create('my-app');await client.apiKeys.delete(info.id);Domains
const { domain, instructions } = await client.domains.create('api.example.com');await client.domains.verify(domain.id);const all = await client.domains.list();Error handling
import { AuthError, RateLimitError, ApiError } from 'deployzy-sdk';try { await client.tunnels.list();} catch (err) { if (err instanceof AuthError) { /* bad token */ } if (err instanceof RateLimitError) { /* retry in err.retryAfter seconds */ } if (err instanceof ApiError) { /* err.statusCode, err.message */ }}Custom API URL
const client = new Deployzy({ authtoken: 'sm_live_...', serverUrl: 'https://api.deployzy.com', // the default});Was this page helpful?
