Closed source / proprietary. Hosted AI coding sandboxes product.
cloud-infra/
├── apps/
│ ├── web/ # Next.js site + dashboard → Vercel
│ ├── gateway/ # Sandbox control plane → Railway / Coolify
│ └── mobile/ # Flutter console + first-party daemon chat
├── package.json # root scripts only (not a workspace hoist)
└── vercel.json # fallback if Root Directory is not set
- Import this GitHub repo (
iotserver24/cloud-infra). - Root Directory:
apps/web(recommended). - Framework: Next.js (auto-detected).
- Install / build: uses
apps/web/vercel.json(npm ci+npm run build). - Env vars from
apps/web/.env.example:
| Variable | Notes |
|---|---|
MONGODB_URI |
Atlas connection string |
MONGODB_DB |
vectra_cloud |
AUTH_SECRET |
long random string |
XIBECODE_SANDBOX_GATEWAY_URL |
public HTTPS gateway URL |
XIBECODE_GATEWAY_TOKEN |
same secret as gateway |
PUBLIC_BASE_URL |
public site origin (Telegram wake) |
POLLINATIONS_APP_KEY |
Pollinations BYOP App Key (pk_…) — server only |
CRON_SECRET |
auth for /api/cron/arm-telegram-wake (required on Vercel) |
E2B_LIFECYCLE_WEBHOOK_SECRET |
optional but recommended; E2B lifecycle → arm TG wake on pause |
RAZORPAY_KEY_ID / RAZORPAY_KEY_SECRET |
server keys |
NEXT_PUBLIC_RAZORPAY_KEY_ID |
client key |
RAZORPAY_WEBHOOK_SECRET |
Razorpay dashboard webhook secret |
BILLING_PRICE_INR |
e.g. 399 (rupees) |
BILLING_PRICE_USD |
e.g. 4.59 (dollars) |
BILLING_PERIOD_DAYS |
e.g. 30 |
Production example:
XIBECODE_SANDBOX_GATEWAY_URL=https://your-gateway.up.railway.app
XIBECODE_GATEWAY_TOKEN=same-as-gateway
PUBLIC_BASE_URL=https://your-app.vercel.appRazorpay webhook URL:
https://your-app.vercel.app/api/billing/webhook
Follows E2B auto-resume:
Sandbox.create({
timeoutMs: 15 * 60 * 1000, // default idle; override XIBECODE_E2B_SANDBOX_TIMEOUT_MS
lifecycle: { onTimeout: "pause", autoResume: true }, // full memory snapshot
});Activity that wakes a paused sandbox (docs):
gateway SDK ops (commands.run, files) or HTTP traffic to a service inside the VM
(public URL).
Preferred Telegram path (custom template wake HTTP, not the bot):
Telegram setWebhook → https://8788-{sandboxId}.e2b.app/telegram
DM → E2B auto-resumes paused VM → /opt/vectra/wake-http (template)
→ restarts xibecode daemon long-poll (bot code unchanged)
Bake wake-http into xibecode-full-sandbox (sandbox/e2b-template/wake-http).
Dashboard save sets the webhook URL when Telegram is configured.
Legacy: host Vercel wake webhook + long-poll (if no sandbox wake URL).
- Instant path: register an E2B project lifecycle webhook:
- URL:
https://your-app.vercel.app/api/e2b/lifecycle - Events:
sandbox.lifecycle.paused,resumed,killed,created - Signature secret → Vercel
E2B_LIFECYCLE_WEBHOOK_SECRET
- URL:
- Fallback: Vercel cron daily (
0 6 * * *UTC — Hobby plan limit) hits/api/cron/arm-telegram-wake(needsCRON_SECRET). Re-affirms sandbox or host webhook. - Dashboard list / Wake also syncs webhook + status.
- Redeploy both Vercel (web) and Railway (gateway) after pull; Update CLI
in the sandbox so webhook mode is available.
Set gateway
XIBECODE_E2B_SANDBOX_TIMEOUT_MS(default 30m) and keepXIBECODE_E2B_ON_TIMEOUT=pause+XIBECODE_E2B_AUTO_RESUME=true.
Service root / Docker context: apps/gateway
| Setting | Value |
|---|---|
| Dockerfile | apps/gateway/Dockerfile (context apps/gateway) |
| Port | 8787 or platform PORT |
| Health | GET /health |
| Config | apps/gateway/railway.toml |
Env from apps/gateway/.env.example (provider API key, template, lifecycle, gateway token).
Coolify: Base Directory / Build Pack context = apps/gateway, Dockerfile = Dockerfile.
Railway: Root Directory = apps/gateway, builder = Dockerfile.
After the gateway has a public URL, put it in Vercel as XIBECODE_SANDBOX_GATEWAY_URL.
New sandboxes get the selected runtime pinned to the matching E2B template alias
(XIBECODE_E2B_TEMPLATE or SUPERCHARGE_E2B_TEMPLATE). Rebuilding/republishing the
selected template is still how you raise the baseline for new instances.
New instances can use either the existing XibeCode image or the Supercharge image. The dashboard selection is persisted per instance and drives E2B template provisioning, gateway reattachment, wake/resume, daemon restart, workspace and file-sharing requests, and sandbox recreation. Existing database rows without a runtime remain backward-compatible and default to XibeCode. The gateway template aliases are configured independently:
| Runtime | Environment variable | Default alias | Daemon |
|---|---|---|---|
| XibeCode | XIBECODE_E2B_TEMPLATE |
xibecode-full-sandbox |
Existing XibeCode daemon |
| Supercharge | SUPERCHARGE_E2B_TEMPLATE |
supercharge-daemon-sandbox |
supercharge agent daemon --bind 0.0.0.0:8790 |
The Supercharge image is intentionally built and published by the repository owner’s local E2B workflow. This repository contains the application selection/configuration code and the exact Supercharge E2B template contract, not a published image or embedded credentials. The image must expose the app-compatible daemon on 0.0.0.0:8790, the wake/file-share service on 8788, and the visible browser stream on 9223. It must include supercharge, sc, Chromium, agent-browser, terminal/workspace tools, and the static supercharge-superagent-server binary.
Supercharge provider setup remains a runtime operation through the Vectra /setup and instance configuration flows. Provider keys, custom OpenAI-compatible URLs, Telegram/Discord/Slack tokens, and the Vectra app secret are written into the selected sandbox overlay only; none are baked into the image. The web and mobile Computer pane continue to use the app-compatible browser routes, while workspace upload/download/share and public media routes preserve the selected runtime during wake and reattachment.
For existing instances, the dashboard offers an opt-in upgrade when npm has a
newer xibecode than xibecode -v inside the sandbox:
- Open the instance → banner Update available: X.Y.Z (you have A.B.C).
- Update & restart wakes the sandbox if paused, then installs latest global CLI:
- Prefer
sudo -n npm install -g xibecode@latest(template global prefix is often root-owned). - Fallbacks: interactive
sudo npm …, then plainnpm install -g …. - Then restart daemon (workspace,
daemon.env, and pairing are kept).
- Prefer
- Dismiss hides the offer for that version in the current browser session.
- Never auto-updates silently.
APIs:
| Method | Path | Notes |
|---|---|---|
GET |
/api/instances/:id/cli-version |
Host npm registry + in-sandbox xibecode -v |
POST |
/api/instances/:id/cli-update |
Wake → install → restart daemon (maxDuration 300s) |
GET |
/api/instances/:id/logs?source=all|daemon|agent|system |
Diagnostic log pull (wakes if paused) |
| Variable | Default | Purpose |
|---|---|---|
XIBECODE_E2B_TEMPLATE |
xibecode-full-sandbox |
Published XibeCode template id/alias |
SUPERCHARGE_E2B_TEMPLATE |
supercharge-full-sandbox |
Published Supercharge template id/alias |
XIBECODE_E2B_ON_TIMEOUT |
pause |
pause (snapshot) or kill |
XIBECODE_E2B_AUTO_RESUME |
true |
Wake on SDK/HTTP when paused |
XIBECODE_E2B_SANDBOX_TIMEOUT_MS |
900000 (15m) |
Idle before lifecycle pause |
XIBECODE_E2B_MAX_CONTINUOUS_MS |
82800000 (~23h) |
Pause/resume before E2B 24h hard limit; 0 = off |
XIBECODE_SANDBOX_DAEMON_COMMAND |
xibecode daemon --workdir /home/user/workspace |
XibeCode restart command |
XIBECODE_SANDBOX_DAEMON_PIDFILE |
/tmp/xibecode-daemon.pid |
XibeCode pidfile |
XIBECODE_SANDBOX_DAEMON_LOGFILE |
/tmp/xibecode-daemon.log |
XibeCode log file |
XIBECODE_SANDBOX_DAEMON_MATCH |
`node.*xibecode | xibecode/dist` |
SUPERCHARGE_SANDBOX_DAEMON_COMMAND |
/usr/local/bin/supercharge-superagent-server |
Supercharge restart command |
SUPERCHARGE_SANDBOX_DAEMON_PIDFILE |
/tmp/supercharge-daemon.pid |
Supercharge pidfile |
SUPERCHARGE_SANDBOX_DAEMON_LOGFILE |
/tmp/supercharge-daemon.log |
Supercharge log file |
SUPERCHARGE_SANDBOX_DAEMON_MATCH |
`supercharge-superagent-server | superagent-server` |
# install (each app keeps its own node_modules — no hoist)
bun install --cwd apps/web # or: npm ci --prefix apps/web
bun install --cwd apps/gateway
# env
cp apps/web/.env.example apps/web/.env.local
cp apps/gateway/.env.example apps/gateway/.env
# run (from repo root)
bun run dev:gateway # :8787
bun run dev:web # :3001Or from each app:
cd apps/gateway && bun run dev
cd apps/web && npm run devUNLICENSED / proprietary. See LICENSE.