# der-anonyme-gamer/fakeit architecture

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

- Interactive diagram: https://gitdiagram.com/der-anonyme-gamer/fakeit
- Repository: https://github.com/der-anonyme-gamer/fakeit

## Overview

FakeIt is a browser-based social-deduction party game delivered as a hash-routed PWA. Players configure a round, reveal roles one at a time, discuss the secret word, run the timer, and view the impostor results; replay returns the same players and settings to setup. Separate branches cover custom-category management and offline/PWA support. The sampled code shows the router, setup, category manager, game phases, and service worker; other documented capabilities are represented only where the tree supports a path.

Main entry points: [`main.js`](https://github.com/der-anonyme-gamer/fakeit/blob/main/main.js) (Hash router), [`sites/newgame.js`](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/newgame.js) (Round setup), [`sites/categories.js`](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/categories.js) (Category manager), [`sites/game.js`](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js) (Role reveal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_router["Hash router<br/>[main.js]"]
  node_home["Home page<br/>[home.html]"]
  node_info["Info page<br/>[info.html]"]
end

subgraph group_round["Round play"]
  node_setup["Round setup<br/>[newgame.js]"]
  node_category_data["Default categories"]
  node_game_data[("Round state")]
  node_role_reveal["Role reveal<br/>[game.js]"]
  node_discussion_timer["Discussion timer<br/>[game.js]"]
  node_results["Impostor results<br/>[game.js]"]
  node_replay["Replay setup<br/>[game.js]"]
end

subgraph group_categories["Category management"]
  node_category_manager["Category manager<br/>[categories.js]"]
  node_custom_categories[("Custom categories")]
  node_category_export["Category import/export<br/>[categories.js]"]
end

subgraph group_pwa["Offline and PWA"]
  node_manifest["PWA metadata<br/>[manifest.json]"]
  node_offline_cache[("Offline cache<br/>[service-worker.js]")]
end

node_player(("Player"))
node_browser(("Browser"))

node_player -->|"opens app"| node_router
node_router -->|"fetches page"| node_home
node_router -->|"fetches page"| node_info
node_router -->|"loads and initializes"| node_setup
node_router -->|"loads and initializes"| node_category_manager
node_router -->|"loads and initializes"| node_role_reveal
node_player -->|"configures round"| node_setup
node_setup -->|"fetches defaults"| node_category_data
node_setup -.->|"reads custom data"| node_custom_categories
node_setup -->|"saves round"| node_game_data
node_game_data -.->|"provides roles"| node_role_reveal
node_role_reveal -->|"advances phase"| node_discussion_timer
node_discussion_timer -->|"advances phase"| node_results
node_results -->|"offers replay"| node_replay
node_replay -->|"restores settings"| node_setup
node_player -->|"manages categories"| node_category_manager
node_category_manager -->|"loads defaults"| node_category_data
node_category_manager -->|"reads and writes"| node_custom_categories
node_category_manager -->|"exports and imports"| node_category_export
node_browser -->|"loads app"| node_router
node_router -->|"registers worker"| node_offline_cache
node_offline_cache -->|"caches app assets"| node_browser
node_browser -.->|"uses install metadata"| node_manifest

click node_router "https://github.com/der-anonyme-gamer/fakeit/blob/main/main.js"
click node_home "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/home.html"
click node_info "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/info.html"
click node_setup "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/newgame.js"
click node_category_data "https://github.com/der-anonyme-gamer/fakeit/blob/main/assets/default_categories.json"
click node_role_reveal "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js"
click node_discussion_timer "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js"
click node_results "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js"
click node_replay "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js"
click node_category_manager "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/categories.js"
click node_category_export "https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/categories.js"
click node_manifest "https://github.com/der-anonyme-gamer/fakeit/blob/main/manifest.json"
click node_offline_cache "https://github.com/der-anonyme-gamer/fakeit/blob/main/service-worker.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_router,node_home,node_info,node_browser toneBlue
class node_setup,node_category_data,node_game_data,node_role_reveal,node_discussion_timer,node_results,node_replay toneAmber
class node_category_manager,node_custom_categories,node_category_export toneMint
class node_manifest,node_offline_cache toneRose
class node_player toneIndigo
```

## Components

### App navigation

- [Hash router](https://github.com/der-anonyme-gamer/fakeit/blob/main/main.js): `main.js`
- [Home page](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/home.html): `sites/home.html`
- [Info page](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/info.html): `sites/info.html`

### Round play

- [Round setup](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/newgame.js): `sites/newgame.js`
- [Default categories](https://github.com/der-anonyme-gamer/fakeit/blob/main/assets/default_categories.json): `assets/default_categories.json`
- **Round state**
- [Role reveal](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js): `sites/game.js`
- [Discussion timer](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js): `sites/game.js`
- [Impostor results](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js): `sites/game.js`
- [Replay setup](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/game.js): `sites/game.js`

### Category management

- [Category manager](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/categories.js): `sites/categories.js`
- **Custom categories**
- [Category import/export](https://github.com/der-anonyme-gamer/fakeit/blob/main/sites/categories.js): `sites/categories.js`

### Offline and PWA

- [PWA metadata](https://github.com/der-anonyme-gamer/fakeit/blob/main/manifest.json): `manifest.json`
- [Offline cache](https://github.com/der-anonyme-gamer/fakeit/blob/main/service-worker.js): `service-worker.js`

### Other components

- **Player**
- **Browser**

## Connections

- Player → Hash router: opens app (evidence: `README.md`)
- Hash router → Home page: fetches page (evidence: `main.js`)
- Hash router → Info page: fetches page (evidence: `main.js`)
- Hash router → Round setup: loads and initializes (evidence: `main.js`)
- Hash router → Category manager: loads and initializes (evidence: `main.js`)
- Hash router → Role reveal: loads and initializes (evidence: `main.js`)
- Player → Round setup: configures round (evidence: `README.md`)
- Round setup → Default categories: fetches defaults (evidence: `sites/newgame.js`)
- Round setup → Custom categories: reads custom data
- Round setup → Round state: saves round (evidence: `sites/newgame.js`)
- Round state → Role reveal: provides roles
- Role reveal → Discussion timer: advances phase (evidence: `sites/game.js`)
- Discussion timer → Impostor results: advances phase (evidence: `sites/game.js`)
- Impostor results → Replay setup: offers replay (evidence: `sites/game.js`)
- Replay setup → Round setup: restores settings (evidence: `sites/game.js`)
- Player → Category manager: manages categories (evidence: `README.md`)
- Category manager → Default categories: loads defaults (evidence: `sites/categories.js`)
- Category manager → Custom categories: reads and writes (evidence: `sites/categories.js`)
- Category manager → Category import/export: exports and imports (evidence: `sites/categories.js`)
- Browser → Hash router: loads app (evidence: `main.js`)
- Hash router → Offline cache: registers worker (evidence: `main.js`)
- Offline cache → Browser: caches app assets (evidence: `service-worker.js`)
- Browser → PWA metadata: uses install metadata
