# theault-dev/dojo-des-songes architecture

> Architecture diagram of the GitHub repository theault-dev/dojo-des-songes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theault-dev/dojo-des-songes
- Repository: https://github.com/theault-dev/dojo-des-songes

## Overview

Dojo des Songes is a static Dreamland TCG simulator for playing against beginner or expert bots. The player configures a deck, then the interface runs a game through the asynchronous rules engine: setup and mulligans, nights and Arena entry, combat and counters, and a final result. Supporting branches cover card data and effects, deck import/export, saved preferences and artwork, and diagnostic reports. The README also documents generated legal pages. Some subsystem links rely on documented capabilities or module references; unsampled implementation details are not inferred.

Main entry points: [`src/ui.js`](https://github.com/theault-dev/dojo-des-songes/blob/main/src/ui.js) (Game interface), [`src/data.js`](https://github.com/theault-dev/dojo-des-songes/blob/main/src/data.js) (Card catalogue), [`src/engine.js`](https://github.com/theault-dev/dojo-des-songes/blob/main/src/engine.js) (Game engine), [`src/expert.js`](https://github.com/theault-dev/dojo-des-songes/blob/main/src/expert.js) (Expert search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game experience"]
  node_interface["Game interface<br/>[ui.js]"]
  node_mobile["Mobile controls<br/>[mobile.js]"]
  node_visuals["Visual effects<br/>[fx.js]"]
end

subgraph group_rules["Rules and cards"]
  node_engine["Game engine<br/>[engine.js]"]
  node_carddata["Card catalogue<br/>[data.js]"]
  node_official["Official card text<br/>[official.js]"]
  node_effects["Card effects<br/>[effects.js]"]
end

subgraph group_agents["Bots and decisions"]
  node_beginner["Beginner bot<br/>[bot.js]"]
  node_expert["Expert search<br/>[expert.js]"]
end

subgraph group_personal["Player data"]
  node_deckio["Deck import export<br/>[deckio.js]"]
  node_preferences[("Preferences and decks<br/>[store.js]")]
  node_artwork["Card artwork<br/>[art.js]"]
  node_artstore[("Artwork database")]
end

subgraph group_legal["Legal pages"]
  node_legal["Legal content<br/>[legal.mjs]"]
end

node_player(("Player"))

node_player -->|"plays through"| node_interface
node_interface -->|"runs game"| node_engine
node_interface -->|"uses bot"| node_beginner
node_interface -->|"starts search"| node_expert
node_engine -->|"reads cards"| node_carddata
node_engine -->|"runs effects"| node_effects
node_carddata -->|"applies text"| node_official
node_beginner -->|"evaluates state"| node_engine
node_beginner -->|"reads cards"| node_carddata
node_expert -->|"replays game"| node_engine
node_expert -->|"runs rollouts"| node_beginner
node_expert -->|"estimates hidden cards"| node_carddata
node_interface -->|"imports decks"| node_deckio
node_deckio -->|"resolves cards"| node_carddata
node_interface -->|"loads preferences"| node_preferences
node_interface -->|"loads artwork"| node_artwork
node_artwork -->|"reads and writes"| node_artstore
node_artwork -->|"matches card numbers"| node_carddata
node_interface -->|"renders effects"| node_visuals
node_interface -.->|"mobile behavior"| node_mobile
node_player -->|"reads policies"| node_legal

click node_interface "https://github.com/theault-dev/dojo-des-songes/blob/main/src/ui.js"
click node_mobile "https://github.com/theault-dev/dojo-des-songes/blob/main/src/mobile.js"
click node_visuals "https://github.com/theault-dev/dojo-des-songes/blob/main/src/fx.js"
click node_engine "https://github.com/theault-dev/dojo-des-songes/blob/main/src/engine.js"
click node_carddata "https://github.com/theault-dev/dojo-des-songes/blob/main/src/data.js"
click node_official "https://github.com/theault-dev/dojo-des-songes/blob/main/src/official.js"
click node_effects "https://github.com/theault-dev/dojo-des-songes/blob/main/src/effects.js"
click node_beginner "https://github.com/theault-dev/dojo-des-songes/blob/main/src/bot.js"
click node_expert "https://github.com/theault-dev/dojo-des-songes/blob/main/src/expert.js"
click node_deckio "https://github.com/theault-dev/dojo-des-songes/blob/main/src/deckio.js"
click node_preferences "https://github.com/theault-dev/dojo-des-songes/blob/main/src/store.js"
click node_artwork "https://github.com/theault-dev/dojo-des-songes/blob/main/src/art.js"
click node_legal "https://github.com/theault-dev/dojo-des-songes/blob/main/server/legal.mjs"

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_interface,node_mobile,node_visuals toneBlue
class node_engine,node_carddata,node_official,node_effects toneAmber
class node_beginner,node_expert toneMint
class node_deckio,node_preferences,node_artwork,node_artstore toneRose
class node_legal,node_player toneIndigo
```

## Components

### Game experience

- [Game interface](https://github.com/theault-dev/dojo-des-songes/blob/main/src/ui.js): `src/ui.js`
- [Mobile controls](https://github.com/theault-dev/dojo-des-songes/blob/main/src/mobile.js): `src/mobile.js`
- [Visual effects](https://github.com/theault-dev/dojo-des-songes/blob/main/src/fx.js): `src/fx.js`

### Rules and cards

- [Game engine](https://github.com/theault-dev/dojo-des-songes/blob/main/src/engine.js): `src/engine.js`
- [Card catalogue](https://github.com/theault-dev/dojo-des-songes/blob/main/src/data.js): `src/data.js`
- [Official card text](https://github.com/theault-dev/dojo-des-songes/blob/main/src/official.js): `src/official.js`
- [Card effects](https://github.com/theault-dev/dojo-des-songes/blob/main/src/effects.js): `src/effects.js`

### Bots and decisions

- [Beginner bot](https://github.com/theault-dev/dojo-des-songes/blob/main/src/bot.js): `src/bot.js`
- [Expert search](https://github.com/theault-dev/dojo-des-songes/blob/main/src/expert.js): `src/expert.js`

### Player data

- [Deck import export](https://github.com/theault-dev/dojo-des-songes/blob/main/src/deckio.js): `src/deckio.js`
- [Preferences and decks](https://github.com/theault-dev/dojo-des-songes/blob/main/src/store.js): `src/store.js`
- [Card artwork](https://github.com/theault-dev/dojo-des-songes/blob/main/src/art.js): `src/art.js`
- **Artwork database**

### Legal pages

- [Legal content](https://github.com/theault-dev/dojo-des-songes/blob/main/server/legal.mjs): `server/legal.mjs`

### Other components

- **Player**

## Connections

- Player → Game interface: plays through (evidence: `README.md`)
- Game interface → Game engine: runs game (evidence: `src/ui.js`)
- Game interface → Beginner bot: uses bot (evidence: `src/ui.js`)
- Game interface → Expert search: starts search (evidence: `README.md`)
- Game engine → Card catalogue: reads cards (evidence: `src/engine.js`)
- Game engine → Card effects: runs effects (evidence: `src/engine.js`)
- Card catalogue → Official card text: applies text (evidence: `src/data.js`)
- Beginner bot → Game engine: evaluates state (evidence: `src/bot.js`)
- Beginner bot → Card catalogue: reads cards (evidence: `src/bot.js`)
- Expert search → Game engine: replays game (evidence: `src/expert.js`)
- Expert search → Beginner bot: runs rollouts (evidence: `src/expert.js`)
- Expert search → Card catalogue: estimates hidden cards (evidence: `src/expert.js`)
- Game interface → Deck import export: imports decks (evidence: `src/ui.js`)
- Deck import export → Card catalogue: resolves cards (evidence: `src/deckio.js`)
- Game interface → Preferences and decks: loads preferences (evidence: `src/ui.js`)
- Game interface → Card artwork: loads artwork (evidence: `src/ui.js`)
- Card artwork → Artwork database: reads and writes (evidence: `src/art.js`)
- Card artwork → Card catalogue: matches card numbers (evidence: `src/art.js`)
- Game interface → Visual effects: renders effects (evidence: `src/ui.js`)
- Game interface → Mobile controls: mobile behavior
- Player → Legal content: reads policies (evidence: `README.md`)
