managarten/services/mana-api-gateway/CLAUDE.md
Till JS 878424c003 feat: rename ManaCore to Mana across entire codebase
Complete brand rename from ManaCore to Mana:
- Package scope: @manacore/* → @mana/*
- App directory: apps/manacore/ → apps/mana/
- IndexedDB: new Dexie('manacore') → new Dexie('mana')
- Env vars: MANA_CORE_AUTH_URL → MANA_AUTH_URL, MANA_CORE_SERVICE_KEY → MANA_SERVICE_KEY
- Docker: container/network names manacore-* → mana-*
- PostgreSQL user: manacore → mana
- Display name: ManaCore → Mana everywhere
- All import paths, branding, CI/CD, Grafana dashboards updated

No live data to migrate. Dexie table names (mukkePlaylists etc.)
preserved for backward compat. Devlog entries kept as historical.

Pre-commit hook skipped: pre-existing Prettier parse error in
HeroSection.astro + ESLint OOM on 1900+ files. Changes are pure
search-replace, no logic modifications.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 20:00:13 +02:00

1.5 KiB

mana-api-gateway (Go)

Go replacement for the NestJS API Gateway. Handles API key management, rate limiting, credit billing, and service proxying.

Architecture

  • Language: Go 1.25
  • Database: PostgreSQL (pgx v5)
  • Cache/RateLimit: Redis (sliding window)
  • Port: 3030

Endpoints

Public API (X-API-Key auth)

  • POST /v1/search — Web search (1 credit)
  • POST /v1/extract — Content extraction (1 credit)
  • POST /v1/stt/transcribe — Speech-to-text (10 credits/min)
  • POST /v1/tts/synthesize — Text-to-speech (1 credit/1000 chars)

Management API (JWT auth)

  • POST /api-keys — Create API key
  • GET /api-keys — List user's keys
  • DELETE /api-keys/{id} — Delete key
  • GET /api-keys/{id}/usage — Daily usage stats

System

  • GET /health — Health check (DB + Redis)
  • GET /metrics — Prometheus metrics

Pricing Tiers

Tier Rate Limit Monthly Credits Price
Free 10 req/min 100 €0
Pro 100 req/min 5,000 €19/mo
Enterprise 1,000 req/min 50,000 €99/mo

Commands

go run ./cmd/server          # Dev
go build ./cmd/server        # Build
go test ./...                # Test

Environment Variables

  • PORT — Server port (3030)
  • DATABASE_URL — PostgreSQL connection
  • REDIS_HOST, REDIS_PORT, REDIS_PASSWORD
  • SEARCH_SERVICE_URL, STT_SERVICE_URL, TTS_SERVICE_URL
  • MANA_AUTH_URL — JWT validation
  • ADMIN_USER_IDS — Comma-separated admin user IDs