# javiluli/heroui-theme-studio architecture

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

- Interactive diagram: https://gitdiagram.com/javiluli/heroui-theme-studio
- Repository: https://github.com/javiluli/heroui-theme-studio

## Overview

HeroUI Theme Studio is a browser-based theme generator. The main workflow is choosing or importing a theme, editing its tokens and modes, previewing it in component galleries or a native-device viewer, then exporting CSS; themes persist in browser storage. An optional local WebGPU/WebLLM assistant proposes themes for explicit application. The README establishes these capabilities; several view implementations are unsampled, so their internal links are limited to documented or indexed relationships.

Main entry points: [`src/app/App.tsx`](https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/App.tsx) (Studio app), [`src/features/ai/useThemeAI.ts`](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/useThemeAI.ts) (AI generation), [`src/features/theme/useThemeEditor.ts`](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/useThemeEditor.ts) (Theme editor), [`src/features/theme/ThemeStudioContext.tsx`](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/ThemeStudioContext.tsx) (Theme context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Studio shell"]
  node_app["Studio app<br/>[App.tsx]"]
  node_header["Studio header<br/>[StudioHeader.tsx]"]
  node_views["View routing<br/>[StudioViews.tsx]"]
end

subgraph group_theme["Theme editing"]
  node_theme_context["Theme context"]
  node_editor["Theme editor<br/>[useThemeEditor.ts]"]
  node_editor_panel["Editor controls<br/>[EditorPanel.tsx]"]
  node_templates["Theme presets<br/>[index.ts]"]
  node_theme_storage[("Theme storage<br/>[storage.ts]")]
  node_theme_model["Theme model<br/>[model.ts]"]
  node_conversion["Theme conversion<br/>[conversion.ts]"]
  node_css_export["CSS export<br/>[export-css.ts]"]
  node_css_import["CSS import<br/>[import-css.ts]"]
  node_export_panel["Export panel<br/>[ExportPanel.tsx]"]
  node_import_panel["Import panel<br/>[ImportCssPanel.tsx]"]
end

subgraph group_previews["Theme previews"]
  node_component_gallery["Component gallery"]
  node_component_index["Component index<br/>[ComponentIndex.tsx]"]
  node_collage["Collage preview<br/>[CollagePreview.tsx]"]
  node_website["Web preview<br/>[RealWebsite.tsx]"]
  node_native_preview["Native preview"]
  node_native_runtime["Native viewer<br/>[App.tsx]"]
  node_device_presets["Device presets<br/>[device-presets.ts]"]
end

subgraph group_assistant["AI assistant"]
  node_ai_panel["AI assistant panel"]
  node_ai_hook["AI generation<br/>[useThemeAI.ts]"]
  node_ai_model["Model catalog<br/>[model.ts]"]
  node_ai_diagnostics["GPU diagnostics<br/>[diagnostics.ts]"]
  node_ai_storage["Storage planning<br/>[storage.ts]"]
  node_ai_request["Prompt requests<br/>[request.ts]"]
  node_ai_generate["Theme generation<br/>[generate-theme.ts]"]
end

node_user(("Studio user"))
node_local_browser[("Browser storage")]
node_webgpu["WebGPU runtime"]
node_webllm["WebLLM engine"]

node_user -->|"uses"| node_app
node_app -->|"reads theme"| node_theme_context
node_app -->|"renders"| node_header
node_app -->|"routes views"| node_views
node_app -->|"opens export"| node_export_panel
node_app -->|"opens import"| node_import_panel
node_app -->|"renders"| node_component_index
node_theme_context -->|"uses"| node_editor
node_editor -->|"loads and saves"| node_theme_storage
node_editor -->|"selects presets"| node_templates
node_editor -->|"updates"| node_theme_model
node_editor -->|"converts theme"| node_conversion
node_editor_panel -->|"edits theme"| node_theme_context
node_theme_storage -->|"persists theme"| node_local_browser
node_templates -->|"builds presets"| node_theme_model
node_conversion -->|"transforms tokens"| node_theme_model
node_export_panel -->|"exports CSS"| node_css_export
node_css_export -->|"gets variables"| node_conversion
node_app -->|"prepares CSS"| node_css_export
node_import_panel -->|"applies imported theme"| node_theme_context
node_user -->|"explores components"| node_component_gallery
node_component_gallery -->|"uses catalog"| node_component_index
node_component_gallery -->|"shows collage"| node_collage
node_user -->|"views web"| node_website
node_user -->|"chooses native"| node_native_preview
node_native_preview -->|"offers sizes"| node_device_presets
node_native_preview -.->|"sends preview theme"| node_native_runtime
node_user -->|"requests proposal"| node_ai_panel
node_ai_panel -->|"requests generation"| node_ai_hook
node_ai_hook -->|"checks GPU"| node_ai_diagnostics
node_ai_hook -->|"chooses models"| node_ai_model
node_ai_hook -->|"plans downloads"| node_ai_storage
node_ai_hook -->|"builds prompt"| node_ai_request
node_ai_hook -->|"recovers output"| node_ai_generate
node_ai_hook -.->|"checks capability"| node_webgpu
node_ai_hook -->|"loads engine"| node_webllm
node_ai_panel -.->|"applies on confirmation"| node_theme_context

click node_app "https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/App.tsx"
click node_header "https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/layout/StudioHeader.tsx"
click node_views "https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/layout/StudioViews.tsx"
click node_theme_context "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/ThemeStudioContext.tsx"
click node_editor "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/useThemeEditor.ts"
click node_editor_panel "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/EditorPanel.tsx"
click node_templates "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/templates/index.ts"
click node_theme_storage "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/storage.ts"
click node_theme_model "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/model.ts"
click node_conversion "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/conversion.ts"
click node_css_export "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/export-css.ts"
click node_css_import "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/import-css.ts"
click node_export_panel "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/ExportPanel.tsx"
click node_import_panel "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/ImportCssPanel.tsx"
click node_component_gallery "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/ComponentGallery.tsx"
click node_component_index "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/components/ComponentIndex.tsx"
click node_collage "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/components/CollagePreview.tsx"
click node_website "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/website/RealWebsite.tsx"
click node_native_preview "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/NativePreviewPage.tsx"
click node_native_runtime "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/runtime/App.tsx"
click node_device_presets "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/device-presets.ts"
click node_ai_panel "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/AIGeneratorPanel.tsx"
click node_ai_hook "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/useThemeAI.ts"
click node_ai_model "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/model.ts"
click node_ai_diagnostics "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/diagnostics.ts"
click node_ai_storage "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/storage.ts"
click node_ai_request "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/request.ts"
click node_ai_generate "https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/generate-theme.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_app,node_header,node_views,node_user toneBlue
class node_theme_context,node_editor,node_editor_panel,node_templates,node_theme_storage,node_theme_model,node_conversion,node_css_export,node_css_import,node_export_panel,node_import_panel,node_local_browser toneAmber
class node_component_gallery,node_component_index,node_collage,node_website,node_native_preview,node_native_runtime,node_device_presets toneMint
class node_ai_panel,node_ai_hook,node_ai_model,node_ai_diagnostics,node_ai_storage,node_ai_request,node_ai_generate toneRose
class node_webgpu,node_webllm toneIndigo
```

## Components

### Studio shell

- [Studio app](https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/App.tsx): `src/app/App.tsx`
- [Studio header](https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/layout/StudioHeader.tsx): `src/app/layout/StudioHeader.tsx`
- [View routing](https://github.com/javiluli/heroui-theme-studio/blob/master/src/app/layout/StudioViews.tsx): `src/app/layout/StudioViews.tsx`

### Theme editing

- [Theme context](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/ThemeStudioContext.tsx): `src/features/theme/ThemeStudioContext.tsx`
- [Theme editor](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/useThemeEditor.ts): `src/features/theme/useThemeEditor.ts`
- [Editor controls](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/EditorPanel.tsx): `src/features/theme/components/EditorPanel.tsx`
- [Theme presets](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/templates/index.ts): `src/features/theme/templates/index.ts`
- [Theme storage](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/storage.ts): `src/features/theme/storage.ts`
- [Theme model](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/model.ts): `src/features/theme/model.ts`
- [Theme conversion](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/conversion.ts): `src/features/theme/conversion.ts`
- [CSS export](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/export-css.ts): `src/features/theme/export-css.ts`
- [CSS import](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/import-css.ts): `src/features/theme/import-css.ts`
- [Export panel](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/ExportPanel.tsx): `src/features/theme/components/ExportPanel.tsx`
- [Import panel](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/theme/components/ImportCssPanel.tsx): `src/features/theme/components/ImportCssPanel.tsx`

### Theme previews

- [Component gallery](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/ComponentGallery.tsx): `src/features/playground/ComponentGallery.tsx`
- [Component index](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/components/ComponentIndex.tsx): `src/features/playground/components/ComponentIndex.tsx`
- [Collage preview](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/playground/components/CollagePreview.tsx): `src/features/playground/components/CollagePreview.tsx`
- [Web preview](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/website/RealWebsite.tsx): `src/features/website/RealWebsite.tsx`
- [Native preview](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/NativePreviewPage.tsx): `src/features/native/NativePreviewPage.tsx`
- [Native viewer](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/runtime/App.tsx): `src/features/native/runtime/App.tsx`
- [Device presets](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/native/device-presets.ts): `src/features/native/device-presets.ts`

### AI assistant

- [AI assistant panel](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/AIGeneratorPanel.tsx): `src/features/ai/AIGeneratorPanel.tsx`
- [AI generation](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/useThemeAI.ts): `src/features/ai/useThemeAI.ts`
- [Model catalog](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/model.ts): `src/features/ai/model.ts`
- [GPU diagnostics](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/diagnostics.ts): `src/features/ai/diagnostics.ts`
- [Storage planning](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/storage.ts): `src/features/ai/storage.ts`
- [Prompt requests](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/request.ts): `src/features/ai/request.ts`
- [Theme generation](https://github.com/javiluli/heroui-theme-studio/blob/master/src/features/ai/generate-theme.ts): `src/features/ai/generate-theme.ts`

### Other components

- **Studio user**
- **Browser storage**
- **WebGPU runtime**
- **WebLLM engine**

## Connections

- Studio user → Studio app: uses (evidence: `README.md`)
- Studio app → Theme context: reads theme (evidence: `src/app/App.tsx`)
- Studio app → Studio header: renders (evidence: `src/app/App.tsx`)
- Studio app → View routing: routes views (evidence: `src/app/App.tsx`)
- Studio app → Export panel: opens export (evidence: `src/app/App.tsx`)
- Studio app → Import panel: opens import (evidence: `src/app/App.tsx`)
- Studio app → Component index: renders (evidence: `src/app/App.tsx`)
- Theme context → Theme editor: uses (evidence: `src/features/theme/ThemeStudioContext.tsx`)
- Theme editor → Theme storage: loads and saves (evidence: `src/features/theme/useThemeEditor.ts`)
- Theme editor → Theme presets: selects presets (evidence: `src/features/theme/useThemeEditor.ts`)
- Theme editor → Theme model: updates (evidence: `src/features/theme/useThemeEditor.ts`)
- Theme editor → Theme conversion: converts theme (evidence: `src/features/theme/useThemeEditor.ts`)
- Editor controls → Theme context: edits theme (evidence: `src/features/theme/components/EditorPanel.tsx`)
- Theme storage → Browser storage: persists theme (evidence: `src/features/theme/storage.ts`)
- Theme presets → Theme model: builds presets (evidence: `src/features/theme/templates/index.ts`)
- Theme conversion → Theme model: transforms tokens (evidence: `src/features/theme/conversion.ts`)
- Export panel → CSS export: exports CSS (evidence: `src/app/App.tsx`)
- CSS export → Theme conversion: gets variables (evidence: `src/features/theme/export-css.ts`)
- Studio app → CSS export: prepares CSS (evidence: `src/app/App.tsx`)
- Import panel → Theme context: applies imported theme (evidence: `src/app/App.tsx`)
- Studio user → Component gallery: explores components (evidence: `README.md`)
- Component gallery → Component index: uses catalog (evidence: `src/features/playground/ComponentGallery.tsx`)
- Component gallery → Collage preview: shows collage (evidence: `src/features/playground/ComponentGallery.tsx`)
- Studio user → Web preview: views web (evidence: `README.md`)
- Studio user → Native preview: chooses native (evidence: `README.md`)
- Native preview → Device presets: offers sizes (evidence: `src/features/native/NativePreviewPage.tsx`)
- Native preview → Native viewer: sends preview theme
- Studio user → AI assistant panel: requests proposal (evidence: `README.md`)
- AI assistant panel → AI generation: requests generation (evidence: `src/features/ai/AIGeneratorPanel.tsx`)
- AI generation → GPU diagnostics: checks GPU (evidence: `src/features/ai/useThemeAI.ts`)
- AI generation → Model catalog: chooses models (evidence: `src/features/ai/useThemeAI.ts`)
- AI generation → Storage planning: plans downloads (evidence: `src/features/ai/useThemeAI.ts`)
- AI generation → Prompt requests: builds prompt (evidence: `src/features/ai/useThemeAI.ts`)
- AI generation → Theme generation: recovers output (evidence: `src/features/ai/useThemeAI.ts`)
- AI generation → WebGPU runtime: checks capability
- AI generation → WebLLM engine: loads engine (evidence: `src/features/ai/useThemeAI.ts`)
- AI assistant panel → Theme context: applies on confirmation
