# amierd/notlang architecture

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

- Interactive diagram: https://gitdiagram.com/amierd/notlang
- Repository: https://github.com/amierd/notlang

## Overview

NotLang is an iOS language-learning app centered on a feed of bilingual posts. Learners browse posts, reveal translated chunks, save chunks or posts, and review saved chunks with spaced repetition. The graph reflects the inspected feed, model, networking, and save logic; study and view wiring is included where the source index identifies the relevant modules, but some internal calls are not visible in the excerpts.

Main entry points: [`NotLang/Components/PostRowView.swift`](https://github.com/amierd/notlang/blob/main/NotLang/Components/PostRowView.swift) (Post row), [`NotLang/Features/ContentView.swift`](https://github.com/amierd/notlang/blob/main/NotLang/Features/ContentView.swift) (Tab shell), [`NotLang/Data/Networking/APIService.swift`](https://github.com/amierd/notlang/blob/main/NotLang/Data/Networking/APIService.swift) (Posts API), [`NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift`](https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift) (Saved chunk state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and feed"]
  node_app["App entry<br/>[NotLangApp.swift]"]
  node_shell["Tab shell<br/>[ContentView.swift]"]
  node_feedview["Feed screen<br/>[FeedView.swift]"]
  node_feedvm["Feed state"]
  node_api["Posts API<br/>[APIService.swift]"]
  node_session["Network session"]
end

subgraph group_content["Post content"]
  node_postrow["Post row<br/>[PostRowView.swift]"]
  node_chunkview["Translation chunk view"]
  node_engagement["Engagement controls"]
  node_postmodel["Post models<br/>[LangPost.swift]"]
  node_chunkmodel["Translation model"]
end

subgraph group_saved["Saved material"]
  node_savedchunkvm["Saved chunk state"]
  node_savedchunkview["Saved chunks screen"]
  node_savedchunkmodel["Saved chunk model<br/>[SavedChunk.swift]"]
  node_savedpostvm["Saved post state"]
  node_savedpostview["Saved posts screen"]
  node_savedpostmodel["Saved post model<br/>[SavedPost.swift]"]
end

subgraph group_study["Study and review"]
  node_studyview["Study screen<br/>[StudyView.swift]"]
  node_studyvm["Study state"]
  node_scheduler["Review scheduler"]
end

node_learner(("Learner"))
node_supabase{{"Posts service"}}
node_store[("SwiftData store")]

node_learner -->|"opens"| node_app
node_app -->|"launches"| node_shell
node_shell -->|"shows"| node_feedview
node_feedview -->|"uses"| node_feedvm
node_feedvm -->|"fetches posts"| node_api
node_api -->|"sends request"| node_session
node_api -->|"queries posts"| node_supabase
node_api -->|"decodes response"| node_postmodel
node_feedview -->|"renders"| node_postrow
node_postrow -->|"renders"| node_chunkview
node_postrow -->|"shows controls"| node_engagement
node_postrow -->|"syncs likes"| node_savedpostvm
node_postrow -->|"displays"| node_postmodel
node_chunkview -->|"displays"| node_chunkmodel
node_shell -->|"shows"| node_savedchunkview
node_shell -->|"shows"| node_savedpostview
node_savedchunkview -->|"uses"| node_savedchunkvm
node_savedchunkvm -->|"saves chunks"| node_chunkmodel
node_savedchunkvm -->|"inserts and fetches"| node_savedchunkmodel
node_savedchunkvm -->|"reads and writes"| node_store
node_savedpostview -->|"uses"| node_savedpostvm
node_savedpostvm -->|"creates and queries"| node_savedpostmodel
node_savedpostvm -->|"reads and writes"| node_store
node_savedpostmodel -->|"implements post"| node_postmodel
node_savedchunkview -->|"offers review"| node_studyview
node_studyview -->|"uses"| node_studyvm
node_studyvm -->|"schedules reviews"| node_scheduler
node_studyvm -.->|"updates schedule"| node_savedchunkmodel

click node_app "https://github.com/amierd/notlang/blob/main/NotLang/App/NotLangApp.swift"
click node_shell "https://github.com/amierd/notlang/blob/main/NotLang/Features/ContentView.swift"
click node_feedview "https://github.com/amierd/notlang/blob/main/NotLang/Features/Feed/Views/FeedView.swift"
click node_feedvm "https://github.com/amierd/notlang/blob/main/NotLang/Features/Feed/ViewModels/FeedViewModel.swift"
click node_api "https://github.com/amierd/notlang/blob/main/NotLang/Data/Networking/APIService.swift"
click node_session "https://github.com/amierd/notlang/blob/main/NotLang/Data/Networking/NetworkSession.swift"
click node_postrow "https://github.com/amierd/notlang/blob/main/NotLang/Components/PostRowView.swift"
click node_chunkview "https://github.com/amierd/notlang/blob/main/NotLang/Components/TranslationChunkView.swift"
click node_engagement "https://github.com/amierd/notlang/blob/main/NotLang/Components/EngagementStackView.swift"
click node_postmodel "https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/LangPost.swift"
click node_chunkmodel "https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/TranslationChunk.swift"
click node_savedchunkvm "https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift"
click node_savedchunkview "https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedChunks/Views/SavedChunksView.swift"
click node_savedchunkmodel "https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/SavedChunk.swift"
click node_savedpostvm "https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedPosts/ViewModels/SavedPostsViewModel.swift"
click node_savedpostview "https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedPosts/Views/SavedPostView.swift"
click node_savedpostmodel "https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/SavedPost.swift"
click node_studyview "https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/Views/StudyView.swift"
click node_studyvm "https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/ViewModels/StudyViewModel.swift"
click node_scheduler "https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/SpacedRepetitionScheduler.swift"

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_shell,node_feedview,node_feedvm,node_api,node_session toneBlue
class node_postrow,node_chunkview,node_engagement,node_postmodel,node_chunkmodel,node_store toneAmber
class node_savedchunkvm,node_savedchunkview,node_savedchunkmodel,node_savedpostvm,node_savedpostview,node_savedpostmodel toneMint
class node_studyview,node_studyvm,node_scheduler toneRose
class node_learner,node_supabase toneIndigo
```

## Components

### App and feed

- [App entry](https://github.com/amierd/notlang/blob/main/NotLang/App/NotLangApp.swift): `NotLang/App/NotLangApp.swift`
- [Tab shell](https://github.com/amierd/notlang/blob/main/NotLang/Features/ContentView.swift): `NotLang/Features/ContentView.swift`
- [Feed screen](https://github.com/amierd/notlang/blob/main/NotLang/Features/Feed/Views/FeedView.swift): `NotLang/Features/Feed/Views/FeedView.swift`
- [Feed state](https://github.com/amierd/notlang/blob/main/NotLang/Features/Feed/ViewModels/FeedViewModel.swift): `NotLang/Features/Feed/ViewModels/FeedViewModel.swift`
- [Posts API](https://github.com/amierd/notlang/blob/main/NotLang/Data/Networking/APIService.swift): `NotLang/Data/Networking/APIService.swift`
- [Network session](https://github.com/amierd/notlang/blob/main/NotLang/Data/Networking/NetworkSession.swift): `NotLang/Data/Networking/NetworkSession.swift`

### Post content

- [Post row](https://github.com/amierd/notlang/blob/main/NotLang/Components/PostRowView.swift): `NotLang/Components/PostRowView.swift`
- [Translation chunk view](https://github.com/amierd/notlang/blob/main/NotLang/Components/TranslationChunkView.swift): `NotLang/Components/TranslationChunkView.swift`
- [Engagement controls](https://github.com/amierd/notlang/blob/main/NotLang/Components/EngagementStackView.swift): `NotLang/Components/EngagementStackView.swift`
- [Post models](https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/LangPost.swift): `NotLang/Data/Models/LangPost.swift`
- [Translation model](https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/TranslationChunk.swift): `NotLang/Data/Models/TranslationChunk.swift`

### Saved material

- [Saved chunk state](https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift): `NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift`
- [Saved chunks screen](https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedChunks/Views/SavedChunksView.swift): `NotLang/Features/SavedChunks/Views/SavedChunksView.swift`
- [Saved chunk model](https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/SavedChunk.swift): `NotLang/Data/Models/SavedChunk.swift`
- [Saved post state](https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedPosts/ViewModels/SavedPostsViewModel.swift): `NotLang/Features/SavedPosts/ViewModels/SavedPostsViewModel.swift`
- [Saved posts screen](https://github.com/amierd/notlang/blob/main/NotLang/Features/SavedPosts/Views/SavedPostView.swift): `NotLang/Features/SavedPosts/Views/SavedPostView.swift`
- [Saved post model](https://github.com/amierd/notlang/blob/main/NotLang/Data/Models/SavedPost.swift): `NotLang/Data/Models/SavedPost.swift`

### Study and review

- [Study screen](https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/Views/StudyView.swift): `NotLang/Features/Study/Views/StudyView.swift`
- [Study state](https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/ViewModels/StudyViewModel.swift): `NotLang/Features/Study/ViewModels/StudyViewModel.swift`
- [Review scheduler](https://github.com/amierd/notlang/blob/main/NotLang/Features/Study/SpacedRepetitionScheduler.swift): `NotLang/Features/Study/SpacedRepetitionScheduler.swift`

### Other components

- **Learner**
- **Posts service**
- **SwiftData store**

## Connections

- Learner → App entry: opens
- App entry → Tab shell: launches (evidence: `NotLang/App/NotLangApp.swift`)
- Tab shell → Feed screen: shows (evidence: `NotLang/Features/ContentView.swift`)
- Feed screen → Feed state: uses (evidence: `NotLang/Features/Feed/Views/FeedView.swift`)
- Feed state → Posts API: fetches posts (evidence: `NotLang/Features/Feed/ViewModels/FeedViewModel.swift`)
- Posts API → Network session: sends request (evidence: `NotLang/Data/Networking/APIService.swift`)
- Posts API → Posts service: queries posts (evidence: `NotLang/Data/Networking/APIService.swift`)
- Posts API → Post models: decodes response (evidence: `NotLang/Data/Networking/APIService.swift`)
- Feed screen → Post row: renders (evidence: `NotLang/Features/Feed/Views/FeedView.swift`)
- Post row → Translation chunk view: renders (evidence: `NotLang/Components/PostRowView.swift`)
- Post row → Engagement controls: shows controls (evidence: `NotLang/Components/PostRowView.swift`)
- Post row → Saved post state: syncs likes (evidence: `NotLang/Components/PostRowView.swift`)
- Post row → Post models: displays (evidence: `NotLang/Components/PostRowView.swift`)
- Translation chunk view → Translation model: displays (evidence: `NotLang/Components/TranslationChunkView.swift`)
- Tab shell → Saved chunks screen: shows (evidence: `NotLang/Features/ContentView.swift`)
- Tab shell → Saved posts screen: shows (evidence: `NotLang/Features/ContentView.swift`)
- Saved chunks screen → Saved chunk state: uses (evidence: `NotLang/Features/SavedChunks/Views/SavedChunksView.swift`)
- Saved chunk state → Translation model: saves chunks (evidence: `NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift`)
- Saved chunk state → Saved chunk model: inserts and fetches (evidence: `NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift`)
- Saved chunk state → SwiftData store: reads and writes (evidence: `NotLang/Features/SavedChunks/ViewModels/SavedChunksViewModel.swift`)
- Saved posts screen → Saved post state: uses (evidence: `NotLang/Features/SavedPosts/Views/SavedPostView.swift`)
- Saved post state → Saved post model: creates and queries (evidence: `NotLang/Features/SavedPosts/ViewModels/SavedPostsViewModel.swift`)
- Saved post state → SwiftData store: reads and writes (evidence: `NotLang/Features/SavedPosts/ViewModels/SavedPostsViewModel.swift`)
- Saved post model → Post models: implements post (evidence: `NotLang/Data/Models/SavedPost.swift`)
- Saved chunks screen → Study screen: offers review (evidence: `NotLang/Features/SavedChunks/Views/SavedChunksView.swift`)
- Study screen → Study state: uses (evidence: `NotLang/Features/Study/Views/StudyView.swift`)
- Study state → Review scheduler: schedules reviews (evidence: `NotLang/Features/Study/ViewModels/StudyViewModel.swift`)
- Study state → Saved chunk model: updates schedule (evidence: `NotLang/Features/Study/ViewModels/StudyViewModel.swift`)
