cloudrundocs

Self-hosting

Run your own cloudrun — prerequisites, environment, and first boot.

Self-hosting

cloudrun is MIT licensed and runs on your own infrastructure. It's a Next.js app plus Postgres; the agents themselves run on boxes it provisions.

What you'll need

  • Node 22+ and pnpm
  • Postgres — any instance you can reach
  • Clerk — auth, organizations, and roles
  • Upstash Box — where each project's agent runs
  • Model keys are optional — fresh agents start on Hermes' anonymous free tier, and every user connects their own providers in the app

Install

git clone https://github.com/shawnxman1423/openbrain.git
cd openbrain/openbrain
pnpm install

Create openbrain/.env, then:

pnpm db:push     # sync the schema to your Postgres
pnpm dev         # http://localhost:3000

Next loads .env automatically.

Environment

Set the variables for the features you use.

Database

DATABASE_URL=postgres://...

Auth (Clerk)

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
CLERK_WEBHOOK_SIGNING_SECRET=

Boxes (Upstash)

UPSTASH_BOX_API_KEY=
UPSTASH_BOX_HERMES_SNAPSHOT_ID=   # the baked runtime snapshot

Integrations (optional)

OPENBRAIN_COMPOSIO_KEY=   # powers the Integrations panel (Composio)

Your origin — so social cards and absolute URLs point at you, not us

NEXT_PUBLIC_APP_URL=https://your-domain.example

The runtime snapshot

UPSTASH_BOX_HERMES_SNAPSHOT_ID points at a prebuilt image with the agent runtime already installed. Provisioning restores it instead of installing from scratch, which is the difference between a project starting in a minute and a project starting in half an hour.

To bake your own — needed when you want a newer agent version than the default:

pnpm hermes:bake          # ~35 min, prints a new snapshot id

Put the printed id in .env. The script verifies the result before snapshotting (runtime version, dashboard build, browser launch) so a broken image fails the bake instead of shipping.

Baking creates a real box and deletes it when it succeeds. If it fails it deliberately leaves the box running so you can inspect the logs — delete it yourself afterward.

Useful commands

pnpm dev / build / start
pnpm typecheck                 # tsc --noEmit
pnpm lint / format
pnpm db:generate / db:migrate / db:push / db:studio
pnpm db:seed                   # seed the content we ship
pnpm hermes:api                # regenerate the runtime API client
pnpm hermes:bake               # bake a runtime snapshot

On this page