# sounak-ghosh03/ai-vibe-code-editor architecture

> Architecture diagram of the GitHub repository sounak-ghosh03/ai-vibe-code-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sounak-ghosh03/ai-vibe-code-editor
- Repository: https://github.com/sounak-ghosh03/ai-vibe-code-editor

## Overview

Vibecode is a browser-based AI web IDE. A user signs in, creates or selects a starter project, edits its files, requests AI assistance, and runs the project in an in-browser WebContainer with a terminal and preview. The graph preserves the documented template, auth, editing, AI, and execution capabilities; several links are based on README descriptions because their implementation was not sampled.

Main entry points: [`app/playground/[id]/page.tsx`](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/playground/%5Bid%5D/page.tsx) (Playground Page), [`features/webcontainers/components/webcontainer-preview.tsx`](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/components/webcontainer-preview.tsx) (Run & Preview), [`features/playground/lib/path-to-json.ts`](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/lib/path-to-json.ts) (Template File Tree), [`app/dashboard/page.tsx`](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/dashboard/page.tsx) (Project Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity_projects["Identity &amp; Projects"]
  node_signin["Sign-in UI<br/>[sign-in-form.tsx]"]
  node_auth["NextAuth<br/>[auth.ts]"]
  node_dashboard["Project Dashboard<br/>[page.tsx]"]
  node_project_actions["Project Actions<br/>[index.ts]"]
  node_project_table["Project Manager<br/>[project-table.tsx]"]
  node_template_picker["Template Picker"]
  node_starter_catalog["Starter Projects"]
end

subgraph group_playground["Playground Authoring"]
  node_template_api["Template API<br/>[route.ts]"]
  node_template_codec["Template File Tree<br/>[path-to-json.ts]"]
  node_playground_page["Playground Page<br/>[page.tsx]"]
  node_playground_state["Playground State<br/>[usePlayground.tsx]"]
  node_file_explorer["File Explorer"]
  node_editor["Monaco Editor"]
  node_ai_completion["AI Completion API<br/>[route.ts]"]
  node_ai_suggestions["AI Suggestions"]
end

subgraph group_runtime["Browser Runtime"]
  node_container_hook["WebContainer Hook"]
  node_preview["Run &amp; Preview"]
  node_terminal["Embedded Terminal<br/>[terminal.tsx]"]
end

subgraph group_shared["Shared Services"]
  node_database[("MongoDB<br/>[db.ts]")]
end

node_user(("Developer"))
node_ollama["Ollama LLM"]

node_user -->|"signs in"| node_signin
node_signin -->|"starts OAuth"| node_auth
node_user -.->|"opens projects"| node_dashboard
node_dashboard -->|"loads projects"| node_project_actions
node_dashboard -->|"renders projects"| node_project_table
node_project_actions -->|"reads and writes"| node_database
node_user -.->|"chooses starter"| node_template_picker
node_template_picker -.->|"selects template"| node_starter_catalog
node_user -.->|"opens workspace"| node_playground_page
node_playground_page -->|"loads state"| node_playground_state
node_playground_state -->|"uses file tree"| node_template_codec
node_playground_page -->|"uses explorer"| node_file_explorer
node_file_explorer -->|"uses file tree"| node_template_codec
node_playground_page -->|"renders editor"| node_editor
node_playground_page -.->|"requests template"| node_template_api
node_template_api -->|"loads playground"| node_database
node_template_api -->|"converts files"| node_template_codec
node_editor -.->|"requests assistance"| node_ai_suggestions
node_ai_suggestions -.->|"requests completion"| node_ai_completion
node_ai_completion -.->|"queries model"| node_ollama
node_playground_page -.->|"boots runtime"| node_container_hook
node_playground_page -->|"renders runtime"| node_preview
node_preview -->|"renders terminal"| node_terminal
node_preview -->|"transforms files"| node_template_codec
node_preview -.->|"runs project"| node_ollama

click node_signin "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/auth/components/sign-in-form.tsx"
click node_auth "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/auth.ts"
click node_dashboard "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/dashboard/page.tsx"
click node_project_actions "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/dashboard/actions/index.ts"
click node_project_table "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/dashboard/components/project-table.tsx"
click node_template_picker "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/components/modal/template-selector-modal.tsx"
click node_starter_catalog "https://github.com/sounak-ghosh03/ai-vibe-code-editor/tree/main/vibecode-starters"
click node_template_api "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/api/template/%5Bid%5D/route.ts"
click node_template_codec "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/lib/path-to-json.ts"
click node_playground_page "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/playground/%5Bid%5D/page.tsx"
click node_playground_state "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/usePlayground.tsx"
click node_file_explorer "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/useFileExplorer.tsx"
click node_editor "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/components/playground-editor.tsx"
click node_ai_completion "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/api/code-completion/route.ts"
click node_ai_suggestions "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/useAISuggestion.tsx"
click node_container_hook "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/hooks/useWebContainers.ts"
click node_preview "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/components/webcontainer-preview.tsx"
click node_terminal "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/components/terminal.tsx"
click node_database "https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/lib/db.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_signin,node_auth,node_dashboard,node_project_actions,node_project_table,node_template_picker,node_starter_catalog toneBlue
class node_template_api,node_template_codec,node_playground_page,node_playground_state,node_file_explorer,node_editor,node_ai_completion,node_ai_suggestions toneAmber
class node_container_hook,node_preview,node_terminal toneMint
class node_database toneRose
class node_user,node_ollama toneIndigo
```

## Components

### Identity & Projects

- [Sign-in UI](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/auth/components/sign-in-form.tsx): `features/auth/components/sign-in-form.tsx`
- [NextAuth](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/auth.ts): `auth.ts`
- [Project Dashboard](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Project Actions](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/dashboard/actions/index.ts): `features/dashboard/actions/index.ts`
- [Project Manager](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/dashboard/components/project-table.tsx): `features/dashboard/components/project-table.tsx`
- [Template Picker](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/components/modal/template-selector-modal.tsx): `components/modal/template-selector-modal.tsx`
- [Starter Projects](https://github.com/sounak-ghosh03/ai-vibe-code-editor/tree/main/vibecode-starters): `vibecode-starters`

### Playground Authoring

- [Template API](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/api/template/%5Bid%5D/route.ts): `app/api/template/[id]/route.ts`
- [Template File Tree](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/lib/path-to-json.ts): `features/playground/lib/path-to-json.ts`
- [Playground Page](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/playground/%5Bid%5D/page.tsx): `app/playground/[id]/page.tsx`
- [Playground State](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/usePlayground.tsx): `features/playground/hooks/usePlayground.tsx`
- [File Explorer](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/useFileExplorer.tsx): `features/playground/hooks/useFileExplorer.tsx`
- [Monaco Editor](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/components/playground-editor.tsx): `features/playground/components/playground-editor.tsx`
- [AI Completion API](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/app/api/code-completion/route.ts): `app/api/code-completion/route.ts`
- [AI Suggestions](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/playground/hooks/useAISuggestion.tsx): `features/playground/hooks/useAISuggestion.tsx`

### Browser Runtime

- [WebContainer Hook](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/hooks/useWebContainers.ts): `features/webcontainers/hooks/useWebContainers.ts`
- [Run & Preview](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/components/webcontainer-preview.tsx): `features/webcontainers/components/webcontainer-preview.tsx`
- [Embedded Terminal](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/features/webcontainers/components/terminal.tsx): `features/webcontainers/components/terminal.tsx`

### Shared Services

- [MongoDB](https://github.com/sounak-ghosh03/ai-vibe-code-editor/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **Developer**
- **Ollama LLM**

## Connections

- Developer → Sign-in UI: signs in (evidence: `README.md`)
- Sign-in UI → NextAuth: starts OAuth (evidence: `features/auth/components/sign-in-form.tsx`)
- Developer → Project Dashboard: opens projects
- Project Dashboard → Project Actions: loads projects (evidence: `app/dashboard/page.tsx`)
- Project Dashboard → Project Manager: renders projects (evidence: `app/dashboard/page.tsx`)
- Project Actions → MongoDB: reads and writes (evidence: `features/dashboard/actions/index.ts`)
- Developer → Template Picker: chooses starter
- Template Picker → Starter Projects: selects template (evidence: `README.md`)
- Developer → Playground Page: opens workspace
- Playground Page → Playground State: loads state (evidence: `app/playground/[id]/page.tsx`)
- Playground State → Template File Tree: uses file tree (evidence: `features/playground/hooks/usePlayground.tsx`)
- Playground Page → File Explorer: uses explorer (evidence: `app/playground/[id]/page.tsx`)
- File Explorer → Template File Tree: uses file tree (evidence: `features/playground/hooks/useFileExplorer.tsx`)
- Playground Page → Monaco Editor: renders editor (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → Template API: requests template
- Template API → MongoDB: loads playground (evidence: `app/api/template/[id]/route.ts`)
- Template API → Template File Tree: converts files (evidence: `app/api/template/[id]/route.ts`)
- Monaco Editor → AI Suggestions: requests assistance (evidence: `README.md`)
- AI Suggestions → AI Completion API: requests completion
- AI Completion API → Ollama LLM: queries model (evidence: `README.md`)
- Playground Page → WebContainer Hook: boots runtime (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → Run & Preview: renders runtime (evidence: `app/playground/[id]/page.tsx`)
- Run & Preview → Embedded Terminal: renders terminal (evidence: `features/webcontainers/components/webcontainer-preview.tsx`)
- Run & Preview → Template File Tree: transforms files (evidence: `features/webcontainers/components/webcontainer-preview.tsx`)
- Run & Preview → Ollama LLM: runs project
