Skip to main content
The banner shows the boxd.sh and Convex logos with the line composable computers on Convex. Convex is the open-source reactive backend for TypeScript apps, with a database, server functions, and live queries in one place. Components add packaged backend features to a Convex app. The boxd component is listed in the Convex components directory, and it lets your Convex functions create, fork, and run commands in boxd machines. The component keeps a row for every machine and every command it runs. Your UI subscribes to machine state and command output with a plain Convex query, and the query re-runs whenever a row changes.

Install the component

Create an API key and set it on your Convex deployment:
Then install the component in convex/convex.config.ts and bind the key into it:
convex/convex.config.ts
The key lives in the component’s own environment, so your functions never pass it as an argument. The component exchanges it for a session token once and reuses that token until it nears expiry.
Every boxd API key is fenced to one organization. Machines are created in that org and billed to it. In a brand-new Convex project, run npx convex dev once before setting the key, so there is a deployment to set it on.

Run machines from your functions

Calls that reach boxd run in actions, and reads run in queries:
convex/machines.ts
create and fork wait until the new machine accepts a command, and both return in under a second. A machine on standby or hibernated wakes by itself when it gets a command or an HTTPS request, so exec works without a resume first.

What the component can do

Errors arrive as a ConvexError with a stable code such as NOT_FOUND, CONFLICT, or RATE_LIMITED. Branch on the code with isBoxdError.

Scope machines to your users

Pass an ownerId on every call. A machine created with an ownerId is reachable only with that same ownerId. For any other owner, reads return null or an empty list, and actions fail with NOT_FOUND, the same as for a machine that does not exist. A fork inherits the owner of its source machine. For code you did not write, create the machine with isolated: true. Isolation removes the in-machine boxd CLI, the metadata endpoint, integrations, and agent logins, and keeps the machine out of the org’s default network. The machine keeps outbound internet unless you set an egress allowlist.

Limits

Convex stops an action after 10 minutes. exec kills its command after timeoutMs, which defaults to 9 minutes and goes up to 9.5. For longer work, start the command in the background with nohup ... & and check on it with later exec calls. exec returns up to 2 million characters per stream, and the execution row keeps the first 64,000. boxd can change a machine without a call through the component, for example when auto-suspend kicks in. Call refresh to bring that change into the row, for instance on a timer while a machine is on screen. The component ships as @boxd-sh/convex and is open source under the MIT license. The README covers the full API, the error codes, and testing with convex-test.