mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 00:01:10 +02:00
feat(context): add NestJS backend, PostgreSQL database, and migrate web app from Supabase to API
- Create NestJS backend on port 3020 with 4 modules (space, document, ai, token) - Add Drizzle schema with 5 tables (spaces, documents, token_transactions, model_prices, user_tokens) - Rewrite web services (spaces, documents, tokens, ai) to use shared API client instead of Supabase - Move AI API keys server-side (Azure OpenAI, Google Gemini) - Add seed script for model prices (gpt-4.1, gemini-pro, gemini-flash) - Add 70 unit tests across 4 test suites (space, document, token, ai services) - Add monorepo integration (setup-databases.sh, generate-env.mjs, docker init-db, root scripts) - Remove @supabase/supabase-js dependency and delete supabase.ts from web app - Update CLAUDE.md with full API documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7f4edb3dfb
commit
ea4b585f37
50 changed files with 4041 additions and 361 deletions
|
|
@ -381,6 +381,32 @@ const APP_CONFIGS = [
|
|||
},
|
||||
},
|
||||
|
||||
// Context Backend (NestJS)
|
||||
{
|
||||
path: 'apps/context/apps/backend/.env',
|
||||
vars: {
|
||||
NODE_ENV: () => 'development',
|
||||
PORT: (env) => env.CONTEXT_BACKEND_PORT || '3020',
|
||||
DATABASE_URL: (env) => env.CONTEXT_DATABASE_URL,
|
||||
MANA_CORE_AUTH_URL: (env) => env.MANA_CORE_AUTH_URL,
|
||||
DEV_BYPASS_AUTH: () => 'true',
|
||||
DEV_USER_ID: (env) => env.DEV_USER_ID || '00000000-0000-0000-0000-000000000000',
|
||||
AZURE_OPENAI_API_KEY: (env) => env.CONTEXT_AZURE_OPENAI_API_KEY || '',
|
||||
AZURE_OPENAI_ENDPOINT: (env) => env.CONTEXT_AZURE_OPENAI_ENDPOINT || '',
|
||||
GOOGLE_API_KEY: (env) => env.CONTEXT_GOOGLE_API_KEY || '',
|
||||
CORS_ORIGINS: (env) => env.CORS_ORIGINS,
|
||||
},
|
||||
},
|
||||
|
||||
// Context Web (SvelteKit)
|
||||
{
|
||||
path: 'apps/context/apps/web/.env',
|
||||
vars: {
|
||||
PUBLIC_BACKEND_URL: (env) => `http://localhost:${env.CONTEXT_BACKEND_PORT || '3020'}`,
|
||||
PUBLIC_MANA_CORE_AUTH_URL: (env) => env.MANA_CORE_AUTH_URL,
|
||||
},
|
||||
},
|
||||
|
||||
// Calendar Backend (NestJS)
|
||||
{
|
||||
path: 'apps/calendar/apps/backend/.env',
|
||||
|
|
@ -662,6 +688,34 @@ const APP_CONFIGS = [
|
|||
},
|
||||
},
|
||||
|
||||
// Mukke Backend (NestJS)
|
||||
{
|
||||
path: 'apps/mukke/apps/backend/.env',
|
||||
vars: {
|
||||
NODE_ENV: () => 'development',
|
||||
PORT: (env) => env.MUKKE_BACKEND_PORT || '3010',
|
||||
DATABASE_URL: (env) => env.MUKKE_DATABASE_URL,
|
||||
MANA_CORE_AUTH_URL: (env) => env.MANA_CORE_AUTH_URL,
|
||||
S3_ENDPOINT: (env) => env.S3_ENDPOINT || 'http://localhost:9000',
|
||||
S3_REGION: (env) => env.S3_REGION || 'us-east-1',
|
||||
S3_ACCESS_KEY: (env) => env.S3_ACCESS_KEY || 'minioadmin',
|
||||
S3_SECRET_KEY: (env) => env.S3_SECRET_KEY || 'minioadmin',
|
||||
S3_BUCKET: () => 'mukke-storage',
|
||||
DEV_BYPASS_AUTH: () => 'true',
|
||||
DEV_USER_ID: (env) => env.DEV_USER_ID || '00000000-0000-0000-0000-000000000000',
|
||||
CORS_ORIGINS: (env) => env.CORS_ORIGINS,
|
||||
},
|
||||
},
|
||||
|
||||
// Mukke Web (SvelteKit)
|
||||
{
|
||||
path: 'apps/mukke/apps/web/.env',
|
||||
vars: {
|
||||
PUBLIC_BACKEND_URL: (env) => `http://localhost:${env.MUKKE_BACKEND_PORT || '3010'}`,
|
||||
PUBLIC_MANA_CORE_AUTH_URL: (env) => env.MANA_CORE_AUTH_URL,
|
||||
},
|
||||
},
|
||||
|
||||
// LLM Playground (SvelteKit)
|
||||
{
|
||||
path: 'services/llm-playground/.env',
|
||||
|
|
|
|||
|
|
@ -81,8 +81,9 @@ ALL_DATABASES=(
|
|||
"nutriphi_bot"
|
||||
"questions"
|
||||
"skilltree"
|
||||
"lightwrite"
|
||||
"mukke"
|
||||
"traces"
|
||||
"context"
|
||||
)
|
||||
|
||||
# Check if specific service requested
|
||||
|
|
@ -192,17 +193,21 @@ setup_service() {
|
|||
create_db_if_not_exists "skilltree"
|
||||
push_schema "@skilltree/backend" "skilltree"
|
||||
;;
|
||||
lightwrite)
|
||||
create_db_if_not_exists "lightwrite"
|
||||
push_schema "@lightwrite/backend" "lightwrite"
|
||||
mukke)
|
||||
create_db_if_not_exists "mukke"
|
||||
push_schema "@mukke/backend" "mukke"
|
||||
;;
|
||||
traces)
|
||||
create_db_if_not_exists "traces"
|
||||
push_schema "@traces/backend" "traces"
|
||||
;;
|
||||
context)
|
||||
create_db_if_not_exists "context"
|
||||
push_schema "@context/backend" "context"
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Unknown service: $service${NC}"
|
||||
echo "Available services: auth, chat, zitare, contacts, calendar, clock, todo, manadeck, mail, moodlit, picture, photos, finance, voxel-lava, figgos, planta, nutriphi, presi, storage, projectdoc, zitare_bot, todo_bot, nutriphi_bot, questions, skilltree, lightwrite, traces"
|
||||
echo "Available services: auth, chat, zitare, contacts, calendar, clock, todo, manadeck, mail, moodlit, picture, photos, finance, voxel-lava, figgos, planta, nutriphi, presi, storage, projectdoc, zitare_bot, todo_bot, nutriphi_bot, questions, skilltree, mukke, traces, context"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -226,7 +231,7 @@ echo -e "\n${GREEN}Step 2: Pushing schemas${NC}"
|
|||
echo "--------------------------------------"
|
||||
|
||||
# Push schemas for all known services
|
||||
for service in auth chat zitare contacts calendar clock todo manadeck picture photos mail moodlit finance voxel-lava figgos planta nutriphi presi storage questions skilltree lightwrite traces; do
|
||||
for service in auth chat zitare contacts calendar clock todo manadeck picture photos mail moodlit finance voxel-lava figgos planta nutriphi presi storage questions skilltree mukke traces context; do
|
||||
setup_service "$service" 2>/dev/null || true
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue