managarten/services/mana-auth/src
Till JS 698ffe797c feat(spaces): add spaces pg schema — credentials + module_permissions
Groundwork for server-side Space extensions that must NOT live in Dexie:
  - spaces.credentials         — per-space OAuth tokens, API keys, SMTP
                                 configs. Access tokens are stored
                                 encrypted at rest with the service KEK.
  - spaces.module_permissions  — role × module read/write/admin overrides
                                 on top of the SPACE_MODULE_ALLOWLIST
                                 defaults.

Both tables FK to auth.organizations with ON DELETE CASCADE so deleting
a space drops its credentials and permission overrides automatically.

RLS is intentionally deferred — enabling it now would lock out services
that don't yet pass space context. A follow-up migration turns it on
after mana-api speaks the Spaces protocol end-to-end.

To apply locally: bun run db:push in services/mana-auth, or psql -f
sql/004_spaces.sql against the mana_platform DB.

No runtime code reads these tables yet — they're the scaffolding that
Task-8 (mana-sync) and the eventual social-relay/clubs modules will
consume.

Plan: docs/plans/spaces-foundation.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 16:13:33 +02:00
..
auth feat(spaces): auto-create personal space on signup via Better Auth hook 2026-04-20 16:10:26 +02:00
db feat(spaces): add spaces pg schema — credentials + module_permissions 2026-04-20 16:13:33 +02:00
email feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
lib feat(services): create mana-auth (Hono + Bun) — Phase 5 auth rewrite 2026-03-28 02:43:44 +01:00
middleware refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
routes docs: update architecture comparison — 5/10 roadmap items done 2026-04-16 15:00:09 +02:00
services feat(ai,auth): Mission Grant endpoint + unwrap helper + audit table 2026-04-15 13:41:59 +02:00
spaces feat(spaces): auto-create personal space on signup via Better Auth hook 2026-04-20 16:10:26 +02:00
config.ts feat(ai,auth): Mission Grant endpoint + unwrap helper + audit table 2026-04-15 13:41:59 +02:00
index.ts feat(ai,auth): Mission Grant endpoint + unwrap helper + audit table 2026-04-15 13:41:59 +02:00