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
| Integration | Package | Description |
|---|---|---|
| Node.js | @freestyle-sh/with-nodejs | JavaScript/TypeScript runtime via NVM |
| Python | @freestyle-sh/with-python | Python 3 runtime |
| Bun | @freestyle-sh/with-bun | Fast JavaScript runtime and toolkit |
| Ruby | @freestyle-sh/with-ruby | Ruby runtime via RVM |
| uv | @freestyle-sh/with-uv | Fast Python package management and runtime |
| Java | @freestyle-sh/with-java | Java 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.