mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 21:16:41 +02:00
✨ feat: add mana-api-gateway for monetizing core services
Implement custom NestJS API Gateway for mana-search, mana-stt, and mana-tts: - API Key management with CRUD operations and key regeneration - Redis-based sliding window rate limiting - Credit-based billing with tier support (free, pro, enterprise) - Usage tracking with daily aggregates - Proxy services to backend microservices - Prometheus metrics endpoint - JWT auth for management API, API key auth for public API Database schema uses separate `api_gateway` schema in shared manacore DB.
This commit is contained in:
parent
fbd315eac0
commit
6f1b2654f1
48 changed files with 2507 additions and 0 deletions
34
services/mana-api-gateway/.env.example
Normal file
34
services/mana-api-gateway/.env.example
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Server
|
||||
PORT=3030
|
||||
NODE_ENV=development
|
||||
|
||||
# Database (same as mana-core-auth)
|
||||
DATABASE_URL=postgresql://manacore:devpassword@localhost:5432/manacore
|
||||
|
||||
# Redis
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=
|
||||
|
||||
# Backend Services
|
||||
SEARCH_SERVICE_URL=http://localhost:3021
|
||||
STT_SERVICE_URL=http://localhost:3020
|
||||
TTS_SERVICE_URL=http://localhost:3022
|
||||
|
||||
# Auth Service (for JWT validation & credits)
|
||||
MANA_CORE_AUTH_URL=http://localhost:3001
|
||||
|
||||
# API Key Generation
|
||||
API_KEY_PREFIX_LIVE=sk_live_
|
||||
API_KEY_PREFIX_TEST=sk_test_
|
||||
|
||||
# Rate Limiting Defaults
|
||||
DEFAULT_RATE_LIMIT=10
|
||||
DEFAULT_MONTHLY_CREDITS=100
|
||||
|
||||
# CORS
|
||||
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
|
||||
|
||||
# Development Auth Bypass
|
||||
DEV_BYPASS_AUTH=true
|
||||
DEV_USER_ID=00000000-0000-0000-0000-000000000000
|
||||
Loading…
Add table
Add a link
Reference in a new issue