# essadany/motus architecture

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

- Interactive diagram: https://gitdiagram.com/essadany/motus
- Repository: https://github.com/essadany/motus

## Overview

Motus is a browser-based word game split into authentication, gameplay, and score microservices, with Redis stores and a documented HAProxy failover layer. The principal flow is registration/login, word submission and evaluation, score persistence, then score viewing. Edges are based on the supplied source excerpts or README; HAProxy and some browser pages are documented but their runtime wiring is not shown in excerpts.

Main entry points: [`motus/index.js`](https://github.com/essadany/motus/blob/master/motus/index.js) (Game service), [`score/index.js`](https://github.com/essadany/motus/blob/master/score/index.js) (Score service), [`authentification/index.js`](https://github.com/essadany/motus/blob/master/authentification/index.js) (Auth service), [`motus/public/script.js`](https://github.com/essadany/motus/blob/master/motus/public/script.js) (Game interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Authentication"]
  node_authui["Auth pages"]
  node_authservice["Auth service<br/>[index.js]"]
end

subgraph group_game["Gameplay"]
  node_gameui["Game interface<br/>[script.js]"]
  node_gamepage["Game page<br/>[index.html]"]
  node_gameapi["Game service<br/>[index.js]"]
  node_wordlist["French word list"]
end

subgraph group_scores["Scorekeeping"]
  node_scoreui["Score interface<br/>[score.js]"]
  node_scorepage["Score page<br/>[index.html]"]
  node_scoreservice["Score service<br/>[index.js]"]
end

subgraph group_infra["Runtime infrastructure"]
  node_sessionstore[("Session Redis")]
  node_scoreredis[("Score Redis")]
  node_proxy["HAProxy<br/>[haproxy.cfg]"]
end

node_player(("Player"))

node_player -->|"opens"| node_authui
node_authui -->|"submits credentials"| node_authservice
node_authservice -->|"stores sessions"| node_sessionstore
node_authservice -->|"reads users"| node_sessionstore
node_player -->|"plays"| node_gameui
node_gamepage -.->|"loads script"| node_gameui
node_gameui -->|"submits word"| node_gameapi
node_gameapi -->|"stores sessions"| node_sessionstore
node_gameapi -->|"reads words"| node_wordlist
node_gameapi -->|"posts score"| node_scoreservice
node_scoreservice -->|"writes scores"| node_scoreredis
node_player -->|"views scores"| node_scoreui
node_scorepage -.->|"loads script"| node_scoreui
node_scoreui -->|"requests score"| node_scoreservice
node_scoreservice -->|"reads scores"| node_scoreredis
node_scoreservice -->|"stores sessions"| node_sessionstore
node_proxy -.->|"balances traffic"| node_gameapi

click node_authui "https://github.com/essadany/motus/tree/master/authentification/public"
click node_authservice "https://github.com/essadany/motus/blob/master/authentification/index.js"
click node_gameui "https://github.com/essadany/motus/blob/master/motus/public/script.js"
click node_gamepage "https://github.com/essadany/motus/blob/master/motus/public/index.html"
click node_gameapi "https://github.com/essadany/motus/blob/master/motus/index.js"
click node_wordlist "https://github.com/essadany/motus/blob/master/motus/liste_francais_utf8.txt"
click node_scoreui "https://github.com/essadany/motus/blob/master/score/public/score.js"
click node_scorepage "https://github.com/essadany/motus/blob/master/score/public/index.html"
click node_scoreservice "https://github.com/essadany/motus/blob/master/score/index.js"
click node_proxy "https://github.com/essadany/motus/blob/master/motus/haproxy/haproxy.cfg"

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_authui,node_authservice toneBlue
class node_gameui,node_gamepage,node_gameapi,node_wordlist toneAmber
class node_scoreui,node_scorepage,node_scoreservice toneMint
class node_sessionstore,node_scoreredis,node_proxy toneRose
class node_player toneIndigo
```

## Components

### Authentication

- [Auth pages](https://github.com/essadany/motus/tree/master/authentification/public): `authentification/public`
- [Auth service](https://github.com/essadany/motus/blob/master/authentification/index.js): `authentification/index.js`

### Gameplay

- [Game interface](https://github.com/essadany/motus/blob/master/motus/public/script.js): `motus/public/script.js`
- [Game page](https://github.com/essadany/motus/blob/master/motus/public/index.html): `motus/public/index.html`
- [Game service](https://github.com/essadany/motus/blob/master/motus/index.js): `motus/index.js`
- [French word list](https://github.com/essadany/motus/blob/master/motus/liste_francais_utf8.txt): `motus/liste_francais_utf8.txt`

### Scorekeeping

- [Score interface](https://github.com/essadany/motus/blob/master/score/public/score.js): `score/public/score.js`
- [Score page](https://github.com/essadany/motus/blob/master/score/public/index.html): `score/public/index.html`
- [Score service](https://github.com/essadany/motus/blob/master/score/index.js): `score/index.js`

### Runtime infrastructure

- **Session Redis**
- **Score Redis**
- [HAProxy](https://github.com/essadany/motus/blob/master/motus/haproxy/haproxy.cfg): `motus/haproxy/haproxy.cfg`

### Other components

- **Player**

## Connections

- Player → Auth pages: opens (evidence: `README.md`)
- Auth pages → Auth service: submits credentials (evidence: `authentification/index.js`)
- Auth service → Session Redis: stores sessions (evidence: `authentification/index.js`)
- Auth service → Session Redis: reads users (evidence: `authentification/index.js`)
- Player → Game interface: plays (evidence: `README.md`)
- Game page → Game interface: loads script
- Game interface → Game service: submits word (evidence: `motus/public/script.js`)
- Game service → Session Redis: stores sessions (evidence: `motus/index.js`)
- Game service → French word list: reads words (evidence: `motus/index.js`)
- Game service → Score service: posts score (evidence: `motus/index.js`)
- Score service → Score Redis: writes scores (evidence: `score/index.js`)
- Player → Score interface: views scores (evidence: `README.md`)
- Score page → Score interface: loads script
- Score interface → Score service: requests score (evidence: `score/public/score.js`)
- Score service → Score Redis: reads scores (evidence: `score/index.js`)
- Score service → Session Redis: stores sessions (evidence: `score/index.js`)
- HAProxy → Game service: balances traffic (evidence: `README.md`)
