back

work/stack/

Stack

Automated daily review: highlights saved from any app come back each morning

Solo: product, design, Android app, sync, AI layer · 2026

Next.js 16TypeScriptCapacitor 8IndexedDBSupabaseDeno Edge FunctionsSarvam · Gemini · Groq · OpenAI · Claudepdf.js
Stack: Automated daily review: highlights saved from any app come back each morning

Manual work before

People save highlights in many apps and never look at them again. Going back over old notes is a manual job, so nobody does it.

What it automates

  • -Picking what to review and when
  • -Bringing old highlights back
  • -Sync between devices

The workflow

  1. triggerYou select a line in an article or PDF and tap Highlight, or share it to Stack from another app.
  2. step 1Stack saves the line with its source, on the device, with no account needed.
  3. step 2A spaced schedule picks 3 old highlights for the next morning.
  4. step 3Each one you remember is pushed out about 2.5× longer; ones you forget come back sooner.
  5. step 4If you sign in, the same review syncs across your devices.
  6. outcomeEvery morning the day's review is ready, without you doing anything.

status Android app in soft launch; Play Store release next.

In short

  • -Local-first: everything lives in IndexedDB and works offline with no account; sign-in only adds sync across devices.
  • -Sync with a server-numbered seq per write: upload local changes, pull rows newer than the last one seen; unsynced local edits win.
  • -Stack AI runs in one Supabase Edge Function: checks sign-in, enforces a per-person daily limit, then falls back across five engines (Sarvam → Gemini → Groq → OpenAI → Claude).
  • -Daily review: 3 old highlights a day, pushed out 3 days, then ~2.5× longer each time you remember them.
  • -One Next.js codebase ships the website and a native Android app (Capacitor), with Java plugins for music, sharing and PDF discovery.

Architecture

A Next.js 16 app exported as a static bundle and wrapped in Capacitor for Android. The phone has no server of its own: data lives on the device, sync and AI go to Supabase, and no API key ever ships in the app.

System designNo server on the phone: data lives on the device; sync and AI go to Supabase; no key ships in the app.
ANDROID · CAPACITOR 8SUPABASEAI ENGINESusesnativeHTTPpluginsevery writesummarize· askfallbackupload ·pull > sequser_idReadersave · highlight · review ·focusNews + webBBC · The Hindu · HN · anyRSS feedNative pluginsMedia3 music · share card ·PDF discoveryStack appNext.js 16 static export ·reader mode · pdf.jsIndexedDBlocal-first · every writetracked for syncAI functionsign-in check · daily limit· streams NDJSONPostgresitems table · server seq ·RLS · PDF storageSupabase AuthGoogle · emailFallback chainSarvam → Gemini → Groq →OpenAI → Claude
  • user
  • external
  • service
  • client
  • data
  • guard
  • ai
  • call
  • logical link
  • ← scroll →
  1. 01Reader saves an article, PDF or shared link (Share to Stack from any app)
  2. 02Reader mode cleans the page (Readability + DOMPurify); selecting text makes a highlight or note
  3. 03Every write goes to IndexedDB and is marked as changed, so it works offline
  4. 04When signed in, changes upload to the Supabase items table; rows from other devices download by seq
  5. 05Optional Stack AI calls the Edge Function: sign-in check → daily limit → engine fallback chain → streamed answer with page and note links
  6. 06Each morning the review picks 3 due highlights and reschedules them by how well you remembered

Decisions

+ Local-first IndexedDB, with sync as an optional extra- Cloud database as the source of truth with a required account  Reading happens on trains and in bad signal; the app has to open instantly and work with no network and no sign-up.
+ Server-assigned seq numbers and 'unsynced local edit wins'- Timestamp-based last-write-wins  Phone clocks drift; a server counter gives every device a clean 'give me everything after N' cursor, and nothing you just typed is overwritten.
+ AI only in a Supabase Edge Function with an engine fallback chain- Calling one provider straight from the app  Keys never ship in the APK, limits are enforced server-side, and free tiers can be stacked so one provider being down or out of credit doesn't break the feature.
+ One Next.js codebase exported to Capacitor- A separate React Native app  One solo developer, one codebase for web and Android; native Java plugins only where the web can't reach (music, share sheet, files).

Failure handling

No network, or the user never signs in

Everything reads and writes IndexedDB; changes queue and upload on the next sync.

The same item edited on two devices

Local edits not yet uploaded win; everything else follows the server's seq order.

An AI engine is down, busy or out of credit

The function moves to the next engine; the app gets a reset event and drops the partial text.

A person hits the daily AI limit

The function refuses with a clear 429 message; the rest of the app keeps working.

A feed URL points at a private or local address

The website's feed proxy resolves the host and re-checks every redirect; private IPs are refused.

Numbers

5

AI engines in the fallback chain

12

News topics

3

Highlights reviewed per day

50

Daily AI requests per person

configurable

Next

  • ○ Play Store release
  • ○ Grow testers from the soft launch
  • ○ iOS build (Capacitor project already in place)