System Overview
Frontend Architecture
Pages
| Route | Component | Purpose |
|---|---|---|
/ | app/page.tsx | Minimal home with prompt input |
/start | app/start/page.tsx | Visual canvas designer |
/generation | app/generation/page.tsx | Full code IDE |
/account | app/account/page.tsx | User account management |
Context Providers
The app uses nested React Context for state management:| Context | Purpose | Key State |
|---|---|---|
UserProvider | User authentication and profile | User data, auth state |
SandboxProvider | Sandbox lifecycle management | Sandbox ID, URLs, pages |
EditorProvider | Code editing state | Current file, editor content |
GenerationProvider | Generation state | Generated screens, prompts |
Key Components
Sandbox Architecture
Provider Factory Pattern
Modal Sandbox Instance
Sandbox Lifecycle
AI Generation Flow
Code Generation Pipeline
Prompt Processing
Seemodo AI Integration
Client Architecture
Tool Types
| Tool | Description | Events |
|---|---|---|
| Read | Read file contents | tool.read.start, tool.read.result |
| Write | Create/overwrite file | tool.write.result |
| Edit | Modify file sections | tool.str_replace.result |
| Bash | Execute commands | tool.bash.start, tool.bash.result |
| Search | Search codebase | tool.search.result |
Data Flow
Generation Request
Tech Stack
Frontend
| Technology | Purpose |
|---|---|
| Next.js 16 | React framework with App Router |
| TypeScript | Type safety |
| Tailwind CSS | Styling |
| Radix UI | Accessible primitives |
| Shadcn/ui | Component library |
| tldraw | Canvas/wireframe editor |
| Framer Motion | Animations |
| Jotai | Atomic state management |
| xterm.js | Terminal emulator |
Backend
| Technology | Purpose |
|---|---|
| Next.js API Routes | Backend endpoints |
| Vercel AI SDK | AI model integration |
| Modal Labs | Sandbox infrastructure |
| Python/FastAPI | Modal sandbox server |
| Seemodo AI SDK | AI coding assistant |
External Services
| Service | Purpose |
|---|---|
| Google Gemini | Default AI model |
| Anthropic Claude | Alternative AI model |
| OpenAI GPT | Alternative AI model |
| Groq | Fast inference (Kimi K2) |
| Supabase | Backend-as-a-service |
Project Structure
Security Considerations
API Keys
- All API keys stored in environment variables
- Never exposed to client-side code
- Separate keys for development/production
Sandbox Isolation
- Each sandbox runs in isolated container
- No network access between sandboxes
- File system isolation
- Encrypted tunnel URLs
Authentication
- User sessions via Supabase Auth (when configured)
- API routes validate authentication
- Sandbox credentials per-session
Scalability
Horizontal Scaling
- Next.js deploys on Vercel/similar
- Sandboxes scale independently on Modal
- No shared state between requests
Performance Optimizations
- SSE streaming for real-time updates
- HMR for instant preview updates
- Parallel tool execution in Seemodo AI
- Client-side caching for UI state