# bpun/magar-dict architecture

> Architecture diagram of the GitHub repository bpun/magar-dict, 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/bpun/magar-dict
- Repository: https://github.com/bpun/magar-dict

## Overview

The repository identifies itself as a Magar language-learning dictionary with AI features, and its package layout suggests web/API, language-learning services, persistence, and AI capabilities. However, the README is empty and the sampled application excerpts are blank except for `app/main.py`, which only prints “hello world.” The graph therefore maps the visible subsystems but omits workflow edges that the available evidence cannot establish.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Application interfaces"]
  node_entry["Application entry<br/>[main.py]"]
  node_api["API modules"]
  node_web["Web routes"]
  node_browser["Browser assets"]
end

subgraph group_learning["Dictionary learning"]
  node_workflow["Word workflow<br/>[word_workflow.py]"]
  node_spaced_review["Spaced review<br/>[srs.py]"]
  node_tags["Word tags<br/>[tags.py]"]
  node_audio["Text to speech<br/>[tts.py]"]
  node_email["Email service<br/>[email.py]"]
end

subgraph group_ai["AI and search"]
  node_search["Dictionary search<br/>[search.py]"]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
  node_vector_index["Vector index<br/>[vector_index.py]"]
  node_llm_base["LLM interface<br/>[llm_base.py]"]
  node_llm_openai["OpenAI provider<br/>[llm_openai.py]"]
  node_ai_quota["AI quota<br/>[quota.py]"]
end

subgraph group_platform["Core and persistence"]
  node_audit["Audit service<br/>[audit.py]"]
  node_database[("Database session<br/>[session.py]")]
  node_models["Data models"]
  node_security["Security<br/>[security.py]"]
  node_dependencies["Request dependencies<br/>[deps.py]"]
  node_rate_limit["Rate limiting<br/>[ratelimit.py]"]
end

node_learner(("Learner"))

click node_entry "https://github.com/bpun/magar-dict/blob/main/app/main.py"
click node_api "https://github.com/bpun/magar-dict/tree/main/app/api"
click node_web "https://github.com/bpun/magar-dict/tree/main/app/web"
click node_browser "https://github.com/bpun/magar-dict/tree/main/app/static"
click node_workflow "https://github.com/bpun/magar-dict/blob/main/app/services/word_workflow.py"
click node_spaced_review "https://github.com/bpun/magar-dict/blob/main/app/services/srs.py"
click node_tags "https://github.com/bpun/magar-dict/blob/main/app/services/tags.py"
click node_audio "https://github.com/bpun/magar-dict/blob/main/app/services/tts.py"
click node_email "https://github.com/bpun/magar-dict/blob/main/app/services/email.py"
click node_audit "https://github.com/bpun/magar-dict/blob/main/app/services/audit.py"
click node_database "https://github.com/bpun/magar-dict/blob/main/app/db/session.py"
click node_models "https://github.com/bpun/magar-dict/tree/main/app/db/models"
click node_security "https://github.com/bpun/magar-dict/blob/main/app/core/security.py"
click node_dependencies "https://github.com/bpun/magar-dict/blob/main/app/core/deps.py"
click node_rate_limit "https://github.com/bpun/magar-dict/blob/main/app/core/ratelimit.py"
click node_search "https://github.com/bpun/magar-dict/blob/main/app/services/search.py"
click node_embeddings "https://github.com/bpun/magar-dict/blob/main/app/services/embeddings.py"
click node_vector_index "https://github.com/bpun/magar-dict/blob/main/app/services/vector_index.py"
click node_llm_base "https://github.com/bpun/magar-dict/blob/main/app/services/ai/llm_base.py"
click node_llm_openai "https://github.com/bpun/magar-dict/blob/main/app/services/ai/llm_openai.py"
click node_ai_quota "https://github.com/bpun/magar-dict/blob/main/app/services/ai/quota.py"

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_entry,node_api,node_web,node_browser toneBlue
class node_workflow,node_spaced_review,node_tags,node_audio,node_email toneAmber
class node_search,node_embeddings,node_vector_index,node_llm_base,node_llm_openai,node_ai_quota toneMint
class node_audit,node_database,node_models,node_security,node_dependencies,node_rate_limit toneRose
class node_learner toneIndigo
```

## Components

### Application interfaces

- [Application entry](https://github.com/bpun/magar-dict/blob/main/app/main.py): `app/main.py`
- [API modules](https://github.com/bpun/magar-dict/tree/main/app/api): `app/api`
- [Web routes](https://github.com/bpun/magar-dict/tree/main/app/web): `app/web`
- [Browser assets](https://github.com/bpun/magar-dict/tree/main/app/static): `app/static`

### Dictionary learning

- [Word workflow](https://github.com/bpun/magar-dict/blob/main/app/services/word_workflow.py): `app/services/word_workflow.py`
- [Spaced review](https://github.com/bpun/magar-dict/blob/main/app/services/srs.py): `app/services/srs.py`
- [Word tags](https://github.com/bpun/magar-dict/blob/main/app/services/tags.py): `app/services/tags.py`
- [Text to speech](https://github.com/bpun/magar-dict/blob/main/app/services/tts.py): `app/services/tts.py`
- [Email service](https://github.com/bpun/magar-dict/blob/main/app/services/email.py): `app/services/email.py`

### AI and search

- [Dictionary search](https://github.com/bpun/magar-dict/blob/main/app/services/search.py): `app/services/search.py`
- [Embeddings](https://github.com/bpun/magar-dict/blob/main/app/services/embeddings.py): `app/services/embeddings.py`
- [Vector index](https://github.com/bpun/magar-dict/blob/main/app/services/vector_index.py): `app/services/vector_index.py`
- [LLM interface](https://github.com/bpun/magar-dict/blob/main/app/services/ai/llm_base.py): `app/services/ai/llm_base.py`
- [OpenAI provider](https://github.com/bpun/magar-dict/blob/main/app/services/ai/llm_openai.py): `app/services/ai/llm_openai.py`
- [AI quota](https://github.com/bpun/magar-dict/blob/main/app/services/ai/quota.py): `app/services/ai/quota.py`

### Core and persistence

- [Audit service](https://github.com/bpun/magar-dict/blob/main/app/services/audit.py): `app/services/audit.py`
- [Database session](https://github.com/bpun/magar-dict/blob/main/app/db/session.py): `app/db/session.py`
- [Data models](https://github.com/bpun/magar-dict/tree/main/app/db/models): `app/db/models`
- [Security](https://github.com/bpun/magar-dict/blob/main/app/core/security.py): `app/core/security.py`
- [Request dependencies](https://github.com/bpun/magar-dict/blob/main/app/core/deps.py): `app/core/deps.py`
- [Rate limiting](https://github.com/bpun/magar-dict/blob/main/app/core/ratelimit.py): `app/core/ratelimit.py`

### Other components

- **Learner**
