Northflank

A sandbox per Northflank deployment service. The services platform, driven through @northflank/js-client — a sleep-infinity container you exec into.

Installation

@northflank/js-client is an optional peer dependency of sbox-sdk, loaded lazily on first use.

pnpm add sbox-sdk @northflank/js-client

Usage

import { createSandboxClient } from "sbox-sdk";
import { northflank } from "sbox-sdk/northflank";

const client = createSandboxClient({
  provider: northflank({
    token: process.env.NORTHFLANK_TOKEN!,
    projectId: "my-project", // must already exist
  }),
});

const sandbox = await client.create({ template: "ubuntu:22.04" });
const res = await sandbox.commands.run("echo hi && ls /");
console.log(res.stdout);

await sandbox.pause(); // scale to zero — volume kept, compute billing stops

A sandbox is a deployment service that runs the base template image with a sleep infinity keep-alive command, so you can exec into it. create() waits (best-effort) for the service to reach running before returning.

Node-only: the SDK streams exec output over Node EventEmitters, which the adapter buffers. exec has no per-command cwd/env, so the core folds those into a cd … && KEY=v … wrapper (perCommandEnvCwd: false) and streaming is emulated. Files are read and written via exec + base64. pause() scales the service to zero (volume retained, memory lost); destroy() deletes the service and its child objects.

Authentication

An API token + the project the sandbox services live in.

Authentication variables for the northflank adapter.
OptionEnv varRequiredDescription
tokenNORTHFLANK_TOKENrequiredNorthflank API token.
projectIdrequiredProject the sandbox services are created in.
deploymentPlanoptionalCompute plan for new sandboxes (default "nf-compute-200").
imageoptionalDefault base image (default "ubuntu:22.04").
ephemeralStorageMBoptionalEphemeral storage in MB for new sandboxes (default 2048).

Options

Prop

Type

Capabilities

CapabilityLevelNotes
listnative
pausenativescale-to-zero (volume kept)
streamingemulatedexec session is buffered
filesUploadnativevia exec + base64
exposePortnativepublic service port → DNS
codeInterpreterunsupported
stop / setTimeoutunsupportedpause is the keep-disk state
snapshot / forkunsupportedservices platform, no VM snapshots

perCommandEnvCwd is false (core wraps); preservesMemoryOnPause is false; previewModel is subdomain.

On this page