Benchmarked
Northflank
Last updated
Was this helpful?
Was this helpful?
npm install @computesdk/northflankNORTHFLANK_TOKEN=your_api_token
NORTHFLANK_PROJECT_ID=your_project_idimport { northflank } from '@computesdk/northflank';
const compute = northflank({
token: process.env.NORTHFLANK_TOKEN!,
projectId: process.env.NORTHFLANK_PROJECT_ID!,
});
// Create sandbox
const sandbox = await compute.sandbox.create();
// Run a command
const result = await sandbox.runCommand('echo "Hello from Northflank!"');
console.log(result.stdout); // "Hello from Northflank!"
// Clean up
await sandbox.destroy();interface NorthflankConfig {
/** Northflank API token (required) */
token: string;
/** Northflank project ID that services are created in (required) */
projectId: string;
/** Northflank team ID (optional) */
teamId?: string;
/** Override the API base URL - defaults to "https://api.northflank.com" */
host?: string;
/** Prefix for generated service names - defaults to "computesdk-" */
servicePrefix?: string;
/** Container image - defaults to the image for the selected runtime (node:20-slim / python:3.11-slim) */
image?: string;
/** Runtime label - defaults to "node" */
runtime?: string;
/** Northflank deployment plan - defaults to "nf-compute-50" */
deploymentPlan?: string;
/** Ports to expose on create - a number or a { name, internalPort, public?, protocol? } object */
ports?: (number | { name: string; internalPort: number; public?: boolean; protocol?: 'HTTP' | 'HTTP/2' | 'TCP' | 'UDP' })[];
/** Time to wait for the container to become exec-ready, in ms - defaults to 120000 */
timeout?: number;
/** Deploy from a Northflank build service instead of an external image */
internalDeployment?: {
/** Build service ID inside the same Northflank project */
id: string;
/** Branch to deploy from - defaults to "main" */
branch?: string;
/** Build SHA to deploy - defaults to "latest" */
buildSHA?: string;
};
}