How ishaan1013/sandbox works
Main System Components
a) Frontend Layer:
• Next.js application (React)
• Key components:
• Editor interface (Monaco)
• Real-time collaboration features (Liveblocks)
• Authentication (Clerk)
• Dashboard & UI components
b) Backend Services:
• Express/Socket.io Server
• Cloudflare Workers Microservices:
• Database Worker (D1)
• Storage Worker (R2)
• AI Worker (Workers AI)
• E2B Sandbox Environment
Component Relationships
a) Client-Server Communication:
• WebSocket connections between frontend and Express server
• HTTP/REST endpoints between frontend and Cloudflare Workers
• Authentication flow through Clerk
b) Microservices Integration:
• Service binding between D1 Database and R2 Storage
• AI Worker integration for code completion
• E2B sandbox instances for terminal and preview functionality
Specific Implementation Details
• Blue rectangles: Frontend components
• Green rectangles: Backend services
• Yellow diamonds: External services (Clerk, Liveblocks, E2B)
• Red hexagon: AI Worker
Data Flow Representation
a) User Interactions:
• Authentication flow → Clerk → Frontend → Backend
• Code editing → Monaco → Liveblocks → Other users
• File operations → Storage Worker → R2
• Terminal commands → E2B Sandbox
b) Backend Processing:
• Database operations → D1 Worker
• File storage → R2 Worker
• AI completions → Workers AI
• Real-time updates → Socket.io
Additional Elements
Important aspects:
• Security boundaries (authentication zones)
• Service scaling indicators
• API endpoints and WebSocket connections
• Database schema references
• File storage organization
[Client Layer]
• ↓↑
[API/WebSocket Layer]
• ↓↑
[Service Layer]
• ↓↑
[Storage Layer]