# amal1971/storyarc architecture

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

- Interactive diagram: https://gitdiagram.com/amal1971/storyarc
- Repository: https://github.com/amal1971/storyarc

## Overview

StoryArc is a browser-based speaking coach built around two practice loops: Story Lab and Story Gym. Users choose a prompt or situation, record, type, or load a sample story, then receive feedback and retell it; the app compares attempts and stores session records locally. The API provides speech transcription, AI analysis, comparison, and an access gate. The graph preserves documented capabilities, but several API and UI implementations were not excerpted, so their links rely on README statements or SOURCE INDEX references.

Main entry points: [`src/App.jsx`](https://github.com/amal1971/storyarc/blob/main/src/App.jsx) (App flow), [`src/components/RecordScreen.jsx`](https://github.com/amal1971/storyarc/blob/main/src/components/RecordScreen.jsx) (Record inputs), [`src/lib/analyze.js`](https://github.com/amal1971/storyarc/blob/main/src/lib/analyze.js) (Analysis client), [`src/lib/auth.js`](https://github.com/amal1971/storyarc/blob/main/src/lib/auth.js) (Access client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice experience"]
  node_app["App flow<br/>[App.jsx]"]
  node_record["Record inputs<br/>[RecordScreen.jsx]"]
  node_recorder["Microphone capture<br/>[useRecorder.js]"]
  node_lab["Story Lab feedback<br/>[FeedbackScreen.jsx]"]
  node_gym["Story Gym feedback"]
  node_delta["Attempt comparison UI<br/>[DeltaScreen.jsx]"]
  node_gymdelta["Gym round UI<br/>[GymDeltaScreen.jsx]"]
  node_history["History and export<br/>[HistoryScreen.jsx]"]
  node_prompts["Prompts and situations<br/>[prompts.js]"]
end

subgraph group_analysis["Story analysis"]
  node_frameworks["Framework registry<br/>[frameworks.js]"]
  node_filler["Filler detection<br/>[fillers.js]"]
  node_analysisclient["Analysis client<br/>[analyze.js]"]
  node_sttclient["Speech-to-text client<br/>[stt.js]"]
  node_samples["Sample recordings<br/>[samples.js]"]
end

subgraph group_server["API services"]
  node_transcribe["Transcription API<br/>[transcribe.js]"]
  node_fillersapi["Filler analysis API<br/>[analyze-fillers.js]"]
  node_structureapi["Story structure API"]
  node_frameworkapi["Framework analysis API"]
  node_compareapi["Attempt comparison API"]
  node_gemini["Gemini client<br/>[_gemini.js]"]
end

subgraph group_state["Session and access"]
  node_sessionrecords[("Local session records<br/>[session.js]")]
  node_authclient["Access client<br/>[auth.js]"]
  node_authapi["Google sign-in API<br/>[auth-google.js]"]
  node_statusapi["Session status API<br/>[session-status.js]"]
  node_logoutapi["Logout API<br/>[logout.js]"]
  node_sessionhelper["Session helper<br/>[_session.js]"]
  node_usage[("Usage persistence<br/>[_usage.js]")]
end

node_speaker(("Speaker"))
node_deepgram{{"Deepgram"}}

node_speaker -->|"provides story"| node_record
node_record -->|"captures audio"| node_recorder
node_record -->|"loads sample"| node_samples
node_app -->|"shows screen"| node_record
node_app -->|"shows feedback"| node_lab
node_app -->|"shows feedback"| node_gym
node_app -->|"shows comparison"| node_delta
node_app -->|"shows comparison"| node_gymdelta
node_app -->|"shows history"| node_history
node_app -->|"selects prompt"| node_prompts
node_record -->|"submits attempt"| node_app
node_app -->|"transcribes audio"| node_sttclient
node_sttclient -->|"posts audio"| node_transcribe
node_transcribe -->|"transcribes"| node_deepgram
node_app -->|"requests analysis"| node_analysisclient
node_analysisclient -->|"detects fillers"| node_filler
node_analysisclient -->|"posts analysis"| node_fillersapi
node_analysisclient -->|"posts analysis"| node_structureapi
node_app -->|"requests verdict"| node_frameworkapi
node_frameworkapi -->|"reads definitions"| node_frameworks
node_frameworkapi -->|"calls model"| node_gemini
node_fillersapi -.->|"calls model"| node_gemini
node_structureapi -.->|"calls model"| node_gemini
node_app -->|"requests comparison"| node_compareapi
node_compareapi -->|"calls model"| node_gemini
node_compareapi -->|"reads definitions"| node_frameworks
node_app -->|"saves attempts"| node_sessionrecords
node_history -->|"loads records"| node_sessionrecords
node_app -->|"checks session"| node_authclient
node_authclient -->|"fetches status"| node_statusapi
node_authclient -->|"posts credential"| node_authapi
node_authclient -->|"posts logout"| node_logoutapi
node_authapi -->|"manages session"| node_sessionhelper
node_statusapi -->|"checks session"| node_sessionhelper
node_sessionhelper -->|"persists usage"| node_usage

click node_app "https://github.com/amal1971/storyarc/blob/main/src/App.jsx"
click node_record "https://github.com/amal1971/storyarc/blob/main/src/components/RecordScreen.jsx"
click node_recorder "https://github.com/amal1971/storyarc/blob/main/src/lib/useRecorder.js"
click node_lab "https://github.com/amal1971/storyarc/blob/main/src/components/FeedbackScreen.jsx"
click node_gym "https://github.com/amal1971/storyarc/blob/main/src/components/GymFeedbackScreen.jsx"
click node_delta "https://github.com/amal1971/storyarc/blob/main/src/components/DeltaScreen.jsx"
click node_gymdelta "https://github.com/amal1971/storyarc/blob/main/src/components/GymDeltaScreen.jsx"
click node_history "https://github.com/amal1971/storyarc/blob/main/src/components/HistoryScreen.jsx"
click node_prompts "https://github.com/amal1971/storyarc/blob/main/src/lib/prompts.js"
click node_frameworks "https://github.com/amal1971/storyarc/blob/main/src/lib/frameworks.js"
click node_filler "https://github.com/amal1971/storyarc/blob/main/src/lib/fillers.js"
click node_analysisclient "https://github.com/amal1971/storyarc/blob/main/src/lib/analyze.js"
click node_sttclient "https://github.com/amal1971/storyarc/blob/main/src/lib/stt.js"
click node_samples "https://github.com/amal1971/storyarc/blob/main/src/lib/samples.js"
click node_transcribe "https://github.com/amal1971/storyarc/blob/main/api/transcribe.js"
click node_fillersapi "https://github.com/amal1971/storyarc/blob/main/api/analyze-fillers.js"
click node_structureapi "https://github.com/amal1971/storyarc/blob/main/api/analyze-structure.js"
click node_frameworkapi "https://github.com/amal1971/storyarc/blob/main/api/analyze-framework.js"
click node_compareapi "https://github.com/amal1971/storyarc/blob/main/api/compare-attempts.js"
click node_gemini "https://github.com/amal1971/storyarc/blob/main/api/_gemini.js"
click node_sessionrecords "https://github.com/amal1971/storyarc/blob/main/src/lib/session.js"
click node_authclient "https://github.com/amal1971/storyarc/blob/main/src/lib/auth.js"
click node_authapi "https://github.com/amal1971/storyarc/blob/main/api/auth-google.js"
click node_statusapi "https://github.com/amal1971/storyarc/blob/main/api/session-status.js"
click node_logoutapi "https://github.com/amal1971/storyarc/blob/main/api/logout.js"
click node_sessionhelper "https://github.com/amal1971/storyarc/blob/main/api/_session.js"
click node_usage "https://github.com/amal1971/storyarc/blob/main/api/_usage.js"

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_record,node_recorder,node_lab,node_gym,node_delta,node_gymdelta,node_history,node_prompts toneBlue
class node_frameworks,node_filler,node_analysisclient,node_sttclient,node_samples toneAmber
class node_transcribe,node_fillersapi,node_structureapi,node_frameworkapi,node_compareapi,node_gemini toneMint
class node_sessionrecords,node_authclient,node_authapi,node_statusapi,node_logoutapi,node_sessionhelper,node_usage toneRose
class node_speaker,node_deepgram toneIndigo
```

## Components

### Practice experience

- [App flow](https://github.com/amal1971/storyarc/blob/main/src/App.jsx): `src/App.jsx`
- [Record inputs](https://github.com/amal1971/storyarc/blob/main/src/components/RecordScreen.jsx): `src/components/RecordScreen.jsx`
- [Microphone capture](https://github.com/amal1971/storyarc/blob/main/src/lib/useRecorder.js): `src/lib/useRecorder.js`
- [Story Lab feedback](https://github.com/amal1971/storyarc/blob/main/src/components/FeedbackScreen.jsx): `src/components/FeedbackScreen.jsx`
- [Story Gym feedback](https://github.com/amal1971/storyarc/blob/main/src/components/GymFeedbackScreen.jsx): `src/components/GymFeedbackScreen.jsx`
- [Attempt comparison UI](https://github.com/amal1971/storyarc/blob/main/src/components/DeltaScreen.jsx): `src/components/DeltaScreen.jsx`
- [Gym round UI](https://github.com/amal1971/storyarc/blob/main/src/components/GymDeltaScreen.jsx): `src/components/GymDeltaScreen.jsx`
- [History and export](https://github.com/amal1971/storyarc/blob/main/src/components/HistoryScreen.jsx): `src/components/HistoryScreen.jsx`
- [Prompts and situations](https://github.com/amal1971/storyarc/blob/main/src/lib/prompts.js): `src/lib/prompts.js`

### Story analysis

- [Framework registry](https://github.com/amal1971/storyarc/blob/main/src/lib/frameworks.js): `src/lib/frameworks.js`
- [Filler detection](https://github.com/amal1971/storyarc/blob/main/src/lib/fillers.js): `src/lib/fillers.js`
- [Analysis client](https://github.com/amal1971/storyarc/blob/main/src/lib/analyze.js): `src/lib/analyze.js`
- [Speech-to-text client](https://github.com/amal1971/storyarc/blob/main/src/lib/stt.js): `src/lib/stt.js`
- [Sample recordings](https://github.com/amal1971/storyarc/blob/main/src/lib/samples.js): `src/lib/samples.js`

### API services

- [Transcription API](https://github.com/amal1971/storyarc/blob/main/api/transcribe.js): `api/transcribe.js`
- [Filler analysis API](https://github.com/amal1971/storyarc/blob/main/api/analyze-fillers.js): `api/analyze-fillers.js`
- [Story structure API](https://github.com/amal1971/storyarc/blob/main/api/analyze-structure.js): `api/analyze-structure.js`
- [Framework analysis API](https://github.com/amal1971/storyarc/blob/main/api/analyze-framework.js): `api/analyze-framework.js`
- [Attempt comparison API](https://github.com/amal1971/storyarc/blob/main/api/compare-attempts.js): `api/compare-attempts.js`
- [Gemini client](https://github.com/amal1971/storyarc/blob/main/api/_gemini.js): `api/_gemini.js`

### Session and access

- [Local session records](https://github.com/amal1971/storyarc/blob/main/src/lib/session.js): `src/lib/session.js`
- [Access client](https://github.com/amal1971/storyarc/blob/main/src/lib/auth.js): `src/lib/auth.js`
- [Google sign-in API](https://github.com/amal1971/storyarc/blob/main/api/auth-google.js): `api/auth-google.js`
- [Session status API](https://github.com/amal1971/storyarc/blob/main/api/session-status.js): `api/session-status.js`
- [Logout API](https://github.com/amal1971/storyarc/blob/main/api/logout.js): `api/logout.js`
- [Session helper](https://github.com/amal1971/storyarc/blob/main/api/_session.js): `api/_session.js`
- [Usage persistence](https://github.com/amal1971/storyarc/blob/main/api/_usage.js): `api/_usage.js`

### Other components

- **Speaker**
- **Deepgram**

## Connections

- Speaker → Record inputs: provides story (evidence: `src/components/RecordScreen.jsx`)
- Record inputs → Microphone capture: captures audio (evidence: `src/components/RecordScreen.jsx`)
- Record inputs → Sample recordings: loads sample (evidence: `src/components/RecordScreen.jsx`)
- App flow → Record inputs: shows screen (evidence: `src/App.jsx`)
- App flow → Story Lab feedback: shows feedback (evidence: `src/App.jsx`)
- App flow → Story Gym feedback: shows feedback (evidence: `src/App.jsx`)
- App flow → Attempt comparison UI: shows comparison (evidence: `src/App.jsx`)
- App flow → Gym round UI: shows comparison (evidence: `src/App.jsx`)
- App flow → History and export: shows history (evidence: `src/App.jsx`)
- App flow → Prompts and situations: selects prompt
- Record inputs → App flow: submits attempt (evidence: `src/App.jsx`)
- App flow → Speech-to-text client: transcribes audio (evidence: `README.md`)
- Speech-to-text client → Transcription API: posts audio (evidence: `README.md`)
- Transcription API → Deepgram: transcribes (evidence: `README.md`)
- App flow → Analysis client: requests analysis (evidence: `src/App.jsx`)
- Analysis client → Filler detection: detects fillers (evidence: `src/lib/analyze.js`)
- Analysis client → Filler analysis API: posts analysis (evidence: `README.md`)
- Analysis client → Story structure API: posts analysis (evidence: `README.md`)
- App flow → Framework analysis API: requests verdict (evidence: `src/App.jsx`)
- Framework analysis API → Framework registry: reads definitions (evidence: `api/analyze-framework.js`)
- Framework analysis API → Gemini client: calls model (evidence: `api/analyze-framework.js`)
- Filler analysis API → Gemini client: calls model
- Story structure API → Gemini client: calls model
- App flow → Attempt comparison API: requests comparison (evidence: `README.md`)
- Attempt comparison API → Gemini client: calls model (evidence: `api/compare-attempts.js`)
- Attempt comparison API → Framework registry: reads definitions (evidence: `api/compare-attempts.js`)
- App flow → Local session records: saves attempts (evidence: `src/App.jsx`)
- History and export → Local session records: loads records (evidence: `src/App.jsx`)
- App flow → Access client: checks session (evidence: `src/App.jsx`)
- Access client → Session status API: fetches status (evidence: `src/lib/auth.js`)
- Access client → Google sign-in API: posts credential (evidence: `src/lib/auth.js`)
- Access client → Logout API: posts logout (evidence: `src/lib/auth.js`)
- Google sign-in API → Session helper: manages session (evidence: `api/auth-google.js`)
- Session status API → Session helper: checks session (evidence: `api/session-status.js`)
- Session helper → Usage persistence: persists usage (evidence: `api/_session.js`)
