managarten/services/cards-server
Till JS 5dbc9ace2d feat(cards): Phase ζ.1 — Paid decks via mana-credits
Server (cards-server):
- lib/credits.ts: thin internal-API client for mana-credits
  (reserve / commit / refund-reservation / grant). Service-to-
  service via X-Service-Key. Throws InsufficientCreditsError
  separately so the buy flow can branch on UX.
- services/purchases.ts: 4-step purchase pipeline: reserve →
  insert deck_purchases row → commit reservation → grant
  author share + insert author_payouts. Idempotent on
  (buyer, deck) so a refresh-spam-click can't double-charge.
  Verified-mana authors get the 90/10 split, others 80/20
  (already in config). Refunds intentionally out of scope —
  see MARKETPLACE_PLAN §13a.
- routes/purchases.ts: POST /v1/decks/:slug/purchase,
  GET /v1/me/purchases, GET /v1/authors/me/payouts.
- decks.bySlug now returns hasPurchased (null when anonymous,
  bool when authed) so the deck-detail page can pick the right
  CTA.
- subscriptions.subscribe now blocks paid decks unless the
  caller has a non-refunded purchase row (owner exempt for
  testing).
- Notify: author gets a "Verkauf"-Email at grant time, with a
  deterministic externalId for dedup.

Frontend (cards-web):
- /d/<slug> shows "Kaufen für N 💎" instead of "Abonnieren"
  when paid + not yet bought; flips to subscribe path once
  purchased.
- /me/purchases page listing buyer history + (when present)
  author-payout history. Linked from the top nav.
2026-05-07 23:10:18 +02:00
..
drizzle feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
src feat(cards): Phase ζ.1 — Paid decks via mana-credits 2026-05-07 23:10:18 +02:00
.gitignore feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
CLAUDE.md feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
Dockerfile feat(cards-server): Phase α.4 — Dockerfile + compose + tunnel route 2026-05-07 16:22:48 +02:00
drizzle.config.ts feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
package.json feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
README.md feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
tsconfig.json feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00

cards-server

Backend for the Cards marketplace. See CLAUDE.md for the technical overview and apps/cards/docs/MARKETPLACE_PLAN.md for the full product plan.