# vivekkumar080404/vibecodeeditor architecture

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

- Interactive diagram: https://gitdiagram.com/vivekkumar080404/vibecodeeditor
- Repository: https://github.com/vivekkumar080404/vibecodeeditor

## Overview

This repository is a web-based code playground: users reach a dashboard, choose or manage a project, then edit template files and run them in an in-browser WebContainer with a preview and terminal. Supporting areas include authentication, project persistence, and template-structure conversion. The graph follows relationships visible in excerpts or the SOURCE INDEX; several routes and UI modules are only listed, so their internal wiring is not inferred.

Main entry points: [`app/playground/[id]/page.tsx`](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/playground/%5Bid%5D/page.tsx) (Playground Page), [`lib/db.ts`](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/lib/db.ts) (Database Client), [`app/dashboard/page.tsx`](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/dashboard/page.tsx) (Dashboard Page), [`app/api/template/[id]/route.ts`](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/api/template/%5Bid%5D/route.ts) (Template API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Accounts"]
  node_signin["Sign-in Form"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_auth_actions["Auth Actions<br/>[index.ts]"]
end

subgraph group_projects["Projects and Templates"]
  node_dashboard["Dashboard Page<br/>[page.tsx]"]
  node_project_actions["Project Actions<br/>[index.ts]"]
  node_project_table["Project Table<br/>[project-table.tsx]"]
  node_template_picker["Template Picker"]
  node_template_api["Template API<br/>[route.ts]"]
  node_template_json["Template Structure Codec<br/>[path-to-json.ts]"]
  node_template_config["Template Paths<br/>[template.ts]"]
  node_database[("Database Client<br/>[db.ts]")]
end

subgraph group_editor["Playground Editing"]
  node_playground_page["Playground Page<br/>[page.tsx]"]
  node_playground_hook["Playground Data Hook<br/>[usePlayground.tsx]"]
  node_file_explorer["File Explorer State"]
  node_file_tree["Template File Tree"]
  node_editor_ui["Code Editor"]
end

subgraph group_runtime["In-Browser Runtime"]
  node_container_hook["WebContainer Hook<br/>[useWebContainer.ts]"]
  node_container_preview["Runtime Setup and Preview"]
  node_transformer["Template Transformer<br/>[transformer.ts]"]
  node_terminal["Terminal<br/>[terminal.tsx]"]
end

node_visitor(("User"))

node_visitor -->|"signs in"| node_signin
node_signin -->|"calls"| node_auth
node_auth -->|"uses"| node_database
node_auth -->|"uses"| node_auth_actions
node_dashboard -->|"loads projects"| node_project_actions
node_dashboard -->|"renders"| node_project_table
node_project_actions -->|"uses"| node_auth_actions
node_project_actions -->|"queries"| node_database
node_dashboard -->|"offers templates"| node_template_picker
node_template_api -->|"loads playground"| node_database
node_template_api -->|"selects template path"| node_template_config
node_template_api -->|"converts structure"| node_template_json
node_playground_page -->|"loads and saves"| node_playground_hook
node_playground_page -->|"manages open files"| node_file_explorer
node_playground_page -->|"renders"| node_file_tree
node_playground_page -->|"renders"| node_editor_ui
node_playground_hook -->|"uses"| node_template_json
node_file_explorer -.->|"generates file IDs via"| node_database
node_playground_page -->|"boots runtime"| node_container_hook
node_playground_page -->|"renders preview"| node_container_preview
node_container_preview -->|"transforms files"| node_transformer
node_container_preview -->|"streams process output"| node_terminal

click node_signin "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/auth/components/signin-form-client.tsx"
click node_auth "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/auth.ts"
click node_auth_actions "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/auth/actions/index.ts"
click node_dashboard "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/dashboard/page.tsx"
click node_project_actions "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/actions/index.ts"
click node_project_table "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/components/project-table.tsx"
click node_template_picker "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/components/template-selection-modal.tsx"
click node_template_api "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/api/template/%5Bid%5D/route.ts"
click node_template_json "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/libs/path-to-json.ts"
click node_template_config "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/lib/template.ts"
click node_database "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/lib/db.ts"
click node_playground_page "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/playground/%5Bid%5D/page.tsx"
click node_playground_hook "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/hooks/usePlayground.tsx"
click node_file_explorer "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/hooks/useFileExplorer.tsx"
click node_file_tree "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/template-file-tree.tsx"
click node_editor_ui "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/playground-editor.tsx"
click node_container_hook "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/hooks/useWebContainer.ts"
click node_container_preview "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/components/webcontainer-preview.tsx"
click node_transformer "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/hooks/transformer.ts"
click node_terminal "https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/components/terminal.tsx"

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_auth_actions,node_visitor toneBlue
class node_dashboard,node_project_actions,node_project_table,node_template_picker,node_template_api,node_template_json,node_template_config,node_database toneAmber
class node_playground_page,node_playground_hook,node_file_explorer,node_file_tree,node_editor_ui toneMint
class node_container_hook,node_container_preview,node_transformer,node_terminal toneRose
```

## Components

### Access and Accounts

- [Sign-in Form](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/auth/components/signin-form-client.tsx): `features/auth/components/signin-form-client.tsx`
- [Authentication](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/auth.ts): `auth.ts`
- [Auth Actions](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/auth/actions/index.ts): `features/auth/actions/index.ts`

### Projects and Templates

- [Dashboard Page](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Project Actions](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/actions/index.ts): `features/dashboard/actions/index.ts`
- [Project Table](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/components/project-table.tsx): `features/dashboard/components/project-table.tsx`
- [Template Picker](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/dashboard/components/template-selection-modal.tsx): `features/dashboard/components/template-selection-modal.tsx`
- [Template API](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/api/template/%5Bid%5D/route.ts): `app/api/template/[id]/route.ts`
- [Template Structure Codec](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/libs/path-to-json.ts): `features/playground/libs/path-to-json.ts`
- [Template Paths](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/lib/template.ts): `lib/template.ts`
- [Database Client](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/lib/db.ts): `lib/db.ts`

### Playground Editing

- [Playground Page](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/app/playground/%5Bid%5D/page.tsx): `app/playground/[id]/page.tsx`
- [Playground Data Hook](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/hooks/usePlayground.tsx): `features/playground/components/actions/hooks/usePlayground.tsx`
- [File Explorer State](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/hooks/useFileExplorer.tsx): `features/playground/components/actions/hooks/useFileExplorer.tsx`
- [Template File Tree](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/template-file-tree.tsx): `features/playground/components/actions/template-file-tree.tsx`
- [Code Editor](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/playground/components/actions/playground-editor.tsx): `features/playground/components/actions/playground-editor.tsx`

### In-Browser Runtime

- [WebContainer Hook](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/hooks/useWebContainer.ts): `features/webContainers/hooks/useWebContainer.ts`
- [Runtime Setup and Preview](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/components/webcontainer-preview.tsx): `features/webContainers/components/webcontainer-preview.tsx`
- [Template Transformer](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/hooks/transformer.ts): `features/webContainers/hooks/transformer.ts`
- [Terminal](https://github.com/vivekkumar080404/vibecodeeditor/blob/main/features/webContainers/components/terminal.tsx): `features/webContainers/components/terminal.tsx`

### Other components

- **User**

## Connections

- User → Sign-in Form: signs in (evidence: `features/auth/components/signin-form-client.tsx`)
- Sign-in Form → Authentication: calls (evidence: `features/auth/components/signin-form-client.tsx`)
- Authentication → Database Client: uses (evidence: `auth.ts`)
- Authentication → Auth Actions: uses (evidence: `auth.ts`)
- Dashboard Page → Project Actions: loads projects (evidence: `app/dashboard/page.tsx`)
- Dashboard Page → Project Table: renders (evidence: `app/dashboard/page.tsx`)
- Project Actions → Auth Actions: uses (evidence: `features/dashboard/actions/index.ts`)
- Project Actions → Database Client: queries (evidence: `features/dashboard/actions/index.ts`)
- Dashboard Page → Template Picker: offers templates (evidence: `app/dashboard/page.tsx`)
- Template API → Database Client: loads playground (evidence: `app/api/template/[id]/route.ts`)
- Template API → Template Paths: selects template path (evidence: `app/api/template/[id]/route.ts`)
- Template API → Template Structure Codec: converts structure (evidence: `app/api/template/[id]/route.ts`)
- Playground Page → Playground Data Hook: loads and saves (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → File Explorer State: manages open files (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → Template File Tree: renders (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → Code Editor: renders (evidence: `app/playground/[id]/page.tsx`)
- Playground Data Hook → Template Structure Codec: uses (evidence: `features/playground/components/actions/hooks/usePlayground.tsx`)
- File Explorer State → Database Client: generates file IDs via
- Playground Page → WebContainer Hook: boots runtime (evidence: `app/playground/[id]/page.tsx`)
- Playground Page → Runtime Setup and Preview: renders preview (evidence: `app/playground/[id]/page.tsx`)
- Runtime Setup and Preview → Template Transformer: transforms files (evidence: `features/webContainers/components/webcontainer-preview.tsx`)
- Runtime Setup and Preview → Terminal: streams process output (evidence: `features/webContainers/components/webcontainer-preview.tsx`)
