# marklindstorff/langtime architecture

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

## Overview

LangTime is a local reading and vocabulary-learning app. Users import text or PDF content, open a text in the browser, look up words or selected phrases, and save vocabulary statuses; the reader displays saved statuses as color-coded words. The Flask app routes these actions, persists texts, words, settings, and lookup counts in SQLite, and delegates translations to a local LibreTranslate service. The graph also includes the documented command-line import paths and statistics capability. Some template and styling details were not sampled, so their internal relationships are omitted.

Main entry points: [`app.py`](https://github.com/marklindstorff/langtime/blob/main/app.py) (Flask routes), [`db.py`](https://github.com/marklindstorff/langtime/blob/main/db.py) (SQLite data), [`static/js/main.js`](https://github.com/marklindstorff/langtime/blob/main/static/js/main.js) (Reader interactions), [`translator.py`](https://github.com/marklindstorff/langtime/blob/main/translator.py) (Translation client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Text acquisition"]
  node_browser_import["Browser upload<br/>[app.py]"]
  node_text_import["Text CLI import<br/>[import_text.py]"]
  node_pdf_import["PDF CLI import<br/>[import_pdf.py]"]
end

subgraph group_web["Web application"]
  node_webapp["Flask routes<br/>[app.py]"]
end

subgraph group_learning["Reading and vocabulary"]
  node_reader["Reader<br/>[reader.html]"]
  node_library["Text library<br/>[index.html]"]
  node_reader_ui["Reader interactions<br/>[main.js]"]
  node_vocabulary["Vocabulary statuses<br/>[app.py]"]
  node_statistics["Vocabulary statistics<br/>[app.py]"]
end

subgraph group_storage["Persistence and translation"]
  node_database[("SQLite data<br/>[db.py]")]
  node_translator["Translation client<br/>[translator.py]"]
end

node_browser(("Browser user"))
node_libretranslate["LibreTranslate"]

node_browser -->|"uses"| node_webapp
node_webapp -->|"renders"| node_library
node_webapp -->|"renders"| node_reader
node_browser -->|"uploads"| node_browser_import
node_browser_import -->|"saves text"| node_database
node_text_import -->|"saves text"| node_database
node_pdf_import -->|"saves text"| node_database
node_browser -->|"reads and selects"| node_reader_ui
node_reader_ui -->|"requests translation"| node_webapp
node_reader_ui -->|"saves status"| node_webapp
node_webapp -->|"loads and saves"| node_database
node_webapp -->|"requests translation"| node_translator
node_translator -->|"sends text"| node_libretranslate
node_webapp -->|"handles status"| node_vocabulary
node_webapp -->|"serves counts"| node_statistics
node_vocabulary -->|"reads and writes"| node_database
node_statistics -->|"counts statuses"| node_database

click node_reader "https://github.com/marklindstorff/langtime/blob/main/templates/reader.html"
click node_library "https://github.com/marklindstorff/langtime/blob/main/templates/index.html"
click node_webapp "https://github.com/marklindstorff/langtime/blob/main/app.py"
click node_browser_import "https://github.com/marklindstorff/langtime/blob/main/app.py"
click node_text_import "https://github.com/marklindstorff/langtime/blob/main/import_text.py"
click node_pdf_import "https://github.com/marklindstorff/langtime/blob/main/import_pdf.py"
click node_reader_ui "https://github.com/marklindstorff/langtime/blob/main/static/js/main.js"
click node_vocabulary "https://github.com/marklindstorff/langtime/blob/main/app.py"
click node_statistics "https://github.com/marklindstorff/langtime/blob/main/app.py"
click node_database "https://github.com/marklindstorff/langtime/blob/main/db.py"
click node_translator "https://github.com/marklindstorff/langtime/blob/main/translator.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_browser_import,node_text_import,node_pdf_import,node_browser toneBlue
class node_webapp toneAmber
class node_reader,node_library,node_reader_ui,node_vocabulary,node_statistics toneMint
class node_database,node_translator toneRose
class node_libretranslate toneIndigo
```

## Components

### Text acquisition

- [Browser upload](https://github.com/marklindstorff/langtime/blob/main/app.py): `app.py`
- [Text CLI import](https://github.com/marklindstorff/langtime/blob/main/import_text.py): `import_text.py`
- [PDF CLI import](https://github.com/marklindstorff/langtime/blob/main/import_pdf.py): `import_pdf.py`

### Web application

- [Flask routes](https://github.com/marklindstorff/langtime/blob/main/app.py): `app.py`

### Reading and vocabulary

- [Reader](https://github.com/marklindstorff/langtime/blob/main/templates/reader.html): `templates/reader.html`
- [Text library](https://github.com/marklindstorff/langtime/blob/main/templates/index.html): `templates/index.html`
- [Reader interactions](https://github.com/marklindstorff/langtime/blob/main/static/js/main.js): `static/js/main.js`
- [Vocabulary statuses](https://github.com/marklindstorff/langtime/blob/main/app.py): `app.py`
- [Vocabulary statistics](https://github.com/marklindstorff/langtime/blob/main/app.py): `app.py`

### Persistence and translation

- [SQLite data](https://github.com/marklindstorff/langtime/blob/main/db.py): `db.py`
- [Translation client](https://github.com/marklindstorff/langtime/blob/main/translator.py): `translator.py`

### Other components

- **Browser user**
- **LibreTranslate**

## Connections

- Browser user → Flask routes: uses (evidence: `README.md`)
- Flask routes → Text library: renders (evidence: `app.py`)
- Flask routes → Reader: renders (evidence: `app.py`)
- Browser user → Browser upload: uploads (evidence: `README.md`)
- Browser upload → SQLite data: saves text (evidence: `app.py`)
- Text CLI import → SQLite data: saves text (evidence: `import_text.py`)
- PDF CLI import → SQLite data: saves text (evidence: `import_pdf.py`)
- Browser user → Reader interactions: reads and selects (evidence: `README.md`)
- Reader interactions → Flask routes: requests translation (evidence: `static/js/main.js`)
- Reader interactions → Flask routes: saves status (evidence: `static/js/main.js`)
- Flask routes → SQLite data: loads and saves (evidence: `app.py`)
- Flask routes → Translation client: requests translation (evidence: `app.py`)
- Translation client → LibreTranslate: sends text (evidence: `translator.py`)
- Flask routes → Vocabulary statuses: handles status (evidence: `app.py`)
- Flask routes → Vocabulary statistics: serves counts (evidence: `app.py`)
- Vocabulary statuses → SQLite data: reads and writes (evidence: `app.py`)
- Vocabulary statistics → SQLite data: counts statuses (evidence: `app.py`)
