Developer Platform

TypeScript SDK

Build and automate StrataGateway infrastructure using a typed, developer-friendly TypeScript interface.

Planned

Development Preview

The StrataGateway TypeScript SDK is currently planned and is not yet publicly available. Package names, methods, resource types, authentication behavior, and SDK interfaces may change before release.

Jump to article

Overview

The StrataGateway TypeScript SDK is intended to provide a typed interface over the StrataGateway REST API, enabling infrastructure automation with first-class TypeScript support.

First-class TypeScript support
Strongly typed request and response models
Async/await workflows
Infrastructure automation
Node.js compatibility
Predictable resource interfaces
API parity with core platform functionality

The StrataGateway TypeScript SDK is currently planned and is not yet publicly available. Package names, methods, resource types, authentication behavior, and SDK interfaces may change before release.

Planned installation

The SDK is not yet published to npm. The command below illustrates the planned installation method.

Planned

Illustrative package name

Install (illustrative)

Install (illustrative)Bash
npm install @stratagateway/sdk

Important: The final package name and distribution method will be confirmed before public release.

Planned

Status: Planned

Client setup

Initialize the SDK client with your API token. The example below uses the planned preview syntax.

Preview

Preview syntax

Client initialization (preview)

Client initialization (preview)TypeScript
import { StrataGateway } from "@stratagateway/sdk";

const strata = new StrataGateway({
  token: process.env.STRATA_API_TOKEN,
});

Note: This syntax is illustrative. The final SDK may use a different instantiation pattern. Do not assume the package currently resolves from npm.

Authentication

The SDK is expected to use the same API token authentication model as the REST API.

Set your API token via the STRATA_API_TOKENenvironment variable and pass it to the client.

Authentication via environment variable

Authentication via environment variableTypeScript
import { StrataGateway } from "@stratagateway/sdk";

const strata = new StrataGateway({
  token: process.env.STRATA_API_TOKEN,
});

Security

Never hardcode API tokens directly into source code or commit them to version control. Use environment variables or a secrets manager.

See Authentication for the API token model.

Creating an instance

Provision a new compute instance using the planned instances resource. The example below uses illustrative SDK API syntax.

Preview

Illustrative SDK API

Create instance (preview)

Create instance (preview)TypeScript
const instance = await strata.instances.create({
  name: "web-prod-01",
  region: "fra-1",
  plan: "compute-standard",
  image: "ubuntu-24.04-lts",
  sshKeys: ["key_8f3a9b1c"],
});

console.log(instance.id);

Illustrative result

Illustrative response

Illustrative responseJSON
{
  id: "inst_7a91c2",
  name: "web-prod-01",
  status: "provisioning",
  region: "fra-1"
}

Provisioning is expected to be asynchronous. The initial response returns a provisioning status. Final provisioning times are not yet defined and may vary by region, plan, and platform load.

Listing instances

List all instances or retrieve a single instance by its identifier.

List all instances

List instances

List instancesTypeScript
const instances = await strata.instances.list();

for (const instance of instances.data) {
  console.log(instance.name, instance.status);
}

Get a single instance

Get instance

Get instanceTypeScript
const instance = await strata.instances.get("inst_7a91c2");

Exact response types are not finalized.

Working with networks

Create and manage private networks using the planned networks resource.

Preview

Preview syntax

Create network (preview)

Create network (preview)TypeScript
const network = await strata.networks.create({
  name: "production-private",
  region: "fra-1",
  cidr: "10.10.0.0/24",
});

See Networking for the network resource model.

Working with firewalls

Create and manage firewall policies using the planned firewalls resource.

Preview

Preview syntax

Create firewall (preview)

Create firewall (preview)TypeScript
const firewall = await strata.firewalls.create({
  name: "web-production",
  rules: [
    {
      direction: "inbound",
      protocol: "tcp",
      port: "443",
      source: "0.0.0.0/0",
      action: "allow",
    },
  ],
});

See Firewalls for the firewall policy model.

SSH keys

Manage SSH keys for instance access using the planned SSH keys resource.

Preview

Preview syntax

Add SSH key (preview)

Add SSH key (preview)TypeScript
const key = await strata.sshKeys.create({
  name: "Personal Laptop",
  publicKey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI...",
});

Security note: The SDK must only receive public SSH key material. Private keys must remain on the user's trusted device.

See SSH Keys for the key management model.

Error handling

Illustrative TypeScript error handling pattern:

Try/catch example

Try/catch exampleTypeScript
try {
  await strata.instances.get("inst_example");
} catch (error) {
  console.error(error);
}

A planned typed error class concept:

Planned

In Development

Planned StrataError concept

Planned StrataError conceptTypeScript
class StrataError extends Error {
  code: string;
  message: string;
  requestId: string;
  status: number;

  constructor(code: string, message: string, requestId: string, status: number) {
    super(message);
    this.name = "StrataError";
    this.code = code;
    this.requestId = requestId;
    this.status = status;
  }
}

Possible properties:

code
message
requestId
status

The final SDK error hierarchy is still being designed.

Type safety

The SDK is intended to provide comprehensive TypeScript definitions for:

Typed resource identifiers (e.g., <code className="rounded bg-card px-1.5 py-0.5 font-mono text-xs">InstanceId</code> vs string)
Typed create/update request payloads
Typed API response models
Autocomplete for resource methods and properties
Compile-time feedback for API changes
Easier SDK discovery through IDE integration

Illustrative type definition:

Preview

Illustrative

Illustrative InstanceStatus type

Illustrative InstanceStatus typeTypeScript
type InstanceStatus =
  | "provisioning"
  | "running"
  | "stopped"
  | "rebuilding"
  | "deleting"
  | "error";

Async operations

Infrastructure operations such as provisioning, rebuilding, and deleting are expected to be asynchronous. The SDK is planned to return an initial response with a provisioning status.

Async provisioning pattern

Async provisioning patternTypeScript
const instance = await strata.instances.create({...});

console.log(instance.status);
// "provisioning"

Do not assume specific polling intervals or provisioning time guarantees. Final SDK helpers for waiting/polling are still under design.

Environment variables

The SDK is expected to respect the following environment variable:

Environment variable

Environment variableBash
STRATA_API_TOKEN=your_token_here

Node.js usage:

Node.js environment access

Node.js environment accessTypeScript
const token = process.env.STRATA_API_TOKEN;

REST API relationship

The TypeScript SDK is intended to provide typed abstractions over the same platform API used by the REST API, CLI, and other tooling.

Architecture layer

Architecture layertext
TypeScript Application
→ StrataGateway SDK
→ REST API
→ StrataGateway Control Plane

See REST API for the underlying HTTP resource model.

Was this page helpful?