# lucas-free-games/github-story-map architecture

> Architecture diagram of the GitHub repository lucas-free-games/github-story-map, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucas-free-games/github-story-map
- Repository: https://github.com/lucas-free-games/github-story-map

## Overview

#### Purpose and Entry Points
GitHub Story Map is a Vite-built React SPA for managing GitHub Issues as label-driven story-map, Kanban, timeline, roadmap, waves, and table views. Browser startup is `src/main.tsx`, which mounts `src/App.tsx`; Firebase Hosting configuration is `firebase.json`.

#### Application Shell and View Routing
`src/App.tsx` composes the authenticated/setup states, header, issue dialogs, deep-linked issue reader, and active board view. `src/components/Header.tsx` controls repository and view selection. Primary visual projections are implemented independently in `src/components/StoryMap.tsx`, `src/components/KanbanView.tsx`, and `src/components/TableView.tsx`; all derive from the same issue state.

#### Central State and GitHub Synchronization
`src/store/appStore.ts` is the application control plane: it holds credentials, selected repository, issues, labels, layouts, active view, and modal/UI state. It fetches and mutates GitHub issues, applies optimistic local updates, and refreshes board projections. GitHub REST calls are encapsulated in `src/lib/github.ts`; issue/label shapes and view-facing domain types live in `src/types/index.ts`.

#### Label-Driven Domain Model
GitHub is the authoritative issue system. Prefix labels create board semantics: `e_*` defines user activities, `w_*` waves, `s_*` Kanban status, and `epic` contextual activities. `src/components/UserActivitiesView.tsx` and `src/components/WavesView.tsx` manage this organizational layer; `src/components/LabelsManagerModal.tsx` manages GitHub labels. Creation and editing flow through `src/components/CreateIssueModal.tsx` and `src/components/EditIssueModal.tsx`, translating placement choices into GitHub issue labels.

#### Issue Interaction Boundary
Issue cards and rows open `src/components/IssueReadModal.tsx`, which renders Markdown and exposes edit, close/reopen, delete, and AI actions. `src/components/IssueCard.tsx` provides direct board-level actions. Markdown rendering is local in `src/lib/markdown.ts`; image attachment behavior is isolated in `src/components/ImageAttacher.tsx`. URL deep links identify issue numbers and are resolved by the application shell.

#### Authentication, Persistence, and Runtime Infrastructure
GitHub OAuth is mediated by Firebase Auth: `src/lib/auth.ts` opens the GitHub provider popup and caches the returned token in browser localStorage. Firebase initialization and optional Firestore-backed layout persistence are in `src/lib/firebase.ts`; access restrictions are defined by `firestore.rules`. The frontend runs entirely in the browser, built by Vite (`vite.config.ts`) and deployed through Firebase Hosting. A separate Firebase Functions TypeScript project exists at `functions/src/index.ts`, with compiled output under `functions/lib/`.

#### Optional AI Integrations and Credential Boundary
Gemini-powered issue-description generation is client-side in `src/lib/gemini.ts`; Claude Managed Agent implementation sessions are client-side in `src/lib/anthropic.ts`. Per-user API keys and agent configuration are maintained in localStorage through `src/lib/userKeys.ts` and configured in `src/components/SettingsView.tsx`. These calls directly target external Google and Anthropic APIs; GitHub credentials and AI secrets are intentionally not persisted by the application backend.

