# gab1-flt/brainout architecture

> Architecture diagram of the GitHub repository gab1-flt/brainout, 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/gab1-flt/brainout
- Repository: https://github.com/gab1-flt/brainout

## Overview

BrainOut turns written or dictated thoughts into structured project notebooks. The user submits a brain dump; App coordinates AI structuring, selects the resulting project, and renders it in the five-tab workspace. The sidebar supports navigation and project management, while settings handle API keys and JSON backup. The README documents browser speech input, Gemini and heuristic generation, and localStorage persistence; several implementation excerpts are partial, so unsampled details are represented only where documented.

Main entry points: [`src/App.tsx`](https://github.com/gab1-flt/brainout/blob/main/src/App.tsx) (App State Controller), [`src/services/aiService.ts`](https://github.com/gab1-flt/brainout/blob/main/src/services/aiService.ts) (AI Structuring Service), [`src/components/BrainDumpZone.tsx`](https://github.com/gab1-flt/brainout/blob/main/src/components/BrainDumpZone.tsx) (Brain Dump Zone), [`src/components/ProjectView.tsx`](https://github.com/gab1-flt/brainout/blob/main/src/components/ProjectView.tsx) (Five-Tab Workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Idea Capture"]
  node_brain_dump["Brain Dump Zone<br/>[BrainDumpZone.tsx]"]
end

subgraph group_app["Notebook Application"]
  node_app_state["App State Controller<br/>[App.tsx]"]
  node_sidebar["Project Sidebar<br/>[Sidebar.tsx]"]
  node_workspace["Five-Tab Workspace<br/>[ProjectView.tsx]"]
  node_settings["Settings and Backup<br/>[SettingsModal.tsx]"]
end

subgraph group_generation["Idea Structuring"]
  node_ai_service["AI Structuring Service<br/>[aiService.ts]"]
  node_heuristic["Offline Heuristic Engine<br/>[aiService.ts]"]
end

subgraph group_support["Models and Portability"]
  node_project_model["Project Idea Model<br/>[project.ts]"]
  node_demo_projects["Sample Projects<br/>[mockProjects.ts]"]
end

node_user(("Notebook User"))
node_speech{{"Browser Speech API"}}
node_gemini{{"Google Gemini API"}}
node_local_storage[("Browser Local Storage")]

node_user -->|"enters idea"| node_brain_dump
node_speech -->|"transcribes speech"| node_brain_dump
node_brain_dump -->|"submits text"| node_app_state
node_app_state -->|"renders capture"| node_brain_dump
node_app_state -->|"renders and supplies state"| node_sidebar
node_sidebar -->|"selects and manages projects"| node_app_state
node_app_state -->|"renders active project"| node_workspace
node_workspace -->|"updates project"| node_app_state
node_app_state -->|"renders and supplies data"| node_settings
node_settings -->|"saves key and imports"| node_app_state
node_app_state -->|"requests structuring"| node_ai_service
node_ai_service -->|"returns project"| node_app_state
node_ai_service -->|"posts generation request"| node_gemini
node_ai_service -->|"falls back offline"| node_heuristic
node_heuristic -->|"returns project"| node_app_state
node_workspace -->|"builds sketch data"| node_ai_service
node_app_state -->|"loads and persists state"| node_local_storage
node_app_state -->|"loads initial projects"| node_demo_projects
node_settings -->|"exports JSON backup"| node_user

click node_brain_dump "https://github.com/gab1-flt/brainout/blob/main/src/components/BrainDumpZone.tsx"
click node_app_state "https://github.com/gab1-flt/brainout/blob/main/src/App.tsx"
click node_sidebar "https://github.com/gab1-flt/brainout/blob/main/src/components/Sidebar.tsx"
click node_workspace "https://github.com/gab1-flt/brainout/blob/main/src/components/ProjectView.tsx"
click node_settings "https://github.com/gab1-flt/brainout/blob/main/src/components/SettingsModal.tsx"
click node_ai_service "https://github.com/gab1-flt/brainout/blob/main/src/services/aiService.ts"
click node_heuristic "https://github.com/gab1-flt/brainout/blob/main/src/services/aiService.ts"
click node_project_model "https://github.com/gab1-flt/brainout/blob/main/src/types/project.ts"
click node_demo_projects "https://github.com/gab1-flt/brainout/blob/main/src/data/mockProjects.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_brain_dump,node_user,node_speech toneBlue
class node_app_state,node_sidebar,node_workspace,node_settings,node_local_storage toneAmber
class node_ai_service,node_heuristic,node_gemini toneMint
class node_project_model,node_demo_projects toneRose
```

## Components

### Idea Capture

- [Brain Dump Zone](https://github.com/gab1-flt/brainout/blob/main/src/components/BrainDumpZone.tsx): `src/components/BrainDumpZone.tsx`

### Notebook Application

- [App State Controller](https://github.com/gab1-flt/brainout/blob/main/src/App.tsx): `src/App.tsx`
- [Project Sidebar](https://github.com/gab1-flt/brainout/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Five-Tab Workspace](https://github.com/gab1-flt/brainout/blob/main/src/components/ProjectView.tsx): `src/components/ProjectView.tsx`
- [Settings and Backup](https://github.com/gab1-flt/brainout/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`

### Idea Structuring

- [AI Structuring Service](https://github.com/gab1-flt/brainout/blob/main/src/services/aiService.ts): `src/services/aiService.ts`
- [Offline Heuristic Engine](https://github.com/gab1-flt/brainout/blob/main/src/services/aiService.ts): `src/services/aiService.ts`

### Models and Portability

- [Project Idea Model](https://github.com/gab1-flt/brainout/blob/main/src/types/project.ts): `src/types/project.ts`
- [Sample Projects](https://github.com/gab1-flt/brainout/blob/main/src/data/mockProjects.ts): `src/data/mockProjects.ts`

### Other components

- **Notebook User**
- **Browser Speech API**
- **Google Gemini API**
- **Browser Local Storage**

## Connections

- Notebook User → Brain Dump Zone: enters idea (evidence: `README.md`)
- Browser Speech API → Brain Dump Zone: transcribes speech (evidence: `README.md`)
- Brain Dump Zone → App State Controller: submits text (evidence: `src/App.tsx`)
- App State Controller → Brain Dump Zone: renders capture (evidence: `src/App.tsx`)
- App State Controller → Project Sidebar: renders and supplies state (evidence: `src/App.tsx`)
- Project Sidebar → App State Controller: selects and manages projects (evidence: `src/App.tsx`)
- App State Controller → Five-Tab Workspace: renders active project (evidence: `src/App.tsx`)
- Five-Tab Workspace → App State Controller: updates project (evidence: `src/App.tsx`)
- App State Controller → Settings and Backup: renders and supplies data (evidence: `src/App.tsx`)
- Settings and Backup → App State Controller: saves key and imports (evidence: `src/App.tsx`)
- App State Controller → AI Structuring Service: requests structuring (evidence: `src/App.tsx`)
- AI Structuring Service → App State Controller: returns project (evidence: `src/App.tsx`)
- AI Structuring Service → Google Gemini API: posts generation request (evidence: `README.md`)
- AI Structuring Service → Offline Heuristic Engine: falls back offline (evidence: `README.md`)
- Offline Heuristic Engine → App State Controller: returns project (evidence: `README.md`)
- Five-Tab Workspace → AI Structuring Service: builds sketch data (evidence: `src/components/ProjectView.tsx`)
- App State Controller → Browser Local Storage: loads and persists state (evidence: `README.md`)
- App State Controller → Sample Projects: loads initial projects (evidence: `src/App.tsx`)
- Settings and Backup → Notebook User: exports JSON backup (evidence: `README.md`)
