VSKI SDK
- TypeScript 99.6%
- Shell 0.4%
| .zed | ||
| cmd | ||
| dist | ||
| docs | ||
| src | ||
| .env.example | ||
| .gitattributes | ||
| .gitignore | ||
| .npmrc | ||
| AGENTS.md | ||
| build.ts | ||
| deno.json | ||
| deno.lock | ||
| exports.ts | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| TODO.md | ||
| tsconfig.json | ||
@vski/sdk
A runtime-agnostic TypeScript SDK for the VSKI RocketBase platform.
Features
- Database operations (CRUD, bulk operations)
- Realtime subscriptions via WebSocket
- Durable workflows with retries and signals
- Authentication (users and admins)
- Schema migrations
- CLI tool for database management
Installation
npm install @vski/sdk --registry=https://vski.sh/api/packages/x/npm/
Or configure .npmrc:
@vski:registry=https://vski.sh/api/packages/x/npm/
Then:
npm install @vski/sdk
Quick Start
import { VskiClient } from "@vski/sdk";
const client = new VskiClient("http://localhost:3001");
// Authenticate
await client.admins.authWithPassword("admin@example.com", "password");
Database Operations
const posts = client.collection("posts");
// Create
const record = await posts.create({ title: "Hello", content: "World" });
// List with filter
const { items } = await posts.getList(1, 30, {
filter: 'status = "published"',
expand: "author",
});
// Update
await posts.update(record.id, { status: "published" });
// Delete
await posts.delete(record.id);
// Bulk
await posts.bulkUpdate(["id1", "id2"], { status: "archived" });
Realtime
const unsub = client.collection("messages").subscribe((event) => {
console.log(event.action, event.record);
});
unsub();
Durable Workflows
Functional Style
import { step, workflow } from "@vski/sdk";
const notify = step("notify", async (email: string) => {
return await sendEmail(email, "Welcome!");
});
workflow("welcome").run(async (ctx, email: string) => {
await ctx.sleep("1h");
await notify(email);
const signal = await ctx.waitForSignal("confirm");
return { confirmed: signal.success };
});
Class-Based Style
import { Step, Workflow, WorkflowBase } from "@vski/sdk";
@Workflow("order")
class OrderWorkflow extends WorkflowBase {
@Step("pay", { retries: 3 })
async pay(amount: number) {
return await stripe.charge(amount);
}
async run(orderId: string, amount: number) {
await this.pay(amount);
}
}
Worker
import { WorkflowWorker } from "@vski/sdk";
const worker = new WorkflowWorker(client);
await worker.start("welcome");
Trigger
const run = await client.workflow.trigger("welcome", ["user@example.com"]);
await client.workflow.sendSignal(run.runId, "confirm", { success: true });
CLI
deno install --global -A -n vski cmd/cli/main.ts
Commands:
vski login # Log in as admin
vski db list # List databases
vski db create <name> # Create database
vski db delete <name> # Delete database
vski db generate # Generate migration from schema
vski migrate <file> # Run migrations
vski migrations # List applied migrations
vski status # Migration status
Tests & Coverage
Tests and coverage are available in the parent repository: https://vski.sh/x/platform
License
VSKI License - Copyright (c) 2025 Anton A Nesterov