LogoFreestyle

Integrations

Pre-built packages that extend your VMs with languages, databases, browsers, and more.

Integrations are composable packages that extend your VMs with additional capabilities. They handle installation, configuration, caching, and expose convenient helper methods. Use them to add language runtimes, databases, headless browsers, third-party services, and more.

You can add as many integrations as you need to a single VM.

Available Integrations

IntegrationPackageDescription
Node.js@freestyle-sh/with-nodejsJavaScript/TypeScript runtime via NVM
Python@freestyle-sh/with-pythonPython 3 runtime
Bun@freestyle-sh/with-bunFast JavaScript runtime and toolkit
Ruby@freestyle-sh/with-rubyRuby runtime via RVM
uv@freestyle-sh/with-uvFast Python package management and runtime
Java@freestyle-sh/with-javaJava runtime via Amazon Corretto

Usage

Add integrations using the with property when creating a VM:

import { freestyle } from "freestyle-sandboxes";
import { VmNodeJs } from "@freestyle-sh/with-nodejs";

const { vm } = await freestyle.vms.create({
  with: {
    js: new VmNodeJs(),
  },
});

// Use the integration's helper methods
const res = await vm.js.runCode({
  code: 'console.log(JSON.stringify({ hello: "world" }))'
});

console.log(res.result); // { hello: "world" }

Caching

Integrations are automatically cached. The first VM with a specific integration configuration takes longer while the environment is built. Subsequent VMs with the same configuration start instantly.

Multiple Integrations

You can combine as many integrations as you need in a single VM:

import { VmNodeJs } from "@freestyle-sh/with-nodejs";
import { VmPython } from "@freestyle-sh/with-python";
import { VmBun } from "@freestyle-sh/with-bun";

const { vm } = await freestyle.vms.create({
  with: {
    node: new VmNodeJs(),
    python: new VmPython(),
    bun: new VmBun(),
  },
});

// Each integration is available on the vm object
await vm.node.runCode({ code: 'console.log("Node.js")' });
await vm.python.runCode({ code: 'print("Python")' });
await vm.bun.runCode({ code: 'console.log("Bun")' });

Custom Integrations

You can create your own integrations by extending the VmWith class. See Custom Integrations for details.

On this page

Freestyle AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details with the official documentation.

How can I help?

Ask me about Freestyle while you browse the docs.