managarten/apps-archived/maerchenzauber/apps/backend
Wuesteon 9c47119535 Fix wrong type
import, make auth and chat work
2025-12-04 23:25:25 +01:00
..
docs chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
migrations chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
scripts chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
src Fix wrong type 2025-12-04 23:25:25 +01:00
test chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.dockerignore chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.env.example chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.env.prod chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.eslintrc.js chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.gitignore chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.npmrc chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
.prettierrc chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
Dockerfile chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
get-db-schema.sql chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
make-character-public.sql chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
nest-cli.json chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
NESTJS_CLS_SOLUTION.md chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
package.json chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
README.md chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
README_CHARACTER_UPDATE_FIX.md chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
RLS_IMPLEMENTATION_GUIDE.md chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
RUN_THIS_MIGRATION.sql chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
schema-diagram.dbml chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
schema-diagram.html chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
test-public-characters.sql chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
test-supabase-mcp.ts chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
test-trigger.sql chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
tsconfig.build.json chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00
tsconfig.json chore: archive inactive projects to apps-archived/ 2025-11-29 07:03:59 +01:00

storyteller-backend

Authentication

This application uses Supabase for authentication, following a multi-Supabase architecture:

  1. A central auth Supabase instance ("mana") handles user authentication
  2. An application-specific Supabase instance ("maerchenzauber") handles application data
  3. The NestJS backend serves as a token exchange middleware and application server

Setup Requirements

You need to set up two Supabase instances:

  1. mana - Central authentication service
  2. maerchenzauber - Application-specific database

See auth.md for detailed setup instructions and database schema.

Environment Variables

Configure the following environment variables (see .env.example):

  • MANA_SUPABASE_URL - URL of the central auth Supabase instance
  • MANA_SUPABASE_ANON_KEY - Anon key for the central auth Supabase
  • MANA_JWT_SECRET - JWT secret for verifying tokens from the central auth
  • MAERCHENZAUBER_SUPABASE_URL - URL of the application Supabase instance
  • MAERCHENZAUBER_SUPABASE_ANON_KEY - Anon key for the application Supabase
  • MAERCHENZAUBER_JWT_SECRET - JWT secret for signing tokens for the application Supabase
  • APP_ID - Application identifier (default: "8d2f5ddb-e251-4b3b-8802-84022a7ac77f")

Build and Deploy

gcloud config set project storyteller-a1fde

build it and deploy it to cloud run

gcloud builds submit --tag gcr.io/storyteller-a1fde/storyteller-api:v1.5.7

after sucesfull build it shows something like this

gcr.io/storyteller-a1fde/storyteller-api:v1.5.7

then run

gcloud run deploy storyteller-api
--image gcr.io/storyteller-a1fde/storyteller-api:v1.5.7
--region=us-central1
--platform=managed
--allow-unauthenticated

currently deployed: gcr.io/storyteller-a1fde/storyteller-api:v1.5.7

Testing Request

curl -X POST http://localhost:3000/story
-H "Content-Type: application/json"
-d '{ "characters": ["7d800d18-dcb4-4a48-addf-c6a6a88dd7ed"], "storyDescription": "A fun adventure story about friendship and courage", "illustratorId": "QsqH9Cyds24rRbAYf6zT", "authorId": "fKMNQsgKojozOHTnjAbs" }'