Main entry points: [`src/App.tsx`](https://github.com/lucas-free-games/github-story-map/blob/master/src/App.tsx) (Application shell), [`src/store/appStore.ts`](https://github.com/lucas-free-games/github-story-map/blob/master/src/store/appStore.ts) (App store), [`src/components/IssueReadModal.tsx`](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/IssueReadModal.tsx) (Issue reader), [`src/lib/auth.ts`](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/auth.ts) (GitHub OAuth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser SPA"]
  node_main["Browser entry<br/>React bootstrap<br/>[main.tsx]"]
  node_app["Application shell<br/>React root<br/>[App.tsx]"]
  node_header["Header<br/>navigation<br/>[Header.tsx]"]
  node_store["App store<br/>state control plane<br/>[appStore.ts]"]
  node_github["GitHub REST client<br/>API adapter<br/>[github.ts]"]
  node_types["Domain types<br/>TypeScript types<br/>[index.ts]"]
  node_boards["Board projections<br/>React views<br/>[StoryMap.tsx]"]
  node_organization["Activities and waves<br/>organization views"]
  node_issuecard["Issue cards<br/>board interaction<br/>[IssueCard.tsx]"]
  node_issueviewer["Issue reader<br/>issue modal<br/>[IssueReadModal.tsx]"]
  node_issueeditor["Issue create/edit<br/>issue dialogs"]
  node_markdown["Markdown renderer<br/>local rendering<br/>[markdown.ts]"]
  node_auth["GitHub OAuth<br/>Firebase Auth adapter<br/>[auth.ts]"]
  node_settings["AI settings and keys<br/>local credentials<br/>[SettingsView.tsx]"]
  node_ai["AI clients<br/>client-side integrations<br/>[gemini.ts]"]
end

subgraph group_firebase["Firebase"]
  node_firebaseinit["Firebase integration<br/>Firebase client<br/>[firebase.ts]"]
  node_firestore[("Firestore layouts<br/>optional persistence<br/>[firestore.rules]")]
  node_hosting{{"Firebase Hosting<br/>deployment<br/>[firebase.json]"}}
  node_functions["Firebase Functions<br/>separate TypeScript runtime<br/>[index.ts]"]
end

subgraph group_external["External APIs"]
  node_githubapi[("GitHub Issues API<br/>authoritative issue system")]
  node_providers["Google and Anthropic APIs<br/>AI providers"]
end

node_vite{{"Vite build<br/>build config<br/>[vite.config.ts]"}}

node_vite -->|"builds"| node_main
node_main -->|"mounts"| node_app
node_app -->|"renders"| node_header
node_app -->|"reads and dispatches"| node_store
node_app -->|"selects active view"| node_boards
node_store -->|"syncs issues and labels"| node_github
node_github -->|"REST calls"| node_githubapi
node_store -->|"uses"| node_types
node_store -->|"supplies issue state"| node_boards
node_organization -->|"organizes by labels"| node_boards
node_issuecard -->|"opens"| node_issueviewer
node_app -->|"resolves deep links"| node_issueviewer
node_issueeditor -->|"creates and mutates issues"| node_store
node_issueviewer -->|"renders issue content"| node_markdown
node_auth -->|"OAuth token authorizes"| node_githubapi
node_app -->|"authenticates"| node_auth
node_settings -->|"configures keys"| node_ai
node_issueviewer -->|"invokes AI actions"| node_ai
node_ai -->|"direct client calls"| node_providers
node_firebaseinit -.->|"persists layouts optionally"| node_firestore
node_auth -->|"uses Firebase Auth"| node_firebaseinit
node_hosting -->|"serves built SPA"| node_vite

click node_vite "https://github.com/lucas-free-games/github-story-map/blob/master/vite.config.ts"
click node_main "https://github.com/lucas-free-games/github-story-map/blob/master/src/main.tsx"
click node_app "https://github.com/lucas-free-games/github-story-map/blob/master/src/App.tsx"
click node_header "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/Header.tsx"
click node_store "https://github.com/lucas-free-games/github-story-map/blob/master/src/store/appStore.ts"
click node_github "https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/github.ts"
click node_types "https://github.com/lucas-free-games/github-story-map/blob/master/src/types/index.ts"
click node_boards "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/StoryMap.tsx"
click node_organization "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/UserActivitiesView.tsx"
click node_issuecard "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/IssueCard.tsx"
click node_issueviewer "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/IssueReadModal.tsx"
click node_issueeditor "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/CreateIssueModal.tsx"
click node_markdown "https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/markdown.ts"
click node_auth "https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/auth.ts"
click node_settings "https://github.com/lucas-free-games/github-story-map/blob/master/src/components/SettingsView.tsx"
click node_ai "https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/gemini.ts"
click node_firebaseinit "https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/firebase.ts"
click node_firestore "https://github.com/lucas-free-games/github-story-map/blob/master/firestore.rules"
click node_hosting "https://github.com/lucas-free-games/github-story-map/blob/master/firebase.json"
click node_functions "https://github.com/lucas-free-games/github-story-map/blob/master/functions/src/index.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_main,node_app,node_header,node_store,node_github,node_types,node_boards,node_organization,node_issuecard,node_issueviewer,node_issueeditor,node_markdown,node_auth,node_settings,node_ai toneBlue
class node_firebaseinit,node_firestore,node_hosting,node_functions toneAmber
class node_githubapi,node_providers toneMint
class node_vite toneNeutral
```

## Components

### Browser SPA

Vite-built React application.

- [Browser entry](https://github.com/lucas-free-games/github-story-map/blob/master/src/main.tsx): React bootstrap · `src/main.tsx`
- [Application shell](https://github.com/lucas-free-games/github-story-map/blob/master/src/App.tsx): React root · Composes auth states, dialogs, deep links, and active board view. · `src/App.tsx`
- [Header](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/Header.tsx): navigation · Selects repository and board view. · `src/components/Header.tsx`
- [App store](https://github.com/lucas-free-games/github-story-map/blob/master/src/store/appStore.ts): state control plane · Owns credentials, repository, issues, labels, layouts, views, and UI state. · `src/store/appStore.ts`
- [GitHub REST client](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/github.ts): API adapter · `src/lib/github.ts`
- [Domain types](https://github.com/lucas-free-games/github-story-map/blob/master/src/types/index.ts): TypeScript types · Issue, label, and view-facing shapes. · `src/types/index.ts`
- [Board projections](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/StoryMap.tsx): React views · Story map, Kanban, and table derive from shared issue state. · `src/components/StoryMap.tsx`
- [Activities and waves](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/UserActivitiesView.tsx): organization views · Maps e_*, w_*, s_*, and epic labels into board organization. · `src/components/UserActivitiesView.tsx`
- [Issue cards](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/IssueCard.tsx): board interaction · `src/components/IssueCard.tsx`
- [Issue reader](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/IssueReadModal.tsx): issue modal · Deep-linked issue view with lifecycle and AI actions. · `src/components/IssueReadModal.tsx`
- [Issue create/edit](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/CreateIssueModal.tsx): issue dialogs · Translates placement choices into GitHub labels. · `src/components/CreateIssueModal.tsx`
- [Markdown renderer](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/markdown.ts): local rendering · `src/lib/markdown.ts`
- [GitHub OAuth](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/auth.ts): Firebase Auth adapter · Caches the popup token in browser localStorage. · `src/lib/auth.ts`
- [AI settings and keys](https://github.com/lucas-free-games/github-story-map/blob/master/src/components/SettingsView.tsx): local credentials · Maintains per-user API keys and agent configuration in localStorage. · `src/components/SettingsView.tsx`
- [AI clients](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/gemini.ts): client-side integrations · Gemini generation and Claude agent sessions run directly from the browser. · `src/lib/gemini.ts`

### Firebase

Auth, optional persistence, hosting, and functions.

- [Firebase integration](https://github.com/lucas-free-games/github-story-map/blob/master/src/lib/firebase.ts): Firebase client · Initializes Firebase and optionally persists layouts in Firestore. · `src/lib/firebase.ts`
- [Firestore layouts](https://github.com/lucas-free-games/github-story-map/blob/master/firestore.rules): optional persistence · Access is constrained by Firestore rules. · `firestore.rules`
- [Firebase Hosting](https://github.com/lucas-free-games/github-story-map/blob/master/firebase.json): deployment · `firebase.json`
- [Firebase Functions](https://github.com/lucas-free-games/github-story-map/blob/master/functions/src/index.ts): separate TypeScript runtime · Compiled output is deployed separately from the SPA. · `functions/src/index.ts`

### External APIs

- **GitHub Issues API**: authoritative issue system · Issues and prefix labels are the board source of truth.
- **Google and Anthropic APIs**: AI providers

### Other components

- [Vite build](https://github.com/lucas-free-games/github-story-map/blob/master/vite.config.ts): build config · `vite.config.ts`

## Connections

- Vite build → Browser entry: builds
- Browser entry → Application shell: mounts
- Application shell → Header: renders
- Application shell → App store: reads and dispatches
- Application shell → Board projections: selects active view
- App store → GitHub REST client: syncs issues and labels
- GitHub REST client → GitHub Issues API: REST calls
- App store → Domain types: uses
- App store → Board projections: supplies issue state
- Activities and waves → Board projections: organizes by labels
- Issue cards → Issue reader: opens
- Application shell → Issue reader: resolves deep links
- Issue create/edit → App store: creates and mutates issues
- Issue reader → Markdown renderer: renders issue content
- GitHub OAuth → GitHub Issues API: OAuth token authorizes
- Application shell → GitHub OAuth: authenticates
- AI settings and keys → AI clients: configures keys
- Issue reader → AI clients: invokes AI actions
- AI clients → Google and Anthropic APIs: direct client calls
- Firebase integration → Firestore layouts: persists layouts optionally
- GitHub OAuth → Firebase integration: uses Firebase Auth
- Firebase Hosting → Vite build: serves built SPA
