Skip to content

refactor: fully self-hostable against e2b-dev/infra - #518

Merged
ben-fornefeld merged 8 commits into
mainfrom
feat/self-hostable-dashboard
Jul 23, 2026
Merged

refactor: fully self-hostable against e2b-dev/infra#518
ben-fornefeld merged 8 commits into
mainfrom
feat/self-hostable-dashboard

Conversation

@ben-fornefeld

@ben-fornefeld ben-fornefeld commented Jul 23, 2026

Copy link
Copy Markdown
Member

This PR refocuses the dashboard on one goal: managing a self-hosted e2b-dev/infra deployment with the least possible setup. It also lays the groundwork for native OAuth support in the open-source stack: with the dashboard reduced to a stateless API-key client, identity can be added in front of it (or natively in infra) without reworking the dashboard again.

Until now, running this dashboard yourself meant standing up a whole constellation of services the open-source infra doesn't ship: an Ory Kratos + Hydra identity stack, a billing API backed by Stripe, LaunchDarkly, PostHog, Plain, and an events service. None of these exist in a self-hosted infra deployment — so out of the box, the dashboard simply couldn't be self-hosted without significant extra infrastructure that had nothing to do with managing sandboxes.

This PR strips the dashboard down to exactly what e2b-dev/infra supports, and replaces user-account auth with the credential every E2B deployment already has: a team API key.

What this looks like now

Setup is one env var:

NEXT_PUBLIC_E2B_DOMAIN=your-domain.com   # resolves infra-api + dashboard-api
bun install && bun run dev

Visit /, paste a team API key (e2b_...), done. The key is validated against infra-api and stored in an httpOnly e2b_api_key cookie; every upstream call happens server-side via X-API-Key. The key never reaches client JavaScript.

For single-user deployments, set E2B_API_KEY in the environment and the dashboard is pre-authenticated — no login step at all.

Authentication is deliberately out of scope. The dashboard itself carries no user model. If you need SSO / user-level access control in front of it, put any standard OAuth proxy (oauth2-proxy, Authelia, Cloudflare Access, ...) in front of the deployment — the dashboard composes cleanly with that, instead of forcing a specific identity stack on you.

What's included

  • Sandboxes — live paginated list, per-sandbox monitoring (CPU/mem/disk), logs, filesystem inspector, in-browser terminal
  • Templates — list, visibility, tags, build history with streaming build logs
  • Teamless URLs: /sandboxes, /templates/... (the team is implied by the API key)
  • /?tab=sandboxes|templates deep links

What's removed (and why)

Everything that depends on services the open-source infra doesn't provide:

Removed Depended on
User accounts, login, CLI auth, account settings Ory Kratos + Hydra
Billing, usage, limits pages closed billing API + Stripe
Team & member management, API key management, team switcher user-scoped auth-provider endpoints
Webhooks & sandbox event timeline events service (argus)
Team-level metrics charts team-scoped metrics endpoints not exposed via API key auth
Feature flags, support widget, analytics LaunchDarkly, Plain, PostHog/GA/Vercel
Marketing site reverse proxy on / e2b.dev landing page

Net effect: −48k lines, 20 fewer runtime dependencies, and an env surface that went from ~25 required/conditional variables to one.

Where possible, code structure (repositories, tRPC routers, the envd data plane for the terminal/filesystem) was kept intact rather than rewritten, so the codebase stays familiar and easy to contribute to.

Notable implementation details

  • The proxy shrank to a ~30-line gate: cookie presence check + returnTo. Key validity is enforced lazily — any upstream 401 clears the cookie and returns to the key form.
  • Sandbox terminal/filesystem still use the sandbox-scoped envd token data plane; the account-level credential never reaches the browser (unchanged design).
  • GET /sandboxes/{id}/record (killed-sandbox archival records) isn't available on self-hosted deployments; the fallback path short-circuits to 404 while keeping the code shape.
  • CSRF: SameSite=Lax httpOnly cookie + server-action origin checks; the e2b_api_key cookie is in the logger redaction list.

Merge dependency

dashboard-api (from e2b-dev/infra) needs X-API-Key auth on its read endpoints (GET /templates*, GET /builds*) — tracked separately and landing before this merges. infra-api already accepts API key auth on every endpoint the dashboard uses. Until then, template/build detail views return 401 against a live deployment; sandboxes work fully.

Testing

  • Unit + integration suites rewritten for the new auth (proxy gate matrix, cookie/env fallback, key validation)
  • Playwright preview tests are removed for now; end-to-end coverage will return once the self-hosted test setup is in place
  • Verified against a production build: key form → sandboxes/templates → sign-out

…nagement, keys, account, support, feature flags, team metrics, byoc/connections, standalone terminal
- e2b_api_key httpOnly cookie (or E2B_API_KEY env) is the only credential;
  validated once on the / key form, enforced lazily via UNAUTHORIZED -> sign-out
- all upstream calls now use X-API-Key; repositories keep their shape
- SDK calls use native { apiKey } instead of bearer-header injection
- routes move from /dashboard/[teamSlug]/* to /sandboxes and /templates
- proxy shrinks to a ~30-line presence gate with returnTo
- sandbox record fallback short-circuits (endpoint unavailable in OSS)
- delete ory tree, auth pages/routes, teams/user routers and modules
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web-foxtrot Ready Ready Preview, Comment Jul 23, 2026 11:23am

Request Review

@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are documentation, example env, and CI wiring only; no runtime auth or application logic in this diff.

Overview
Repositions docs and CI around the self-hosted, team API key model instead of Ory and the old SaaS integrations.

.env.example drops Ory, billing, LaunchDarkly, PostHog, Plain, and related server/client vars. Required config is essentially NEXT_PUBLIC_E2B_DOMAIN; optional E2B_API_KEY, explicit infra/dashboard API URLs, sandbox proxy URL, and a slim OTEL block remain.

README.md and AGENTS.md describe infra-api + dashboard-api, cookie/env authentication, sandboxes/templates scope, and Bun-only getting started—no Auth.js/Ory/Vercel/LaunchDarkly.

CI: .github/workflows/preview.yml (Playwright on Vercel preview deploys) is removed; .gitignore no longer ignores Playwright report dirs. test.yml integration job env is trimmed to NEXT_PUBLIC_E2B_DOMAIN (no fake Ory/session/billing secrets). sync-infra-specs.yml autofix paths point at src/core/shared/contracts/*.types.ts instead of src/types/.

Reviewed by Cursor Bugbot for commit f5a10bc. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
vercel Bot temporarily deployed to Preview – web-foxtrot July 23, 2026 11:23 Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3690216. Configure here.

Comment thread src/app/actions.ts
@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

DASH-183

@tvi tvi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really excited about this direction. Decoupling the dashboard from identity is a key milestone on the path toward native OAuth support. It gives us the flexibility to support standard OAuth flows without coupling the UI to any particular identity provider or authentication stack.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3690216085

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/core/modules/templates/repository.server.ts
Comment thread src/app/actions.ts
Comment thread src/app/page.tsx
Comment thread src/app/api/sign-out/route.ts
@ben-fornefeld ben-fornefeld changed the title Make the dashboard fully self-hostable against e2b-dev/infra refactor: fully self-hostable against e2b-dev/infra Jul 23, 2026
@ben-fornefeld
ben-fornefeld merged commit af0b0e5 into main Jul 23, 2026
11 checks passed
@ben-fornefeld
ben-fornefeld deleted the feat/self-hostable-dashboard branch July 23, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants