# calvinlomax/semantix architecture

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

- Interactive diagram: https://gitdiagram.com/calvinlomax/semantix
- Repository: https://github.com/calvinlomax/semantix

## Overview

Semantix is a semantic-navigation word puzzle: players submit related words to move through Google News Word2Vec space toward a target, while the Python server owns validation, movement, scoring, and game state. The browser presents daily and free-play rounds, previews, hints, history, statistics, and 2D/3D maps. The graph separates puzzle generation and semantic mechanics from the authoritative game/API path and the React experience. Relationships among sampled modules are cited; frontend-to-backend HTTP wiring is documented at a high level, but its exact client implementation was not excerpted.

Main entry points: [`backend/app/services/game.py`](https://github.com/calvinlomax/semantix/blob/main/backend/app/services/game.py) (Game service), [`frontend/src/App.tsx`](https://github.com/calvinlomax/semantix/blob/main/frontend/src/App.tsx) (Game interface), [`backend/app/engine/level_generator.py`](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/level_generator.py) (Level generation), [`backend/app/engine/embeddings.py`](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/embeddings.py) (Embedding and word resolution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser experience"]
  node_app["Game interface<br/>[App.tsx]"]
  node_game_state["Game state<br/>[gameStore.ts]"]
  node_preview_hook["Move preview<br/>[useMovePreview.ts]"]
  node_stats["Browser stats<br/>[stats.ts]"]
  node_map_selector["Map selector<br/>[SemanticMap.tsx]"]
  node_map_2d["2D map<br/>[SemanticMap2D.tsx]"]
  node_map_3d["3D map<br/>[SemanticMap3D.tsx]"]
  node_trajectory["Trajectory animation<br/>[useTrajectory.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_server["Game API"]
  node_api_routes["HTTP routes<br/>[main.py]"]
  node_game_service["Game service<br/>[game.py]"]
  node_game_store[("Active game store<br/>[store.py]")]
  node_settings["Runtime settings<br/>[config.py]"]
end

subgraph group_engine["Semantic engine"]
  node_embeddings["Embedding and word resolution<br/>[embeddings.py]"]
  node_morphology["Word morphology<br/>[morphology.py]"]
  node_physics["Movement physics<br/>[physics.py]"]
  node_scoring["Similarity scoring<br/>[scoring.py]"]
  node_projection["Map projection<br/>[projection.py]"]
end

subgraph group_levels["Puzzle content"]
  node_level_generator["Level generation<br/>[level_generator.py]"]
  node_level_catalog["Level catalog<br/>[catalog.json]"]
  node_vocabulary["Curated vocabulary<br/>[words.txt]"]
end

node_player(("Player"))

node_player -->|"plays"| node_app
node_app -->|"dispatches actions"| node_game_state
node_app -->|"renders map"| node_map_selector
node_app -->|"formats results"| node_stats
node_game_state -->|"requests games"| node_api_client
node_preview_hook -->|"requests preview"| node_api_client
node_map_selector -->|"renders fallback"| node_map_2d
node_map_selector -->|"renders 3D"| node_map_3d
node_map_2d -->|"animates path"| node_trajectory
node_map_3d -->|"animates path"| node_trajectory
node_api_client -.->|"sends HTTP requests"| node_api_routes
node_api_routes -->|"routes game actions"| node_game_service
node_api_routes -->|"configures service"| node_settings
node_game_service -->|"reads configuration"| node_settings
node_game_service -->|"stores games"| node_game_store
node_game_service -->|"resolves words"| node_embeddings
node_game_service -->|"applies movement"| node_physics
node_game_service -->|"scores progress"| node_scoring
node_game_service -->|"projects map points"| node_projection
node_game_service -->|"generates levels"| node_level_generator
node_embeddings -->|"resolves lemmas"| node_morphology
node_physics -->|"uses vector math"| node_scoring
node_level_generator -->|"searches vectors"| node_embeddings
node_level_generator -->|"simulates moves"| node_physics
node_level_generator -->|"ranks candidates"| node_scoring
node_game_service -->|"loads catalog"| node_level_catalog
node_embeddings -->|"uses curated words"| node_vocabulary

click node_app "https://github.com/calvinlomax/semantix/blob/main/frontend/src/App.tsx"
click node_game_state "https://github.com/calvinlomax/semantix/blob/main/frontend/src/stores/gameStore.ts"
click node_preview_hook "https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/useMovePreview.ts"
click node_stats "https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/stats.ts"
click node_map_selector "https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap.tsx"
click node_map_2d "https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap2D.tsx"
click node_map_3d "https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap3D.tsx"
click node_trajectory "https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/useTrajectory.ts"
click node_api_client "https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/api.ts"
click node_api_routes "https://github.com/calvinlomax/semantix/blob/main/backend/app/main.py"
click node_game_service "https://github.com/calvinlomax/semantix/blob/main/backend/app/services/game.py"
click node_game_store "https://github.com/calvinlomax/semantix/blob/main/backend/app/services/store.py"
click node_settings "https://github.com/calvinlomax/semantix/blob/main/backend/app/config.py"
click node_embeddings "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/embeddings.py"
click node_morphology "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/morphology.py"
click node_physics "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/physics.py"
click node_scoring "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/scoring.py"
click node_projection "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/projection.py"
click node_level_generator "https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/level_generator.py"
click node_level_catalog "https://github.com/calvinlomax/semantix/blob/main/data/levels/catalog.json"
click node_vocabulary "https://github.com/calvinlomax/semantix/blob/main/data/vocabulary/words.txt"

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_game_state,node_preview_hook,node_stats,node_map_selector,node_map_2d,node_map_3d,node_trajectory,node_api_client toneBlue
class node_api_routes,node_game_service,node_game_store,node_settings toneAmber
class node_embeddings,node_morphology,node_physics,node_scoring,node_projection toneMint
class node_level_generator,node_level_catalog,node_vocabulary toneRose
class node_player toneIndigo
```

## Components

### Browser experience

- [Game interface](https://github.com/calvinlomax/semantix/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Game state](https://github.com/calvinlomax/semantix/blob/main/frontend/src/stores/gameStore.ts): `frontend/src/stores/gameStore.ts`
- [Move preview](https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/useMovePreview.ts): `frontend/src/lib/useMovePreview.ts`
- [Browser stats](https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/stats.ts): `frontend/src/lib/stats.ts`
- [Map selector](https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap.tsx): `frontend/src/components/SemanticMap.tsx`
- [2D map](https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap2D.tsx): `frontend/src/components/SemanticMap2D.tsx`
- [3D map](https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/SemanticMap3D.tsx): `frontend/src/components/SemanticMap3D.tsx`
- [Trajectory animation](https://github.com/calvinlomax/semantix/blob/main/frontend/src/components/useTrajectory.ts): `frontend/src/components/useTrajectory.ts`
- [API client](https://github.com/calvinlomax/semantix/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Game API

- [HTTP routes](https://github.com/calvinlomax/semantix/blob/main/backend/app/main.py): `backend/app/main.py`
- [Game service](https://github.com/calvinlomax/semantix/blob/main/backend/app/services/game.py): `backend/app/services/game.py`
- [Active game store](https://github.com/calvinlomax/semantix/blob/main/backend/app/services/store.py): `backend/app/services/store.py`
- [Runtime settings](https://github.com/calvinlomax/semantix/blob/main/backend/app/config.py): `backend/app/config.py`

### Semantic engine

- [Embedding and word resolution](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/embeddings.py): `backend/app/engine/embeddings.py`
- [Word morphology](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/morphology.py): `backend/app/engine/morphology.py`
- [Movement physics](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/physics.py): `backend/app/engine/physics.py`
- [Similarity scoring](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/scoring.py): `backend/app/engine/scoring.py`
- [Map projection](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/projection.py): `backend/app/engine/projection.py`

### Puzzle content

- [Level generation](https://github.com/calvinlomax/semantix/blob/main/backend/app/engine/level_generator.py): `backend/app/engine/level_generator.py`
- [Level catalog](https://github.com/calvinlomax/semantix/blob/main/data/levels/catalog.json): `data/levels/catalog.json`
- [Curated vocabulary](https://github.com/calvinlomax/semantix/blob/main/data/vocabulary/words.txt): `data/vocabulary/words.txt`

### Other components

- **Player**

## Connections

- Player → Game interface: plays (evidence: `README.md`)
- Game interface → Game state: dispatches actions (evidence: `frontend/src/App.tsx`)
- Game interface → Map selector: renders map (evidence: `frontend/src/App.tsx`)
- Game interface → Browser stats: formats results (evidence: `frontend/src/App.tsx`)
- Game state → API client: requests games (evidence: `frontend/src/stores/gameStore.ts`)
- Move preview → API client: requests preview (evidence: `frontend/src/lib/useMovePreview.ts`)
- Map selector → 2D map: renders fallback (evidence: `frontend/src/components/SemanticMap.tsx`)
- Map selector → 3D map: renders 3D (evidence: `frontend/src/components/SemanticMap.tsx`)
- 2D map → Trajectory animation: animates path (evidence: `frontend/src/components/SemanticMap2D.tsx`)
- 3D map → Trajectory animation: animates path (evidence: `frontend/src/components/SemanticMap3D.tsx`)
- API client → HTTP routes: sends HTTP requests (evidence: `README.md`)
- HTTP routes → Game service: routes game actions (evidence: `backend/app/main.py`)
- HTTP routes → Runtime settings: configures service (evidence: `backend/app/main.py`)
- Game service → Runtime settings: reads configuration (evidence: `backend/app/services/game.py`)
- Game service → Active game store: stores games (evidence: `backend/app/services/game.py`)
- Game service → Embedding and word resolution: resolves words (evidence: `backend/app/services/game.py`)
- Game service → Movement physics: applies movement (evidence: `backend/app/services/game.py`)
- Game service → Similarity scoring: scores progress (evidence: `backend/app/services/game.py`)
- Game service → Map projection: projects map points (evidence: `backend/app/services/game.py`)
- Game service → Level generation: generates levels (evidence: `backend/app/services/game.py`)
- Embedding and word resolution → Word morphology: resolves lemmas (evidence: `backend/app/engine/embeddings.py`)
- Movement physics → Similarity scoring: uses vector math (evidence: `backend/app/engine/physics.py`)
- Level generation → Embedding and word resolution: searches vectors (evidence: `backend/app/engine/level_generator.py`)
- Level generation → Movement physics: simulates moves (evidence: `backend/app/engine/level_generator.py`)
- Level generation → Similarity scoring: ranks candidates (evidence: `backend/app/engine/level_generator.py`)
- Game service → Level catalog: loads catalog (evidence: `README.md`)
- Embedding and word resolution → Curated vocabulary: uses curated words (evidence: `README.md`)
