feat(services): create mana-subscriptions, remove from mana-core-auth

Extract subscription billing into standalone mana-subscriptions service
(Hono + Bun, Port 3063). Also removes Stripe module from mana-core-auth
since subscription webhooks are the last consumer.

New service (services/mana-subscriptions/):
- Plans CRUD, subscription management, Stripe Checkout + Portal
- Invoice tracking, webhook handlers for sub/invoice events
- Internal API for plan limits (consumed by guilds service)
- ~990 LOC (vs ~1,700 in NestJS incl. Stripe module)

Removed from mana-core-auth:
- subscriptions/ module (6 files)
- stripe/ module (4 files) — no longer needed in auth
- db/schema/subscriptions.schema.ts
- guilds.service.ts: replaced direct DB plan limit query with
  HTTP call to mana-subscriptions internal API

mana-core-auth now contains only:
- Auth (Better Auth, JWT, Sessions, 2FA, Passkeys, OIDC)
- Organizations/Guilds (membership only, no credits/plans)
- API Keys, Security, Me (GDPR), Health, Metrics
- Feedback + Analytics (next extraction target)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-28 02:11:42 +01:00
parent dd2f814cf3
commit e7a8567e61
131 changed files with 14 additions and 8727 deletions

View file

@ -132,15 +132,14 @@ manacore-monorepo/
│ ├── mana-core-auth/ # Central authentication service
│ ├── mana-credits/ # Credit system (Hono + Bun, extracted from auth)
│ ├── mana-user/ # User settings, tags, storage (Hono + Bun, extracted from auth)
│ ├── mana-search/ # Central search & content extraction (NestJS, legacy)
│ ├── mana-search-go/ # Central search & content extraction (Go, active)
│ ├── mana-crawler/ # Web crawler service
│ ├── mana-subscriptions/ # Subscription billing (Hono + Bun, extracted from auth)
│ ├── mana-search-go/ # Central search & content extraction (Go)
│ ├── mana-crawler-go/ # Web crawler service (Go)
│ ├── mana-llm/ # Central LLM abstraction service
│ ├── mana-landing-builder/# Org landing page builder (Astro → Cloudflare Pages)
│ ├── mana-media/ # Central media platform (CAS, thumbnails)
│ ├── mana-api-gateway/ # API gateway with rate limiting
│ ├── mana-notify/ # Notification service (NestJS, legacy)
│ ├── mana-notify-go/ # Notification service (Go, active)
│ ├── mana-api-gateway-go/ # API gateway with rate limiting (Go)
│ ├── mana-notify-go/ # Notification service (Go)
│ ├── mana-image-gen/ # Local AI image generation (FLUX)
│ ├── mana-stt/ # Speech-to-text service
│ ├── mana-tts/ # Text-to-speech service
@ -449,14 +448,11 @@ GET /metrics
#### Starting the Service
```bash
# Start SearXNG + Redis (for local NestJS development)
cd services/mana-search && docker-compose -f docker-compose.dev.yml up -d
# Start SearXNG + Redis for local development
cd services/mana-search-go && docker-compose -f docker-compose.dev.yml up -d
# Start NestJS API
pnpm --filter @mana-search/service dev
# Or start everything via Docker
cd services/mana-search && docker-compose up -d
# Start Go search service
cd services/mana-search-go && go run ./cmd/server
```
#### Environment Variables
@ -936,9 +932,9 @@ Each project has its own `CLAUDE.md` with detailed information:
- `apps/chat/CLAUDE.md` - Chat API endpoints, AI models
- `apps/picture/CLAUDE.md` - AI image generation
- `services/mana-core-auth/` - Central authentication service
- `services/mana-search/CLAUDE.md` - Search & content extraction service (NestJS, legacy)
- `services/mana-search-go/CLAUDE.md` - Search & content extraction service (Go, active)
- `services/mana-crawler/CLAUDE.md` - Web crawler service
- `services/mana-search-go/CLAUDE.md` - Search & content extraction service (Go)
- `services/mana-crawler-go/CLAUDE.md` - Web crawler service (Go)
- `services/mana-notify-go/CLAUDE.md` - Notification service (Go)
- `services/mana-llm/CLAUDE.md` - Central LLM abstraction service
- `services/mana-landing-builder/CLAUDE.md` - Org landing page builder service