Skip to content

TypeScript SDK Reference

The Synodes TypeScript SDK provides a powerful interface for programmatically interacting with Synodes Sandboxes.

Installation

Install the Synodes TypeScript SDK using npm:

Terminal window
npm install @synodesio/sdk

Or using yarn:

Terminal window
yarn add @synodesio/sdk

Getting Started

Here’s a simple example to help you get started with the Synodes TypeScript SDK:

import { Synodes } from '@synodesio/sdk';
async function main() {
// Initialize the SDK (uses environment variables by default)
const synodes = new Synodes();
// Create a new sandbox
const sandbox = await synodes.create({
language: 'typescript',
envVars: { NODE_ENV: 'development' }
});
// Execute a command
const response = await sandbox.process.executeCommand('echo "Hello, World!"');
console.log(response.result);
}
main().catch(console.error);

Configuration

The SDK can be configured using environment variables or by passing options to the constructor:

import { Synodes } from '@synodesio/sdk';
// Using environment variables (SYNODES_API_KEY, SYNODES_API_URL, SYNODES_TARGET)
const synodes = new Synodes();
// Using explicit configuration
const synodes = new Synodes({
apiKey: 'your-api-key',
apiUrl: 'https://app.synodes.io/api',
target: 'us'
});