|
2 | 2 |
|
3 | 3 | ## What This Is |
4 | 4 |
|
5 | | -Lumio è una piattaforma di studio basata su flashcard che sfrutta l'AI per trasformare concetti in sessioni di apprendimento interattive con ripetizione spaziata. Due frontend: app nativa Android (React Native/Expo) per lo studio e web app React SPA (deck.lumio.toto-castaldi.com) per la creazione di deck e carte. L'app Android è bilingue IT/EN con branding Lumio, ripetizione spaziata SM-2, sessioni configurabili con cap RPC, dashboard compatta 2x2, card browse, storico sessioni, gestione errori sync, autenticazione dual-mode (Google OAuth + email/password), account linking bidirezionale, e password reset via OTP. Il deck builder web permette di creare/modificare deck e carte in markdown con editor live preview, committate via edge function su un repo Git condiviso. Il contenuto viene dai repository Git, le domande sono pre-generate dal sistema. Docora sincronizza e genera domande AI per entrambi i flussi (repo utente e repo condiviso). |
| 5 | +Lumio è una piattaforma di studio basata su flashcard che sfrutta l'AI per trasformare concetti in sessioni di apprendimento interattive con ripetizione spaziata. Due frontend: app nativa Android (React Native/Expo) per lo studio e web app React SPA (deck.lumio.toto-castaldi.com) per la creazione di deck e carte. L'app Android è bilingue IT/EN con branding Lumio, ripetizione spaziata SM-2, sessioni configurabili con cap RPC, dashboard compatta 2x2, card browse, storico sessioni, gestione errori sync, autenticazione dual-mode (Google OAuth + email/password), account linking bidirezionale, password reset via OTP, e discovery di deck condivisi con ricerca fulltext e iscrizione. Il deck builder web permette di creare/modificare deck e carte in markdown con editor live preview e metadata (nome, descrizione, lingua, tag) salvati in deck.yaml, committate via edge function su un repo Git condiviso. Il contenuto viene dai repository Git, le domande sono pre-generate dal sistema. Docora sincronizza e genera domande AI per entrambi i flussi (repo utente e repo condiviso), e indicizza i metadata deck nel deck_index per la ricerca fulltext. |
6 | 6 |
|
7 | 7 | ## Core Value |
8 | 8 |
|
@@ -101,20 +101,20 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien |
101 | 101 | - ✓ Edge function deck-commit con 8 azioni GitHub API e isolamento path utente — v3.0 |
102 | 102 | - ✓ Docora sync repo condiviso per generazione AI — v3.0 |
103 | 103 | - ✓ Deploy produzione deck.lumio.toto-castaldi.com con SSL e CI/CD — v3.0 |
| 104 | +- ✓ deck_index table con fulltext search tsvector/GIN e ranking pesato (name > tags > description) — v3.1 |
| 105 | +- ✓ search_decks RPC con prefix matching per search-as-you-type e filtro tag — v3.1 |
| 106 | +- ✓ Iscrizione a sottocartella deck (subfolder_path su user_repositories) con studio filtrato — v3.1 |
| 107 | +- ✓ lumio-decks repo piattaforma sempre disponibile per sync Docora — v3.1 |
| 108 | +- ✓ docora-webhook indicizza deck.yaml in deck_index (upsert/delete) — v3.1 |
| 109 | +- ✓ deck-commit commit_yaml action con autore server-enforced e serializzazione YAML — v3.1 |
| 110 | +- ✓ DeckMetadataForm nel deck builder (nome, descrizione, lingua, tag) con caricamento/salvataggio YAML — v3.1 |
| 111 | +- ✓ Discovery tab (4° tab, icona bussola) con ricerca fulltext, chip tag, subscribe/unsubscribe ottimistico — v3.1 |
| 112 | +- ✓ Deck condivisi visibili nella schermata Repos con display_name arricchito da deck_index — v3.1 |
| 113 | +- ✓ i18n completa Discovery IT/EN (17 chiavi per lingua) — v3.1 |
104 | 114 |
|
105 | 115 | ### Active |
106 | 116 |
|
107 | | -## Current Milestone: v3.1 Deck Discovery |
108 | | - |
109 | | -**Goal:** Permettere agli utenti mobile di scoprire e aggiungere deck creati con il deck builder, tramite ricerca fulltext su metadata deck nel repo condiviso lumio-decks. |
110 | | - |
111 | | -**Target features:** |
112 | | -- Metadata a livello deck nel deck builder (nome, descrizione, categoria, tag) salvati in file deck.yaml |
113 | | -- Indice deck in Supabase con fulltext search Postgres, popolato dal sync Docora di lumio-decks |
114 | | -- Sincronizzazione lumio-decks a livello piattaforma (sempre presente) |
115 | | -- Schermata discovery nell'app mobile con search bar fulltext su nome, categoria, tag, autore |
116 | | -- Iscrizione utente a sottocartella specifica del repo condiviso (non intero repo) |
117 | | -- Visualizzazione carte filtrate per deck scelto |
| 117 | +(None — planning next milestone) |
118 | 118 |
|
119 | 119 | **Future milestones:** |
120 | 120 | - v3.2: TBD |
@@ -155,18 +155,19 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien |
155 | 155 |
|
156 | 156 | ## Context |
157 | 157 |
|
158 | | -**Stato attuale (post v3.0):** |
| 158 | +**Stato attuale (post v3.1):** |
159 | 159 | - Monorepo pnpm: apps/android (Expo/React Native), apps/deck-builder (Vite/React SPA), apps/landing (static HTML), packages/core, packages/shared |
160 | | -- Backend Supabase: auth (Google OAuth + email/password), DB, storage, edge functions (deck-commit con 8 azioni GitHub API), Docora webhook + study_sessions + card_review_schedule tables |
| 160 | +- Backend Supabase: auth (Google OAuth + email/password), DB, storage, edge functions (deck-commit con 9 azioni GitHub API + docora-webhook con deck.yaml indexing), Docora webhook + study_sessions + card_review_schedule + deck_index tables |
161 | 161 | - Tech stack Android: Expo SDK 54, React Native 0.81, react-navigation, @lumio/core, i18n-js, react-native-marked, supermemo@2.0.23 |
162 | 162 | - Tech stack Deck Builder: Vite 7, React 19, react-router 7, Tailwind 4, @uiw/react-md-editor 4, vitest |
163 | 163 | - CI/CD: lint-and-typecheck → build-apk → deploy-landing → deploy-deck-builder → deploy-migrations → deploy-functions |
164 | 164 | - Versioning: STATE.md milestone → extract-version.cjs → version.ts, APK versionName, landing page, edge function |
165 | 165 | - Auth condivisa: dual-mode Google OAuth + email/password, OTP verification, password reset, account linking bidirezionale |
166 | | -- App Android bilingue IT/EN con branding Lumio, SM-2, sessioni configurabili, dashboard 2x2, card browse, study history, sync error handling |
167 | | -- Deck builder web bilingue IT/EN con dark mode, deck CRUD, card authoring con markdown editor, live preview, toolbar |
168 | | -- ~49,200 LOC (TS/TSX/CSS/SQL) — ~20,600 Android + ~28,600 deck-builder |
169 | | -- 12 milestones shipped: v1.1 → v2.3 (mobile), v3.0 (deck builder web) |
| 166 | +- App Android bilingue IT/EN con branding Lumio, SM-2, sessioni configurabili, dashboard 2x2, card browse, study history, sync error handling, Discovery tab |
| 167 | +- Deck builder web bilingue IT/EN con dark mode, deck CRUD, card authoring con markdown editor, live preview, toolbar, metadata form (deck.yaml) |
| 168 | +- Discovery pipeline: deck.yaml → Docora webhook → deck_index (tsvector/GIN) → search_decks RPC → Discovery screen |
| 169 | +- ~56,900 LOC (TS/TSX/CSS/SQL) — ~28,300 Android + ~28,600 deck-builder |
| 170 | +- 13 milestones shipped: v1.1 → v3.1 |
170 | 171 |
|
171 | 172 | ## Constraints |
172 | 173 |
|
@@ -262,6 +263,20 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien |
262 | 263 | | Responsive MDEditor: split desktop, toggle mobile | Optimal UX per viewport via matchMedia | ✓ Good — v3.0 | |
263 | 264 | | HTTP-only Nginx template, Certbot adds SSL on server | SSL config is server-specific, not repo-portable | ✓ Good — v3.0 | |
264 | 265 | | deploy-deck-builder parallels deploy-landing in CI | Independent apps, no build dependency between them | ✓ Good — v3.0 | |
| 266 | +| Immutable wrapper function for tsvector generated column | PostgreSQL requires IMMUTABLE for generated columns; to_tsvector is STABLE | ✓ Good — v3.1 | |
| 267 | +| 'simple' tsvector config (no stemming) | Multilingual deck names need exact token match, not language-specific stemming | ✓ Good — v3.1 | |
| 268 | +| subfolder_path on user_repositories (not separate table) | Simpler schema, reuses existing subscription model | ✓ Good — v3.1 | |
| 269 | +| COALESCE-based unique index for nullable subfolder_path | Broader compatibility than NULLS NOT DISTINCT, clearer semantics | ✓ Good — v3.1 | |
| 270 | +| websearch_to_tsquery replaced with prefix matching | Search-as-you-type requires partial word matching (:* suffix) | ✓ Good — v3.1 | |
| 271 | +| Card count computed at query time (not stored) | Avoids sync complexity between cards table and deck_index | ✓ Good — v3.1 | |
| 272 | +| Transparent subfolder filter via JOIN conditions | No RPC signature changes, backward compatible with NULL subfolder_path | ✓ Good — v3.1 | |
| 273 | +| parseYaml wrapper reusing parseFrontmatter | No new YAML library needed; existing parser handles deck.yaml structure | ✓ Good — v3.1 | |
| 274 | +| Server-enforced author from user profile | Client value always ignored; prevents impersonation | ✓ Good — v3.1 | |
| 275 | +| UPSERT for idempotent webhook delivery | Handles out-of-order Docora webhook events gracefully | ✓ Good — v3.1 | |
| 276 | +| Client-side join for user_repositories + deck_index | No FK relationship, PostgREST cannot embed | ✓ Good — v3.1 | |
| 277 | +| 409 conflict as success in subscribeToDeck | Idempotent double-tap handling without error UI | ✓ Good — v3.1 | |
| 278 | +| Optimistic UI with Set rollback for subscribe | Immediate visual feedback, revert on error | ✓ Good — v3.1 | |
| 279 | +| Collapsible metadata form (collapsed by default) | Non-intrusive for quick deck browsing, expand when needed | ✓ Good — v3.1 | |
265 | 280 |
|
266 | 281 | --- |
267 | | -*Last updated: 2026-03-13 after v3.1 milestone start* |
| 282 | +*Last updated: 2026-03-16 after v3.1 milestone* |
0 commit comments