Yokai is a private control room for running OpenClaw inside Vercel Sandbox. It gives you a locked-down admin dashboard for booting, rotating, restoring, and observing a single OpenClaw runtime, while Convex persists credentials, state, snapshots, command history, and usage data.
- Private admin dashboard for a single OpenClaw runtime
- Convex-backed persistence for state, snapshots, sessions, and command history
- Request-driven sandbox rollover and recovery
- Production-safe secret masking and encryption at rest
- Bun-first Turborepo with a clean self-hosted setup path
| Feature | What you get |
|---|---|
| Sandbox control | Start, stop, and sync one OpenClaw sandbox from the dashboard |
| Recovery flow | Snapshot, handoff bundle persistence, and restore on the next reconcile |
| Secure admin access | First-run bootstrap, hashed passwords, protected routes, session cookies |
| Observability | Recent sessions, command output, usage snapshots, runtime status |
| Self-hosted setup | Local Bun workflow, Convex integration, Vercel-ready deployment path |
- Start, stop, and sync a single OpenClaw sandbox from one dashboard.
- Store the latest runtime state, snapshot metadata, command output, and session inventory in Convex.
- Auto-roll a sandbox before TTL expiry and restore from the latest Convex-backed handoff bundle.
- Lock down the UI with a bootstrap-once admin login and cookie-backed protected routes.
- Keep secrets masked in the UI and encrypted at rest before writing them to Convex.
- Bun
- Next.js 16 App Router
- React 19
- Convex
- Vercel Sandbox
- Biome
Browser
-> Next.js dashboard
-> Server Actions / API routes
-> Convex state + storage
-> Vercel Sandbox runtime
-> OpenClaw gateway
Yokai manages one active sandbox at a time. The dashboard is the control plane. Convex is the persistence layer. OpenClaw runs inside the sandbox, not in the Next.js process.
Add your own product screenshots here once your deployment is live.
README assets suggestion:
- docs/screenshots/dashboard-overview.png
- docs/screenshots/dashboard-activity.png
- docs/screenshots/dashboard-settings.png
Suggested captions:
- Overview: runtime state, latest snapshot, and recovery window
- Activity: tracked sessions and redacted command output
- Settings: sandbox behavior, allowlists, and gateway credentials
.
├── apps/web
│ ├── src/app # App Router pages, route handlers, server actions
│ ├── src/components # Dashboard UI
│ ├── src/lib # Auth, store, sandbox, gateway, security logic
│ ├── convex # Convex schema, validators, queries, mutations
│ ├── scripts # Local helpers such as Convex command wrappers
│ └── .env.example # Publish-safe environment template
├── turbo.json # Turborepo task graph
├── package.json # Workspace orchestration
└── README.md
- Bun 1.3+
- A Convex project
- A Vercel project for hosting the Next.js app
- Access to Vercel Sandbox in the target account
- Optional: an AI Gateway key if you want Gateway model discovery and credit reporting
- Optional: a scheduler for unattended sandbox rollover
- Install dependencies from the repo root.
bun install- Create your local environment file.
cp apps/web/.env.example apps/web/.env-
Fill in the required values in
apps/web/.env. -
Sync Convex from the active variables in
apps/web/.env.
bun run sync- Start the app.
bun run dev- Open
http://localhost:3000/loginand bootstrap the first admin account.
If no credentials exist yet, Yokai switches the login screen into setup mode and creates the first admin user. After that, the dashboard and /api/overview require a valid authenticated session.
- Deploy the app and connect it to a Convex project.
- Open
/loginand create the first admin account. - Save runtime settings such as Telegram token, timeout, and default model.
- Start the sandbox and wait for the OpenClaw gateway to become ready.
- Use
Sync Sessionsto pull the latest OpenClaw session inventory. - Enable auto-recreate and attach a scheduler if you want unattended rollover.
Create your own Git repository first. Do not deploy directly from someone else's working tree.
Create a Convex project and collect these values:
CONVEX_DEPLOYMENTNEXT_PUBLIC_CONVEX_URL
Set YOKAI_ENCRYPTION_KEY to a long random string and keep it stable across redeploys for the same environment. If you rotate it without migrating stored data, Yokai will not be able to decrypt existing encrypted settings.
For production, set:
NEXT_PUBLIC_APP_URLCONVEX_DEPLOYMENTNEXT_PUBLIC_CONVEX_URLYOKAI_ENCRYPTION_KEY
Recommended production variables:
CRON_SECRETYOKAI_ALLOWED_ORIGINS
Optional runtime variables:
AI_GATEWAY_API_KEY
Import the repository manually in Vercel. Add the production environment variables from the previous step before the first deploy.
Call:
GET /api/internal/sandbox-rollover
Authorization: Bearer <CRON_SECRET>
Without a scheduler, auto-recreate only runs when a dashboard request or overview refresh reaches the app.
Copy apps/web/.env.example to apps/web/.env for local work.
NEXT_PUBLIC_APP_URL=http://localhost:3000
CONVEX_DEPLOYMENT=
NEXT_PUBLIC_CONVEX_URL=
YOKAI_ENCRYPTION_KEY=YOKAI_ALLOWED_ORIGINS=
CRON_SECRET=AI_GATEWAY_API_KEY=YOKAI_ENCRYPTION_KEYis mandatory for encrypted settings stored in Convex.YOKAI_ALLOWED_ORIGINScontrols allowed origins for Next.js Server Actions.CRON_SECRETprotects the rollover endpoint in production.AI_GATEWAY_API_KEYenables Gateway model discovery and credit snapshots and can also be supplied later from the dashboard.
From the repo root:
bun install
bun run sync
bun run devUseful commands:
bun run build
bun run lint
bun run types
bun run check
bun run format
bun run startConvex workflows:
bun run convex
bun run sync
bun run deploy
bun run logs| Command | What it does |
|---|---|
bun run dev |
Start the Next.js app in development |
bun run start |
Start the production server after a build |
bun run build |
Build the web app for production |
bun run lint |
Run Biome checks for the web app |
bun run types |
Generate Next.js route types and run TypeScript checks |
bun run check |
Run lint and types together |
bun run format |
Format the repository with Biome |
bun run convex |
Start Convex dev watch mode with the active apps/web/.env values |
bun run sync |
Sync Convex once with the active apps/web/.env values |
bun run deploy |
Deploy Convex using the active apps/web/.env values |
bun run logs |
Read Convex logs using the active apps/web/.env values |
- Yokai is production-ready as a single-tenant admin surface, not a multi-tenant control plane.
- Protected pages and API routes require the admin session cookie.
- Secrets are encrypted before persistence and redacted from stored command output.
autoRecreateSandboxis request-driven. It is not a background daemon.- Recovery restores from the Convex-backed handoff bundle, not from the remote Vercel snapshot itself.
- If the latest backup bundle is missing or damaged, Yokai falls back to a clean boot.
- The dashboard refreshes live data every 15 seconds through the authenticated
/api/overviewendpoint. Start sandboxcreates a Vercel Sandbox, installs OpenClaw, writesopenclaw.json, and launches the gateway on port18789.Sync Sessionsfetches OpenClaw session data and appends runtime usage snapshots.- When auto-recreate is enabled, Yokai attempts lifecycle reconciliation on dashboard page loads, after settings saves that keep auto-recreate enabled, and through the rollover endpoint.
- If a running sandbox reaches its rollover window, Yokai snapshots it, stores the latest handoff bundle in Convex, starts a replacement sandbox, and then stops the previous one.
- If a sandbox is already gone, Yokai can recreate it from the latest valid backup on the next reconciliation request.
Convex stores:
states: dashboard settings, sandbox state, sessions, commands, usage, and operation leasesnapshots: latest snapshot metadata plus the storage reference for the handoff bundlecredentials: admin login and password hash metadatasessions: active admin sessions used for cookie validation
Sensitive settings such as bot tokens and gateway keys are encrypted before they are written to Convex.
- The first login flow bootstraps exactly one admin credential set.
- Passwords are salted and hashed before storage.
- Session cookies are
httpOnlyandsameSite=lax. - API responses are sent with
Cache-Control: private, no-store, max-age=0. - Security headers are configured in
next.config.ts.
No. The current design is intentionally single-runtime and manages one active OpenClaw sandbox at a time.
No. Reconciliation is request-driven. For unattended rollover, add a scheduler that calls /api/internal/sandbox-rollover.
No. You still need to configure Convex and the required environment variables before the deployment is actually usable.
No. Sensitive settings are encrypted before they are written to Convex, and command output is redacted before it is stored in the activity feed.
Yes. The dashboard still works, but Gateway model discovery and credit reporting fall back to reduced behavior.
Commit apps/web/.env.example only. Keep real credentials in apps/web/.env, which is gitignored.
- Forked or copied into your own repository
- Convex deployment created
- Required environment variables set
- Stable
YOKAI_ENCRYPTION_KEYsaved - Production URL set in
NEXT_PUBLIC_APP_URL CRON_SECRETset for production- Scheduler configured if unattended rollover is required
- First admin account bootstrapped through
/login