# dthompsonza/swapokay architecture

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

## Overview

SwapOkay is a client-side collectible collection tracker and swap-finder. The main workflow is to choose a collectible kind, create and update a named collection, then share its encoded QR/link or compare it with another collection by scanning or pasting a code. Collections persist in browser localStorage; kind catalogues load from static JSON. The graph also preserves import, browsing, informational pages, and sound controls. Evidence is limited to the README, source index references, and excerpts shown; unsampled page details and some display wiring are not inferred.

Main entry points: [`src/app/pages/collection.ts`](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/collection.ts) (Collection editor), [`src/app/core/collection-store.ts`](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-store.ts) (Collection store), [`src/app/core/kind.service.ts`](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/kind.service.ts) (Kind catalogue service), [`src/app/app.routes.ts`](https://github.com/dthompsonza/swapokay/blob/main/src/app/app.routes.ts) (Page routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App and pages"]
  node_app["App shell<br/>[app.ts]"]
  node_routes["Page routing<br/>[app.routes.ts]"]
  node_home["Kind browser<br/>[home.ts]"]
  node_kindpage["Kind collections<br/>[kind.ts]"]
  node_about["About page<br/>[about.ts]"]
  node_sponsors["Sponsors page<br/>[sponsors.ts]"]
end

subgraph group_collections["Collection management"]
  node_newcollection["Create collection<br/>[new-collection.ts]"]
  node_collection["Collection editor<br/>[collection.ts]"]
  node_iconpicker["Icon picker<br/>[icon-picker.ts]"]
  node_itemmodal["Item detail modal<br/>[item-modal.ts]"]
end

subgraph group_sharing["Sharing and swaps"]
  node_import["Import modal<br/>[import-modal.ts]"]
  node_shared["Shared collection view"]
  node_compare["Swap comparison<br/>[compare.ts]"]
  node_qrshow["QR display<br/>[qr-show.ts]"]
  node_modal["Modal frame<br/>[modal.ts]"]
end

subgraph group_domain["Domain and persistence"]
  node_store["Collection store"]
  node_localstorage[("Browser storage")]
  node_codec["Collection codec"]
  node_icons["Collection icons"]
  node_models["Domain models<br/>[models.ts]"]
  node_kindservice["Kind catalogue service<br/>[kind.service.ts]"]
  node_catalogue["Kind JSON data<br/>[kinds.json]"]
  node_kinddata["Collectible data<br/>[CHK2026.json]"]
  node_swapdiff["Swap calculation<br/>[swap-diff.ts]"]
  node_share["Share link<br/>[share.ts]"]
  node_sound["Sound settings<br/>[sound.service.ts]"]
end

node_user(("Collector"))
node_camera(("Camera"))

node_user -->|"uses"| node_app
node_app -->|"hosts"| node_routes
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_kindpage
node_routes -->|"routes to"| node_newcollection
node_routes -->|"routes to"| node_collection
node_routes -->|"routes to"| node_about
node_routes -->|"routes to"| node_sponsors
node_home -->|"loads kinds"| node_kindservice
node_kindpage -->|"loads kind"| node_kindservice
node_kindpage -->|"reads collections"| node_store
node_newcollection -->|"loads kind"| node_kindservice
node_newcollection -->|"creates collection"| node_store
node_newcollection -->|"uses"| node_iconpicker
node_collection -->|"loads kind"| node_kindservice
node_collection -->|"updates collection"| node_store
node_collection -->|"encodes counts"| node_codec
node_collection -->|"opens QR"| node_qrshow
node_collection -->|"opens comparison"| node_compare
node_collection -->|"uses"| node_iconpicker
node_collection -->|"opens details"| node_itemmodal
node_collection -->|"plays sounds"| node_sound
node_collection -->|"creates link"| node_share
node_store -->|"reads and writes"| node_localstorage
node_store -->|"encodes counts"| node_codec
node_store -->|"validates icons"| node_icons
node_store -->|"stores records"| node_models
node_kindservice -->|"fetches index"| node_catalogue
node_kindservice -->|"fetches kind file"| node_kinddata
node_kindservice -->|"types data"| node_models
node_import -->|"decodes code"| node_codec
node_import -->|"imports collection"| node_store
node_app -->|"opens"| node_import
node_app -->|"shows shared code"| node_shared
node_shared -->|"decodes code"| node_codec
node_shared -->|"loads kind"| node_kindservice
node_shared -->|"reads collections"| node_store
node_shared -->|"opens comparison"| node_compare
node_compare -->|"decodes code"| node_codec
node_compare -->|"computes swaps"| node_swapdiff
node_compare -->|"scans with"| node_camera
node_qrshow -->|"creates share link"| node_share
node_qrshow -->|"renders in"| node_modal
node_compare -->|"renders in"| node_modal
node_iconpicker -->|"selects icon"| node_icons
node_itemmodal -->|"renders in"| node_modal
node_import -->|"renders in"| node_modal
node_sound -->|"reads and writes"| node_localstorage

click node_app "https://github.com/dthompsonza/swapokay/blob/main/src/app/app.ts"
click node_routes "https://github.com/dthompsonza/swapokay/blob/main/src/app/app.routes.ts"
click node_home "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/home.ts"
click node_kindpage "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/kind.ts"
click node_about "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/about.ts"
click node_sponsors "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/sponsors.ts"
click node_newcollection "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/new-collection.ts"
click node_collection "https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/collection.ts"
click node_store "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-store.ts"
click node_codec "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-codec.ts"
click node_icons "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-icons.ts"
click node_models "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/models.ts"
click node_kindservice "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/kind.service.ts"
click node_catalogue "https://github.com/dthompsonza/swapokay/blob/main/public/data/kinds.json"
click node_kinddata "https://github.com/dthompsonza/swapokay/blob/main/public/data/CHK2026.json"
click node_import "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/import-modal.ts"
click node_shared "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/shared-collection.ts"
click node_compare "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/compare.ts"
click node_swapdiff "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/swap-diff.ts"
click node_qrshow "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/qr-show.ts"
click node_share "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/share.ts"
click node_iconpicker "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/icon-picker.ts"
click node_itemmodal "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/item-modal.ts"
click node_modal "https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/modal.ts"
click node_sound "https://github.com/dthompsonza/swapokay/blob/main/src/app/core/sound.service.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_routes,node_home,node_kindpage,node_about,node_sponsors toneBlue
class node_newcollection,node_collection,node_iconpicker,node_itemmodal toneAmber
class node_import,node_shared,node_compare,node_qrshow,node_modal toneMint
class node_store,node_localstorage,node_codec,node_icons,node_models,node_kindservice,node_catalogue,node_kinddata,node_swapdiff,node_share,node_sound toneRose
class node_user,node_camera toneIndigo
```

## Components

### App and pages

- [App shell](https://github.com/dthompsonza/swapokay/blob/main/src/app/app.ts): `src/app/app.ts`
- [Page routing](https://github.com/dthompsonza/swapokay/blob/main/src/app/app.routes.ts): `src/app/app.routes.ts`
- [Kind browser](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/home.ts): `src/app/pages/home.ts`
- [Kind collections](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/kind.ts): `src/app/pages/kind.ts`
- [About page](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/about.ts): `src/app/pages/about.ts`
- [Sponsors page](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/sponsors.ts): `src/app/pages/sponsors.ts`

### Collection management

- [Create collection](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/new-collection.ts): `src/app/pages/new-collection.ts`
- [Collection editor](https://github.com/dthompsonza/swapokay/blob/main/src/app/pages/collection.ts): `src/app/pages/collection.ts`
- [Icon picker](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/icon-picker.ts): `src/app/shared/icon-picker.ts`
- [Item detail modal](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/item-modal.ts): `src/app/shared/item-modal.ts`

### Sharing and swaps

- [Import modal](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/import-modal.ts): `src/app/shared/import-modal.ts`
- [Shared collection view](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/shared-collection.ts): `src/app/shared/shared-collection.ts`
- [Swap comparison](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/compare.ts): `src/app/shared/compare.ts`
- [QR display](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/qr-show.ts): `src/app/shared/qr-show.ts`
- [Modal frame](https://github.com/dthompsonza/swapokay/blob/main/src/app/shared/modal.ts): `src/app/shared/modal.ts`

### Domain and persistence

- [Collection store](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-store.ts): `src/app/core/collection-store.ts`
- **Browser storage**
- [Collection codec](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-codec.ts): `src/app/core/collection-codec.ts`
- [Collection icons](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/collection-icons.ts): `src/app/core/collection-icons.ts`
- [Domain models](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/models.ts): `src/app/core/models.ts`
- [Kind catalogue service](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/kind.service.ts): `src/app/core/kind.service.ts`
- [Kind JSON data](https://github.com/dthompsonza/swapokay/blob/main/public/data/kinds.json): `public/data/kinds.json`
- [Collectible data](https://github.com/dthompsonza/swapokay/blob/main/public/data/CHK2026.json): `public/data/CHK2026.json`
- [Swap calculation](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/swap-diff.ts): `src/app/core/swap-diff.ts`
- [Share link](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/share.ts): `src/app/core/share.ts`
- [Sound settings](https://github.com/dthompsonza/swapokay/blob/main/src/app/core/sound.service.ts): `src/app/core/sound.service.ts`

### Other components

- **Collector**
- **Camera**

## Connections

- Collector → App shell: uses (evidence: `src/app/app.ts`)
- App shell → Page routing: hosts (evidence: `src/app/app.ts`)
- Page routing → Kind browser: routes to (evidence: `src/app/app.routes.ts`)
- Page routing → Kind collections: routes to (evidence: `src/app/app.routes.ts`)
- Page routing → Create collection: routes to (evidence: `src/app/app.routes.ts`)
- Page routing → Collection editor: routes to (evidence: `src/app/app.routes.ts`)
- Page routing → About page: routes to (evidence: `src/app/app.routes.ts`)
- Page routing → Sponsors page: routes to (evidence: `src/app/app.routes.ts`)
- Kind browser → Kind catalogue service: loads kinds (evidence: `src/app/pages/home.ts`)
- Kind collections → Kind catalogue service: loads kind (evidence: `src/app/pages/kind.ts`)
- Kind collections → Collection store: reads collections (evidence: `src/app/pages/kind.ts`)
- Create collection → Kind catalogue service: loads kind (evidence: `src/app/pages/new-collection.ts`)
- Create collection → Collection store: creates collection (evidence: `src/app/pages/new-collection.ts`)
- Create collection → Icon picker: uses (evidence: `src/app/pages/new-collection.ts`)
- Collection editor → Kind catalogue service: loads kind (evidence: `src/app/pages/collection.ts`)
- Collection editor → Collection store: updates collection (evidence: `src/app/pages/collection.ts`)
- Collection editor → Collection codec: encodes counts (evidence: `src/app/pages/collection.ts`)
- Collection editor → QR display: opens QR (evidence: `src/app/pages/collection.ts`)
- Collection editor → Swap comparison: opens comparison (evidence: `src/app/pages/collection.ts`)
- Collection editor → Icon picker: uses (evidence: `src/app/pages/collection.ts`)
- Collection editor → Item detail modal: opens details (evidence: `src/app/pages/collection.ts`)
- Collection editor → Sound settings: plays sounds (evidence: `src/app/pages/collection.ts`)
- Collection editor → Share link: creates link (evidence: `src/app/pages/collection.ts`)
- Collection store → Browser storage: reads and writes (evidence: `src/app/core/collection-store.ts`)
- Collection store → Collection codec: encodes counts (evidence: `src/app/core/collection-store.ts`)
- Collection store → Collection icons: validates icons (evidence: `src/app/core/collection-store.ts`)
- Collection store → Domain models: stores records (evidence: `src/app/core/collection-store.ts`)
- Kind catalogue service → Kind JSON data: fetches index (evidence: `src/app/core/kind.service.ts`)
- Kind catalogue service → Collectible data: fetches kind file (evidence: `src/app/core/kind.service.ts`)
- Kind catalogue service → Domain models: types data (evidence: `src/app/core/kind.service.ts`)
- Import modal → Collection codec: decodes code (evidence: `src/app/shared/import-modal.ts`)
- Import modal → Collection store: imports collection (evidence: `src/app/shared/import-modal.ts`)
- App shell → Import modal: opens (evidence: `src/app/app.ts`)
- App shell → Shared collection view: shows shared code (evidence: `src/app/app.ts`)
- Shared collection view → Collection codec: decodes code (evidence: `src/app/shared/shared-collection.ts`)
- Shared collection view → Kind catalogue service: loads kind (evidence: `src/app/shared/shared-collection.ts`)
- Shared collection view → Collection store: reads collections (evidence: `src/app/shared/shared-collection.ts`)
- Shared collection view → Swap comparison: opens comparison (evidence: `src/app/shared/shared-collection.ts`)
- Swap comparison → Collection codec: decodes code (evidence: `src/app/shared/compare.ts`)
- Swap comparison → Swap calculation: computes swaps (evidence: `src/app/shared/compare.ts`)
- Swap comparison → Camera: scans with (evidence: `src/app/shared/compare.ts`)
- QR display → Share link: creates share link (evidence: `src/app/shared/qr-show.ts`)
- QR display → Modal frame: renders in (evidence: `src/app/shared/qr-show.ts`)
- Swap comparison → Modal frame: renders in (evidence: `src/app/shared/compare.ts`)
- Icon picker → Collection icons: selects icon (evidence: `src/app/shared/icon-picker.ts`)
- Item detail modal → Modal frame: renders in (evidence: `src/app/shared/item-modal.ts`)
- Import modal → Modal frame: renders in (evidence: `src/app/shared/import-modal.ts`)
- Sound settings → Browser storage: reads and writes (evidence: `src/app/core/sound.service.ts`)
