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-sdkOr with yarn:
yarn add @labring/devbox-sdkOr with pnpm:
pnpm add @labring/devbox-sdkKubernetes 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/kubeconfigOption 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
- Read the Quick Start Guide
- Learn about Configuration