# earljohncabog03/brainstack-pwa-app architecture

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

- Interactive diagram: https://gitdiagram.com/earljohncabog03/brainstack-pwa-app
- Repository: https://github.com/earljohncabog03/brainstack-pwa-app

## Overview

Brainstack is a browser-based quiz and study-dashboard app. Learners enter through the home page, create a quiz, take it, and review dashboard data; the sampled quiz pages persist quizzes and attempts in IndexedDB. The app also exposes an install page and shared home-page feature/CTA sections. A retry-capable LLM client exists, but the excerpts do not show it being called by quiz creation, so that integration is not inferred. Some page details are based only on imports and routing references in the SOURCE INDEX.

Main entry points: [`src/App.tsx`](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/App.tsx) (App routing), [`src/pages/CreateQuiz.tsx`](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/CreateQuiz.tsx) (Quiz creation), [`src/components/layout/Header.tsx`](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/layout/Header.tsx) (Site header), [`src/components/home`](https://github.com/earljohncabog03/brainstack-pwa-app/tree/main/src/components/home) (Home sections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and navigation"]
  node_app["App routing<br/>[App.tsx]"]
  node_home["Home page<br/>[Index.tsx]"]
  node_home_sections["Home sections"]
  node_header["Site header<br/>[Header.tsx]"]
  node_notfound["Not found page<br/>[NotFound.tsx]"]
end

subgraph group_learning["Quiz learning workflow"]
  node_create["Quiz creation<br/>[CreateQuiz.tsx]"]
  node_take["Quiz taking<br/>[TakeQuiz.tsx]"]
  node_dashboard["Study dashboard<br/>[Dashboard.tsx]"]
  node_install["App installation<br/>[Install.tsx]"]
end

subgraph group_persistence["Local study data"]
  node_db[("IndexedDB data layer<br/>[db.ts]")]
  node_llm["LLM retry client<br/>[llmClient.ts]"]
  node_retry["Retry helper<br/>[retry.ts]"]
  node_logger["Logger<br/>[logger.ts]"]
end

subgraph group_shared["Shared UI and utilities"]
  node_button["Button component<br/>[button.tsx]"]
  node_input["Input component<br/>[input.tsx]"]
  node_progress["Progress component<br/>[progress.tsx]"]
  node_utils["Class utilities<br/>[utils.ts]"]
end

node_learner(("Learner"))

node_learner -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_create
node_app -->|"routes to"| node_take
node_app -->|"routes to"| node_install
node_app -->|"catches routes"| node_notfound
node_home -->|"renders"| node_home_sections
node_home -->|"renders"| node_header
node_home_sections -->|"links to"| node_create
node_home_sections -->|"links to"| node_dashboard
node_create -->|"saves quiz and count"| node_db
node_take -->|"loads quiz and saves attempt"| node_db
node_dashboard -->|"reads study data"| node_db
node_create -->|"renders"| node_header
node_take -->|"renders"| node_header
node_dashboard -->|"renders"| node_header
node_install -->|"renders"| node_header
node_home_sections -->|"uses"| node_button
node_create -->|"uses"| node_button
node_create -->|"uses"| node_input
node_take -->|"uses"| node_progress
node_header -->|"uses"| node_button
node_button -->|"merges classes with"| node_utils
node_input -->|"uses"| node_utils
node_llm -->|"retries calls with"| node_retry
node_llm -->|"logs retries with"| node_logger

click node_app "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/App.tsx"
click node_home "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Index.tsx"
click node_home_sections "https://github.com/earljohncabog03/brainstack-pwa-app/tree/main/src/components/home"
click node_header "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/layout/Header.tsx"
click node_create "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/CreateQuiz.tsx"
click node_take "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/TakeQuiz.tsx"
click node_dashboard "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Dashboard.tsx"
click node_install "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Install.tsx"
click node_notfound "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/NotFound.tsx"
click node_db "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/db.ts"
click node_llm "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/llmClient.ts"
click node_retry "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/retry.ts"
click node_logger "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/logger.ts"
click node_button "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/button.tsx"
click node_input "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/input.tsx"
click node_progress "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/progress.tsx"
click node_utils "https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/utils.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_home,node_home_sections,node_header,node_notfound toneBlue
class node_create,node_take,node_dashboard,node_install toneAmber
class node_db,node_llm,node_retry,node_logger toneMint
class node_button,node_input,node_progress,node_utils toneRose
class node_learner toneIndigo
```

## Components

### App entry and navigation

- [App routing](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/App.tsx): `src/App.tsx`
- [Home page](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Home sections](https://github.com/earljohncabog03/brainstack-pwa-app/tree/main/src/components/home): `src/components/home`
- [Site header](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/layout/Header.tsx): `src/components/layout/Header.tsx`
- [Not found page](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/NotFound.tsx): `src/pages/NotFound.tsx`

### Quiz learning workflow

- [Quiz creation](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/CreateQuiz.tsx): `src/pages/CreateQuiz.tsx`
- [Quiz taking](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/TakeQuiz.tsx): `src/pages/TakeQuiz.tsx`
- [Study dashboard](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [App installation](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/pages/Install.tsx): `src/pages/Install.tsx`

### Local study data

- [IndexedDB data layer](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [LLM retry client](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/llmClient.ts): `src/lib/llmClient.ts`
- [Retry helper](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/retry.ts): `src/lib/retry.ts`
- [Logger](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/logger.ts): `src/lib/logger.ts`

### Shared UI and utilities

- [Button component](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Input component](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Progress component](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/components/ui/progress.tsx): `src/components/ui/progress.tsx`
- [Class utilities](https://github.com/earljohncabog03/brainstack-pwa-app/blob/main/src/lib/utils.ts): `src/lib/utils.ts`

### Other components

- **Learner**

## Connections

- Learner → App routing: opens (evidence: `src/App.tsx`)
- App routing → Home page: routes to (evidence: `src/App.tsx`)
- App routing → Study dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Quiz creation: routes to (evidence: `src/App.tsx`)
- App routing → Quiz taking: routes to (evidence: `src/App.tsx`)
- App routing → App installation: routes to (evidence: `src/App.tsx`)
- App routing → Not found page: catches routes (evidence: `src/App.tsx`)
- Home page → Home sections: renders (evidence: `src/pages/Index.tsx`)
- Home page → Site header: renders (evidence: `src/pages/Index.tsx`)
- Home sections → Quiz creation: links to (evidence: `src/components/home/Hero.tsx`)
- Home sections → Study dashboard: links to (evidence: `src/components/home/Hero.tsx`)
- Quiz creation → IndexedDB data layer: saves quiz and count (evidence: `src/pages/CreateQuiz.tsx`)
- Quiz taking → IndexedDB data layer: loads quiz and saves attempt (evidence: `src/pages/TakeQuiz.tsx`)
- Study dashboard → IndexedDB data layer: reads study data (evidence: `src/pages/Dashboard.tsx`)
- Quiz creation → Site header: renders (evidence: `src/pages/CreateQuiz.tsx`)
- Quiz taking → Site header: renders (evidence: `src/pages/TakeQuiz.tsx`)
- Study dashboard → Site header: renders (evidence: `src/pages/Dashboard.tsx`)
- App installation → Site header: renders (evidence: `src/pages/Install.tsx`)
- Home sections → Button component: uses (evidence: `src/components/home/Hero.tsx`)
- Quiz creation → Button component: uses (evidence: `src/pages/CreateQuiz.tsx`)
- Quiz creation → Input component: uses (evidence: `src/pages/CreateQuiz.tsx`)
- Quiz taking → Progress component: uses (evidence: `src/pages/TakeQuiz.tsx`)
- Site header → Button component: uses (evidence: `src/components/layout/Header.tsx`)
- Button component → Class utilities: merges classes with (evidence: `src/components/ui/button.tsx`)
- Input component → Class utilities: uses (evidence: `src/components/ui/input.tsx`)
- LLM retry client → Retry helper: retries calls with (evidence: `src/lib/llmClient.ts`)
- LLM retry client → Logger: logs retries with (evidence: `src/lib/llmClient.ts`)
