How e2b-dev/dashboard works
Project Type and Purpose
• This is a full-stack, feature-rich web dashboard built with Next.js 15 + React 19 + TypeScript.
• It exposes a UI for managing “sandboxes”, API keys, usage analytics, billing, team settings, and integrated docs.
High-Level Components
Break the system into the following main components:
a. Client (Browser)
b. Next.js Application (Deployed on Vercel)
c. API Layer (Next.js App Router under src/app/api + server logic)
d. Data Stores and External Services
• Supabase Auth & PostgreSQL DB
• Supabase Storage (profile-pictures bucket)
• Redis-compatible KV store (Vercel KV or custom Redis)
• Analytics (PostHog or similar)
e. Supporting Infrastructure
• Vercel platform (Edge functions, CDN, KV integration)
• GitHub for code, CI/CD via GitHub Actions
• Migrations (SQL files under /migrations)
Core Architectural Patterns & Design Principles
• App Router & API Routes: Next.js app router (src/app) serves both server-rendered pages and API routes under src/app/api.
• Server-only Logic: Modules in src/server and data-access clients in src/lib/clients run only on the server (Edge or Node).
• Shared Code: UI components (src/ui), feature modules (src/features), and utility code (src/lib/utils) are reused across pages.
• Partial Prerendering: Static-generation + server functions using Vercel’s PPR.
• Type-safe Contracts: OpenAPI spec (spec/openapi.yaml) and generated DB types.
Mapping Relationships & Data Flows
• User ↔️ Browser UI: User interacts with React components delivered by Next.js (hydration, client-side navigation).
• Browser ↔️ Next.js API: All actions (auth, CRUD on sandboxes, teams, billing, usage metrics) go through Next.js API routes.
• Next.js API ↔️ Services:
• Auth flows use Supabase Auth API (callback, confirm, email).
• Data queries/write go to Supabase PostgreSQL (via supabase client) and Redis KV (via Vercel KV client).
• File uploads/downloads use Supabase Storage.
• Usage/analytics calls to PostHog or custom telemetry client.
• Database Migrations: Applied manually or via CI against Supabase DB before deployment.