managarten/apps/api
Till JS 76d11a84ee feat(auth): server-side tier gating via requireTier middleware
The JWT already carried a `tier` claim but nothing on the server read it
— AuthGate enforcement was client-only, so a valid JWT could hit paid
LLM/research endpoints regardless of the user's access tier.

- shared-hono authMiddleware now extracts `tier` into `c.userTier`,
  defaulting unknown/missing claims to `public` (never silently grants
  higher access).
- New `requireTier(minTier)` middleware + `hasTier`/`getTierLevel`
  helpers. Tier hierarchy (guest < public < beta < alpha < founder) is
  mirrored locally to avoid pulling the Svelte-facing shared-branding
  package into Bun services.
- Applied `requireTier('beta')` as defense-in-depth on resource-heavy
  apps/api modules (chat, context, food, guides, news-research, picture,
  plants, research, traces, who) and the MCP endpoint. Pure CRUD modules
  stay auth-only — access there is gated by ownership, not tier.
- DEV_BYPASS_AUTH now injects `userTier` (defaults to founder, override
  via DEV_USER_TIER).
- Authentication guideline documents the pattern + test suite covers
  hierarchy, passes-at-minimum, and rejection paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 17:38:06 +02:00
..
drizzle/research feat(questions): deep-research module — mana-search + mana-llm pipeline 2026-04-08 22:15:35 +02:00
scripts feat(who): add character dossier system for staged fact disclosure 2026-04-10 17:40:16 +02:00
src feat(auth): server-side tier gating via requireTier middleware 2026-04-19 17:38:06 +02:00
Dockerfile fix(api/Dockerfile): copy @mana/shared-types into the build context 2026-04-09 17:25:23 +02:00
drizzle.config.ts feat(questions): deep-research module — mana-search + mana-llm pipeline 2026-04-08 22:15:35 +02:00
drizzle.presi.config.ts fix(presi): wire up db:push for presi schema via @mana/api 2026-04-12 14:32:44 +02:00
package.json feat(api): MCP server endpoint — expose AI tools to external clients 2026-04-16 13:37:52 +02:00
tsconfig.json fix(api): unblock tsc by dropping rootDir and allowing .ts imports 2026-04-15 18:51:26 +02:00