Devbox SDK
Getting started

Installation

Install and configure Devbox SDK

Installation

Requirements

  • Node.js >= 22.0.0
  • npm >= 11.0.0 (or yarn/pnpm)
  • Kubernetes cluster access - You need access to a Kubernetes cluster with Devbox API
  • Kubeconfig - Kubernetes configuration file or environment variable

Install the Package

npm install @labring/devbox-sdk

Or with yarn:

yarn add @labring/devbox-sdk

Or with pnpm:

pnpm add @labring/devbox-sdk

Kubernetes Configuration

Devbox SDK requires Kubernetes cluster access. You need to provide your Kubernetes configuration in one of the following ways:

Option 1: Environment Variable

export KUBECONFIG=/path/to/your/kubeconfig

Option 2: File Path

import { DevboxSDK } from '@labring/devbox-sdk'

const sdk = new DevboxSDK({
  kubeconfig: '/path/to/your/kubeconfig'
})

Option 3: Kubeconfig Content

import { DevboxSDK } from '@labring/devbox-sdk'
import fs from 'fs'

const kubeconfigContent = fs.readFileSync('/path/to/kubeconfig', 'utf-8')

const sdk = new DevboxSDK({
  kubeconfig: kubeconfigContent
})

Verify Installation

Create a simple test file to verify your installation:

import { DevboxSDK } from '@labring/devbox-sdk'

const sdk = new DevboxSDK({
  kubeconfig: process.env.KUBECONFIG
})

// Test connection
const devboxes = await sdk.listDevboxes()
console.log(`Found ${devboxes.length} devboxes`)

await sdk.close()

TypeScript Support

Devbox SDK is written in TypeScript and includes full type definitions. No additional @types package is needed.

If you're using TypeScript, make sure your tsconfig.json includes:

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "ES2022",
    "moduleResolution": "node"
  }
}

Next Steps

On this page