managarten/services/cards-server
Till JS dcd16067b5 feat(cards-server): Phase γ — public reads + browse + search + engagement
Marketplace discovery surface lights up. Anonymous browsers can
explore + search; signed-in users get the same surface plus star/
follow mutations.

  - middleware/optional-auth.ts: opportunistic JWT — sets c.get('user')
    if a token validates, otherwise leaves it undefined. Read paths
    use this; mutating routes call requireUser() inline.
  - services/explore.ts: browse() with q (ilike on title/description),
    tag, language, author-slug, sort (recent/popular/trending), pagination.
    explore() composes featured + trending for the landing.
    tagTree()/curatedTagsOnly() round it out. Subqueries for star/
    subscriber counts avoid N+1.
  - services/engagement.ts: star/unstar deck, follow/unfollow author.
    Idempotent via ON CONFLICT DO NOTHING. Self-follow rejected.
  - routes/explore.ts mounts /v1/explore, /v1/decks (browse list),
    /v1/tags. routes/engagement.ts mounts /v1/decks/:slug/star
    (POST/DELETE) + /v1/authors/:slug/follow (POST/DELETE).
  - index.ts replaces the previous strict-jwt-on-everything middleware
    with optionalAuth on all of /v1, then individual routers gate
    their write paths via local requireUser(). Hono context type
    relaxes from `user: AuthUser` to `user?: AuthUser` accordingly.

Validated: tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:01:32 +02:00
..
drizzle feat(cards-server): Phase α — service skeleton + 16-table schema 2026-05-07 16:01:08 +02:00
src feat(cards-server): Phase γ — public reads + browse + search + engagement 2026-05-07 17:01:32 +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.