Skip to content

gethoststack/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@hoststack.dev/sdk

Official TypeScript SDK for HostStack — the European PaaS for deploying web services, databases, cron jobs, and domains on Hetzner infrastructure.

Think Render.com, but hosted in Europe, built for developers who care about latency and data residency.

npm version npm downloads MIT license

Installation

npm install @hoststack.dev/sdk
# or
bun add @hoststack.dev/sdk
# or
pnpm add @hoststack.dev/sdk

Requires Node.js 18+ (uses native fetch). Works in Bun and Deno too.

Quick start

import { HostStack } from '@hoststack.dev/sdk';

const client = new HostStack({
	apiKey: 'hs_live_your_api_key',
});

const teamId = 1;

// List your services
const { services } = await client.services.list(teamId);

// Trigger a deploy
const { deploy } = await client.deploys.trigger(teamId, 'svc_abc123');

// Stream runtime logs
const ac = new AbortController();
for await (const entry of client.services.streamLogs(teamId, 'svc_abc123', { signal: ac.signal })) {
	console.log(entry.timestamp, entry.message);
}

Generate an API key from your HostStack dashboard → Settings → API Keys.

Resources

Resource Methods
client.projects list, get, create, update, delete
client.services list, get, create, update, delete, suspend, resume, getMetrics, getConfig, updateConfig, getRuntimeLogs, streamLogs
client.deploys list, get, trigger, cancel, rollback, getLogs
client.databases list, get, create, update, delete, suspend, resume, getCredentials, resetPassword
client.domains list, add, update, remove, verify
client.envVars list, create, update, delete, bulkSet
client.cron list, get, trigger

Every method's first argument is teamId: number. Full API reference: hoststack.dev/docs/sdk.

Error handling

import {
	HostStack,
	AuthenticationError,
	NotFoundError,
	RateLimitError,
	HostStackError,
} from '@hoststack.dev/sdk';

try {
	await client.services.get(teamId, 'svc_missing');
} catch (err) {
	if (err instanceof NotFoundError) {
		// 404
	} else if (err instanceof AuthenticationError) {
		// 401/403
	} else if (err instanceof RateLimitError) {
		// 429 — err.retryAfter is seconds to wait
	} else if (err instanceof HostStackError) {
		// any other API error — err.status, err.body
	}
}

Related packages

Support

License

MIT © HostStack Contributors

About

Official TypeScript SDK for HostStack — deploy and manage web services, databases, cron jobs, and domains on European infrastructure.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors