Grill: online-first cache-ready Flutter architecture #6

Closed
opened 2026-08-02 15:15:21 +00:00 by TheAnachronism · 1 comment

Part of #1
Blocked by: #2, #4

Question

What Flutter app architecture keeps the MVP online-first while remaining cache-ready for a future offline reading feature?

Decide layering (UI / domain / API client / local cache seams), where multi-instance accounts live, how read/star mutations sync, and what deliberately is not built now so offline can plug in later without a large rewrite.

Part of #1 Blocked by: #2, #4 ## Question What Flutter app architecture keeps the MVP online-first while remaining cache-ready for a future offline reading feature? Decide layering (UI / domain / API client / local cache seams), where multi-instance accounts live, how read/star mutations sync, and what deliberately is *not* built now so offline can plug in later without a large rewrite.
Author
Owner

Resolution

Online-first, cache-ready Flutter architecture locked (see ADR-0001).

Layering & state

  • UI → application/use-cases → domain models → repository interfaces → data (API now; local cache later)
  • Riverpod for DI/state above repositories
  • Single-app layout: feature folders + domain/ + data/{api,local}/

Accounts & isolation

  • AccountRepository + per-Account ApiClient (package:http)
  • Secrets/sid in flutter_secure_storage; metadata in prefs/JSON
  • All data providers scoped to active Account id; switch invalidates memory state

Sync & persistence (MVP)

  • Optimistic UI + durable mark outbox for star/unread (updateArticle)
  • Disk now: accounts, secrets, outbox, prefs only — no article DB / warm list cache
  • Transparent re-login + single retry on dead sid; clear error on API_DISABLED

Reads

  • FeedTreeSource abstraction; start with getFeedTree
  • Lean getHeadlines for List hub; getArticle for Reader HTML

Deliberately not built now

  • Offline reading feature, local article store, background sync, multi-package workspace

ADR: docs/adr/0001-online-first-cache-ready-architecture.md

## Resolution Online-first, cache-ready Flutter architecture locked (see ADR-0001). ### Layering & state - UI → application/use-cases → domain models → repository interfaces → data (API now; local cache later) - **Riverpod** for DI/state above repositories - Single-app layout: feature folders + `domain/` + `data/{api,local}/` ### Accounts & isolation - **AccountRepository** + per-Account **ApiClient** (`package:http`) - Secrets/`sid` in `flutter_secure_storage`; metadata in prefs/JSON - All data providers **scoped to active Account id**; switch invalidates memory state ### Sync & persistence (MVP) - Optimistic UI + **durable mark outbox** for star/unread (`updateArticle`) - Disk now: accounts, secrets, outbox, prefs only — **no** article DB / warm list cache - Transparent **re-login + single retry** on dead `sid`; clear error on `API_DISABLED` ### Reads - **FeedTreeSource** abstraction; start with **`getFeedTree`** - Lean **`getHeadlines`** for List hub; **`getArticle`** for Reader HTML ### Deliberately not built now - Offline reading feature, local article store, background sync, multi-package workspace **ADR:** [`docs/adr/0001-online-first-cache-ready-architecture.md`](https://git.anachronis.dev/TheAnachronism/tt-rss-viewer/src/branch/master/docs/adr/0001-online-first-cache-ready-architecture.md)
Sign in to join this conversation.
No description provided.