# kidwai05/mythos architecture

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

- Interactive diagram: https://gitdiagram.com/kidwai05/mythos
- Repository: https://github.com/kidwai05/mythos

## Overview

MYTHOS is a local-first comparative mythology atlas. Visitors browse traditions, characters, stories, sources and an interactive relationship graph; the browser requests catalogue data through the read-only API, which serves SQLite-backed records and search. Canonical JSON is loaded into a rebuildable database. The README documents the wider research-verification model and feature set; several frontend feature modules and backend routes are represented by their indexed paths, but their internal behavior was not sampled, so their connections are limited to documented or visible relationships.

Main entry points: [`frontend/static/js/common.js`](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/common.js) (Shared Browser Client), [`backend/app/api.py`](https://github.com/kidwai05/mythos/blob/main/backend/app/api.py) (Read API), [`backend/app/__init__.py`](https://github.com/kidwai05/mythos/blob/main/backend/app/__init__.py) (Flask Web App), [`backend/seed/loader.py`](https://github.com/kidwai05/mythos/blob/main/backend/seed/loader.py) (Seed Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Canonical Data"]
  node_json["Canonical JSON"]
  node_loader["Seed Loader<br/>[loader.py]"]
  node_sqlite[("SQLite Database<br/>[schema.sql]")]
end

subgraph group_backend["Backend Services"]
  node_webapp["Flask Web App<br/>[__init__.py]"]
  node_api["Read API<br/>[api.py]"]
  node_catalog["Catalogue<br/>[catalog.py]"]
  node_repo["Query Repository<br/>[repository.py]"]
  node_search["Search Engine<br/>[search.py]"]
  node_dbconn["DB Connection<br/>[db.py]"]
end

subgraph group_frontend["Web Experience"]
  node_templates["Page Templates"]
  node_client["Shared Browser Client<br/>[common.js]"]
  node_themes["Themes And Effects<br/>[fx.js]"]
  node_character["Character Profiles<br/>[character.js]"]
  node_graph["Knowledge Graph<br/>[graph.js]"]
  node_browse["Character Browse<br/>[browse.js]"]
  node_stories["Story Explorer<br/>[stories.js]"]
  node_storydetail["Story Detail<br/>[story_detail.js]"]
  node_sources["Source Library<br/>[sources.js]"]
  node_sourcedetail["Source Detail<br/>[source_detail.js]"]
  node_mythologies["Mythology Pages<br/>[mythology.js]"]
end

subgraph group_research["Research Corpus"]
  node_researchfiles["Textual Research"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens pages"| node_webapp
node_visitor -->|"explores records"| node_client
node_json -->|"loads records"| node_loader
node_loader -->|"builds database"| node_sqlite
node_dbconn -->|"builds if absent"| node_loader
node_webapp -->|"initializes"| node_dbconn
node_webapp -->|"loads page records"| node_repo
node_api -->|"gets connection"| node_dbconn
node_api -->|"queries records"| node_repo
node_api -->|"uses catalogue"| node_catalog
node_api -->|"normalizes queries"| node_search
node_catalog -->|"scores documents"| node_search
node_client -->|"requests JSON"| node_api
node_client -->|"imports effects"| node_themes
node_character -->|"uses helpers"| node_client
node_character -->|"renders graph"| node_graph
node_graph -->|"fetches graph data"| node_api
node_browse -->|"uses shared client"| node_client
node_stories -->|"uses shared client"| node_client
node_storydetail -->|"uses shared client"| node_client
node_sources -->|"uses shared client"| node_client
node_sourcedetail -->|"uses shared client"| node_client
node_mythologies -->|"uses shared client"| node_client
node_researchfiles -.->|"grounds records"| node_json

click node_json "https://github.com/kidwai05/mythos/tree/main/data"
click node_loader "https://github.com/kidwai05/mythos/blob/main/backend/seed/loader.py"
click node_sqlite "https://github.com/kidwai05/mythos/blob/main/backend/schema.sql"
click node_webapp "https://github.com/kidwai05/mythos/blob/main/backend/app/__init__.py"
click node_api "https://github.com/kidwai05/mythos/blob/main/backend/app/api.py"
click node_catalog "https://github.com/kidwai05/mythos/blob/main/backend/app/catalog.py"
click node_repo "https://github.com/kidwai05/mythos/blob/main/backend/app/repository.py"
click node_search "https://github.com/kidwai05/mythos/blob/main/backend/app/search.py"
click node_dbconn "https://github.com/kidwai05/mythos/blob/main/backend/app/db.py"
click node_templates "https://github.com/kidwai05/mythos/tree/main/frontend/templates"
click node_client "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/common.js"
click node_themes "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/fx.js"
click node_character "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/character.js"
click node_graph "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/graph.js"
click node_browse "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/browse.js"
click node_stories "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/stories.js"
click node_storydetail "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/story_detail.js"
click node_sources "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/sources.js"
click node_sourcedetail "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/source_detail.js"
click node_mythologies "https://github.com/kidwai05/mythos/blob/main/frontend/static/js/mythology.js"
click node_researchfiles "https://github.com/kidwai05/mythos/tree/main/research"

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_json,node_loader,node_sqlite toneBlue
class node_webapp,node_api,node_catalog,node_repo,node_search,node_dbconn toneAmber
class node_templates,node_client,node_themes,node_character,node_graph,node_browse,node_stories,node_storydetail,node_sources,node_sourcedetail,node_mythologies toneMint
class node_researchfiles toneRose
class node_visitor toneIndigo
```

## Components

### Canonical Data

- [Canonical JSON](https://github.com/kidwai05/mythos/tree/main/data): `data`
- [Seed Loader](https://github.com/kidwai05/mythos/blob/main/backend/seed/loader.py): `backend/seed/loader.py`
- [SQLite Database](https://github.com/kidwai05/mythos/blob/main/backend/schema.sql): `backend/schema.sql`

### Backend Services

- [Flask Web App](https://github.com/kidwai05/mythos/blob/main/backend/app/__init__.py): `backend/app/__init__.py`
- [Read API](https://github.com/kidwai05/mythos/blob/main/backend/app/api.py): `backend/app/api.py`
- [Catalogue](https://github.com/kidwai05/mythos/blob/main/backend/app/catalog.py): `backend/app/catalog.py`
- [Query Repository](https://github.com/kidwai05/mythos/blob/main/backend/app/repository.py): `backend/app/repository.py`
- [Search Engine](https://github.com/kidwai05/mythos/blob/main/backend/app/search.py): `backend/app/search.py`
- [DB Connection](https://github.com/kidwai05/mythos/blob/main/backend/app/db.py): `backend/app/db.py`

### Web Experience

- [Page Templates](https://github.com/kidwai05/mythos/tree/main/frontend/templates): `frontend/templates`
- [Shared Browser Client](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/common.js): `frontend/static/js/common.js`
- [Themes And Effects](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/fx.js): `frontend/static/js/fx.js`
- [Character Profiles](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/character.js): `frontend/static/js/character.js`
- [Knowledge Graph](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/graph.js): `frontend/static/js/graph.js`
- [Character Browse](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/browse.js): `frontend/static/js/browse.js`
- [Story Explorer](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/stories.js): `frontend/static/js/stories.js`
- [Story Detail](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/story_detail.js): `frontend/static/js/story_detail.js`
- [Source Library](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/sources.js): `frontend/static/js/sources.js`
- [Source Detail](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/source_detail.js): `frontend/static/js/source_detail.js`
- [Mythology Pages](https://github.com/kidwai05/mythos/blob/main/frontend/static/js/mythology.js): `frontend/static/js/mythology.js`

### Research Corpus

- [Textual Research](https://github.com/kidwai05/mythos/tree/main/research): `research`

### Other components

- **Visitor**

## Connections

- Visitor → Flask Web App: opens pages (evidence: `README.md`)
- Visitor → Shared Browser Client: explores records (evidence: `README.md`)
- Canonical JSON → Seed Loader: loads records (evidence: `backend/seed/loader.py`)
- Seed Loader → SQLite Database: builds database (evidence: `backend/seed/loader.py`)
- DB Connection → Seed Loader: builds if absent (evidence: `backend/app/db.py`)
- Flask Web App → DB Connection: initializes (evidence: `backend/app/__init__.py`)
- Flask Web App → Query Repository: loads page records (evidence: `backend/app/__init__.py`)
- Read API → DB Connection: gets connection (evidence: `backend/app/api.py`)
- Read API → Query Repository: queries records (evidence: `backend/app/api.py`)
- Read API → Catalogue: uses catalogue (evidence: `backend/app/api.py`)
- Read API → Search Engine: normalizes queries (evidence: `backend/app/api.py`)
- Catalogue → Search Engine: scores documents (evidence: `backend/app/catalog.py`)
- Shared Browser Client → Read API: requests JSON (evidence: `frontend/static/js/common.js`)
- Shared Browser Client → Themes And Effects: imports effects (evidence: `frontend/static/js/common.js`)
- Character Profiles → Shared Browser Client: uses helpers (evidence: `frontend/static/js/character.js`)
- Character Profiles → Knowledge Graph: renders graph (evidence: `frontend/static/js/character.js`)
- Knowledge Graph → Read API: fetches graph data (evidence: `frontend/static/js/graph.js`)
- Character Browse → Shared Browser Client: uses shared client (evidence: `frontend/static/js/browse.js`)
- Story Explorer → Shared Browser Client: uses shared client (evidence: `frontend/static/js/stories.js`)
- Story Detail → Shared Browser Client: uses shared client (evidence: `frontend/static/js/story_detail.js`)
- Source Library → Shared Browser Client: uses shared client (evidence: `frontend/static/js/sources.js`)
- Source Detail → Shared Browser Client: uses shared client (evidence: `frontend/static/js/source_detail.js`)
- Mythology Pages → Shared Browser Client: uses shared client (evidence: `frontend/static/js/mythology.js`)
- Textual Research → Canonical JSON: grounds records (evidence: `README.md`)
