mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 18:41:08 +02:00
End-to-end subscribe flow on cards.mana.how. From a public deck page
the user can now pull the deck into their own Cards instance with
one click; subscribed decks live alongside own decks but carry a
`subscribedFromSlug` marker so the editor knows to hide mutate
controls (UI gating in δ.3).
- cards-core types: LocalDeck gains subscribedFromSlug +
subscribedAtVersion. LocalCard gains serverContentHash. Both
optional — own decks/cards are unaffected.
- data/database.ts: Dexie v2 adds index on cardDecks.subscribedFromSlug
so the lookup-by-slug path is O(1).
- lib/api/cards-api.ts: subscriptions.{list,subscribe,unsubscribe,
version,diff} + the SubscriptionInfo / ServerCard / DeckVersionPayload
/ DiffPayload types.
- lib/services/subscribe.ts: subscribeAndPull() sequences server
POST /subscribe → GET /decks/:slug → GET /versions/:semver →
create LocalDeck + LocalCards + ensure FSRS reviews. Re-pull
refreshes in place (Phase δ.3 will swap to real diff-apply that
keeps FSRS state). unsubscribe() soft-deletes the local mirror.
isSubscribedLocally() backs the deck-page state check.
- routes/d/[slug]/+page.svelte: full subscribe UI — Abonnieren →
Abonniert + Lernen-Button (deep-links into the existing learn
session route).
Validated: svelte-check 0/0, vite build green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| apps/web | ||
| docs | ||
| COMPETITORS_2026-05.md | ||
| GUIDELINES.md | ||
| package.json | ||
| README.md | ||
Cards
Spaced-repetition flashcards on cards.mana.how.
Phase-1 standalone web app. The frontend lives here; data, auth, and sync are shared with the rest of the Mana stack:
- Auth: mana-auth (SSO),
*.mana.how - Sync: mana-sync, app-id
cards - Storage:
mana_platform.cards.*(Postgres, RLS)
The same cards data backs the mana built-in Cards module at
mana.how/cards. Schema changes ship to both frontends together — see
apps/cards/GUIDELINES.md.
Layout
apps/cards/
├── apps/
│ └── web/ # SvelteKit 2 + Svelte 5 — the Phase-1 surface
├── GUIDELINES.md # Project rules (read first)
└── README.md
apps/cards/apps/mobile/ and any production apps/cards/apps/landing/
will land in Phase 2/3.
Quick start
pnpm install
pnpm --filter @cards/web dev # cards.mana.how on http://localhost:5180