v0.2.0

Architecture

Last updated


This page shows the layers and module dependencies of go-rss-reader in one overview diagram; per-module structure, data flow, and the state machine are in doc/architecture.md.

Overview


graph TB
    Main[cmd/cli main] --> App[internal/app TUI Layer]
    App --> Collector[internal/util Collector]
    App --> Extractor[internal/util Extractor]
    App --> API[internal/api LLM Client]
    App --> DB[internal/database SQLite]
    Collector --> DB
    Collector --> Feeds[(RSS Feeds)]
    Extractor --> Web[(News Pages)]
    API --> OpenAI[(OpenAI Chat Completions)]
    Collector -.-> Model[internal/model]
    Extractor -.-> Model
    DB -.-> Model
  1. graph TB
  2. Main[cmd/cli main] --> App[internal/app TUI Layer]
  3. App --> Collector[internal/util Collector]
  4. App --> Extractor[internal/util Extractor]
  5. App --> API[internal/api LLM Client]
  6. App --> DB[internal/database SQLite]
  7. Collector --> DB
  8. Collector --> Feeds[(RSS Feeds)]
  9. Extractor --> Web[(News Pages)]
  10. API --> OpenAI[(OpenAI Chat Completions)]
  11. Collector -.-> Model[internal/model]
  12. Extractor -.-> Model
  13. DB -.-> Model

Other terminal feed readers cover the same space: newsboat (C++, RSS/Atom for text terminals), eilmeldung and feedr (Rust TUIs; feedr also reads full articles in the terminal), nom and gorss (Go terminal readers), and matcha (Go, a daily digest for Markdown readers or terminals). tide is a Go TUI reader with AI summaries, while miniflux takes the opposite form: a self-hosted reader deployed on a server. go-rss-reader is a single Go TUI built on tview that keeps every article, its extracted full text, the feed list, and the last summary in one SQLite file, extracts full text in the background for each new article, and maintains one rolling AI news summary across all feeds with gpt-4o-mini, sending the previous summary back with each request.

Layers


LayerPackageResponsibility
Entry pointcmd/cliCalls app.New() and Run(), prints the error if launch fails
Applicationinternal/apptview layout, hotkeys, command parsing, refresh scheduling, and coordination of the modules below
Collectioninternal/util (Collector)Feed add/remove, RSS fetch and parse, deduplication, time-window filtering
Extractioninternal/util (Extractor)Fetches the original page and extracts title, author, body, and word count
LLMinternal/apiStreams OpenAI Chat Completions
Storageinternal/databaseSQLite path resolution, table creation, article/feed/key-value access
Data modelinternal/modelNews, NewsContent, RSS/Channel/Item

Every package lives under internal/, so none of them can be imported from outside the module.

Cross-Cutting Principles


PrincipleImplementation
UI updates only on the tview main threadBackground goroutines always update the screen through app.QueueUpdateDraw()
Cache firstWhile the list is empty, database.Get(72) fills it before the network fetch
Failures do not stop the runA failing feed or a failing extraction is logged and skipped without affecting other items
Single data fileArticles, feeds, the API key, and the digest all live in one SQLite file

Further Reading


  • Refresh Cycle: the full order of one check, from fetch to digest
  • Storage: table structure and access methods
中文