# laseronwood/kinky-tcg architecture

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

- Interactive diagram: https://gitdiagram.com/laseronwood/kinky-tcg
- Repository: https://github.com/laseronwood/kinky-tcg

## Overview

Kinky TCG is a browser-based, offline-capable card-and-riddle game for couples. The game master creates or imports a themed deck; the target player selects a theme, solves password-protected cards, uses progressive hints, and reveals card actions while progress is saved per theme. Separate branches provide a visual card catalog, sound effects, anonymous feedback, and optional Discord notifications. Paths and connections reflect the README and sampled code; some UI wiring and unsampled modules are not shown where call ownership could not be verified.

Main entry points: [`js/passemot.js`](https://github.com/laseronwood/kinky-tcg/blob/main/js/passemot.js) (Card and hint play), [`index.html`](https://github.com/laseronwood/kinky-tcg/blob/main/index.html) (Game entry), [`js/level-builder.js`](https://github.com/laseronwood/kinky-tcg/blob/main/js/level-builder.js) (Theme editor), [`sw.js`](https://github.com/laseronwood/kinky-tcg/blob/main/sw.js) (Offline service worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game play"]
  node_game_ui["Game entry<br/>[index.html]"]
  node_theme_data["Theme decks<br/>[cartes.json]"]
  node_theme_selector["Theme selection<br/>[passemot.js]"]
  node_carousel["Theme carousel<br/>[carousel.js]"]
  node_card_game["Card and hint play<br/>[passemot.js]"]
  node_hashing["Password hashing<br/>[hasheur.js]"]
  node_progress[("Saved progress")]
  node_browser_storage[("Browser storage")]
  node_card_art["Card illustrations"]
  node_sound_effects["Sound effects<br/>[audio.js]"]
  node_audio_files["Audio files"]
end

subgraph group_authoring["Theme authoring"]
  node_builder_page["Level builder<br/>[level-builder.html]"]
  node_builder_logic["Theme editor<br/>[level-builder.js]"]
end

subgraph group_catalog["Visual catalog"]
  node_gallery_page["Gallery page<br/>[gallery.html]"]
  node_gallery_logic["Gallery search and zoom<br/>[gallery.js]"]
  node_gallery_inventory["Image inventory<br/>[gallery.json]"]
end

subgraph group_integrations["Optional services"]
  node_feedback_form["Feedback form<br/>[feedback.js]"]
  node_feedback_api["Feedback endpoint<br/>[feedback.js]"]
  node_notification_client["Notification client<br/>[notification.js]"]
  node_notification_api["Notification endpoint<br/>[notification.js]"]
end

subgraph group_offline["Offline support"]
  node_offline_worker["Offline service worker<br/>[sw.js]"]
  node_offline_cache[("Browser caches")]
end

node_game_master(("Game master"))
node_target_player(("Target player"))
node_discord{{"Discord webhooks"}}

node_game_master -->|"opens editor"| node_builder_page
node_builder_page -->|"loads editor"| node_builder_logic
node_builder_logic -->|"selects images"| node_card_art
node_builder_logic -->|"hashes answers"| node_hashing
node_builder_logic -->|"exports theme"| node_game_master
node_game_master -->|"opens game"| node_game_ui
node_game_ui -->|"loads decks"| node_theme_data
node_game_ui -->|"starts selection"| node_theme_selector
node_theme_selector -->|"renders themes"| node_carousel
node_target_player -->|"plays game"| node_game_ui
node_target_player -->|"chooses theme"| node_theme_selector
node_theme_selector -->|"opens deck"| node_card_game
node_card_game -->|"checks answer"| node_hashing
node_card_game -->|"saves unlocks"| node_progress
node_card_game -->|"reads and writes"| node_browser_storage
node_card_game -->|"plays effects"| node_sound_effects
node_sound_effects -->|"loads audio"| node_audio_files
node_card_game -.->|"notifies reveal"| node_notification_client
node_notification_client -.->|"posts reveal"| node_notification_api
node_notification_api -.->|"sends embed"| node_discord
node_target_player -->|"submits feedback"| node_feedback_form
node_feedback_form -->|"posts message"| node_feedback_api
node_feedback_api -->|"sends feedback"| node_discord
node_game_master -->|"browses artwork"| node_gallery_page
node_gallery_page -->|"loads catalog"| node_gallery_logic
node_gallery_logic -->|"loads inventory"| node_gallery_inventory
node_offline_worker -->|"reads deck images"| node_theme_data
node_offline_worker -->|"caches app and media"| node_offline_cache
node_game_ui -->|"registers worker"| node_offline_worker

click node_game_ui "https://github.com/laseronwood/kinky-tcg/blob/main/index.html"
click node_theme_data "https://github.com/laseronwood/kinky-tcg/blob/main/json/cartes.json"
click node_theme_selector "https://github.com/laseronwood/kinky-tcg/blob/main/js/passemot.js"
click node_carousel "https://github.com/laseronwood/kinky-tcg/blob/main/js/carousel.js"
click node_card_game "https://github.com/laseronwood/kinky-tcg/blob/main/js/passemot.js"
click node_hashing "https://github.com/laseronwood/kinky-tcg/blob/main/js/hasheur.js"
click node_card_art "https://github.com/laseronwood/kinky-tcg/tree/main/assets/cartes"
click node_sound_effects "https://github.com/laseronwood/kinky-tcg/blob/main/js/audio.js"
click node_audio_files "https://github.com/laseronwood/kinky-tcg/tree/main/assets/audio"
click node_builder_page "https://github.com/laseronwood/kinky-tcg/blob/main/level-builder.html"
click node_builder_logic "https://github.com/laseronwood/kinky-tcg/blob/main/js/level-builder.js"
click node_gallery_page "https://github.com/laseronwood/kinky-tcg/blob/main/gallery.html"
click node_gallery_logic "https://github.com/laseronwood/kinky-tcg/blob/main/js/gallery.js"
click node_gallery_inventory "https://github.com/laseronwood/kinky-tcg/blob/main/json/gallery.json"
click node_feedback_form "https://github.com/laseronwood/kinky-tcg/blob/main/js/feedback.js"
click node_feedback_api "https://github.com/laseronwood/kinky-tcg/blob/main/api/feedback.js"
click node_notification_client "https://github.com/laseronwood/kinky-tcg/blob/main/js/notification.js"
click node_notification_api "https://github.com/laseronwood/kinky-tcg/blob/main/api/notification.js"
click node_offline_worker "https://github.com/laseronwood/kinky-tcg/blob/main/sw.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_game_ui,node_theme_data,node_theme_selector,node_carousel,node_card_game,node_hashing,node_progress,node_browser_storage,node_card_art,node_sound_effects,node_audio_files toneBlue
class node_builder_page,node_builder_logic toneAmber
class node_gallery_page,node_gallery_logic,node_gallery_inventory,node_discord toneMint
class node_feedback_form,node_feedback_api,node_notification_client,node_notification_api toneRose
class node_offline_worker,node_offline_cache,node_game_master,node_target_player toneIndigo
```

## Components

### Game play

- [Game entry](https://github.com/laseronwood/kinky-tcg/blob/main/index.html): `index.html`
- [Theme decks](https://github.com/laseronwood/kinky-tcg/blob/main/json/cartes.json): `json/cartes.json`
- [Theme selection](https://github.com/laseronwood/kinky-tcg/blob/main/js/passemot.js): `js/passemot.js`
- [Theme carousel](https://github.com/laseronwood/kinky-tcg/blob/main/js/carousel.js): `js/carousel.js`
- [Card and hint play](https://github.com/laseronwood/kinky-tcg/blob/main/js/passemot.js): `js/passemot.js`
- [Password hashing](https://github.com/laseronwood/kinky-tcg/blob/main/js/hasheur.js): `js/hasheur.js`
- **Saved progress**
- **Browser storage**
- [Card illustrations](https://github.com/laseronwood/kinky-tcg/tree/main/assets/cartes): `assets/cartes`
- [Sound effects](https://github.com/laseronwood/kinky-tcg/blob/main/js/audio.js): `js/audio.js`
- [Audio files](https://github.com/laseronwood/kinky-tcg/tree/main/assets/audio): `assets/audio`

### Theme authoring

- [Level builder](https://github.com/laseronwood/kinky-tcg/blob/main/level-builder.html): `level-builder.html`
- [Theme editor](https://github.com/laseronwood/kinky-tcg/blob/main/js/level-builder.js): `js/level-builder.js`

### Visual catalog

- [Gallery page](https://github.com/laseronwood/kinky-tcg/blob/main/gallery.html): `gallery.html`
- [Gallery search and zoom](https://github.com/laseronwood/kinky-tcg/blob/main/js/gallery.js): `js/gallery.js`
- [Image inventory](https://github.com/laseronwood/kinky-tcg/blob/main/json/gallery.json): `json/gallery.json`

### Optional services

- [Feedback form](https://github.com/laseronwood/kinky-tcg/blob/main/js/feedback.js): `js/feedback.js`
- [Feedback endpoint](https://github.com/laseronwood/kinky-tcg/blob/main/api/feedback.js): `api/feedback.js`
- [Notification client](https://github.com/laseronwood/kinky-tcg/blob/main/js/notification.js): `js/notification.js`
- [Notification endpoint](https://github.com/laseronwood/kinky-tcg/blob/main/api/notification.js): `api/notification.js`

### Offline support

- [Offline service worker](https://github.com/laseronwood/kinky-tcg/blob/main/sw.js): `sw.js`
- **Browser caches**

### Other components

- **Game master**
- **Target player**
- **Discord webhooks**

## Connections

- Game master → Level builder: opens editor
- Level builder → Theme editor: loads editor
- Theme editor → Card illustrations: selects images
- Theme editor → Password hashing: hashes answers
- Theme editor → Game master: exports theme
- Game master → Game entry: opens game
- Game entry → Theme decks: loads decks
- Game entry → Theme selection: starts selection
- Theme selection → Theme carousel: renders themes
- Target player → Game entry: plays game
- Target player → Theme selection: chooses theme
- Theme selection → Card and hint play: opens deck
- Card and hint play → Password hashing: checks answer
- Card and hint play → Saved progress: saves unlocks
- Card and hint play → Browser storage: reads and writes
- Card and hint play → Sound effects: plays effects
- Sound effects → Audio files: loads audio
- Card and hint play → Notification client: notifies reveal
- Notification client → Notification endpoint: posts reveal
- Notification endpoint → Discord webhooks: sends embed
- Target player → Feedback form: submits feedback
- Feedback form → Feedback endpoint: posts message
- Feedback endpoint → Discord webhooks: sends feedback
- Game master → Gallery page: browses artwork
- Gallery page → Gallery search and zoom: loads catalog
- Gallery search and zoom → Image inventory: loads inventory
- Offline service worker → Theme decks: reads deck images
- Offline service worker → Browser caches: caches app and media
- Game entry → Offline service worker: registers worker
