Skip to content

Configuration

All backend configuration is loaded from environment variables (or a .env file in the backend directory).

VariableRequiredDefaultDescription
DATABASE_URLNopostgres://postgres:postgres@localhost:54322/postgresPostgreSQL connection string
SUPABASE_JWT_SECRETYesJWT secret from Supabase (used to verify auth tokens)
BASE_PATHNo(empty)URL prefix for all routes. Empty serves at the domain root; set it when the app lives under a path, as on the CiTIUS instance (/chatty)
HOSTNo0.0.0.0Address the server binds to
PORTNo5000Port the server listens on
OPENAI_KEYNoOpenAI API key (enables GPT-4, GPT-4 Turbo, GPT-3.5 Turbo)
MISTRAL_KEYNoMistral API key (enables Mistral 7B, Large, Small, Codestral)
GEMINI_KEYNoGoogle Gemini API key (enables Gemini 1.5 Flash/Pro, 1.0 Pro)
HF_KEYNoHuggingFace API key (enables Flan-T5 Small/Base)
OLLAMA_HOSTNohttp://localhost:11434Ollama server URL (auto-discovers available models)

These variables are set in the frontend .env file and must be prefixed with PUBLIC_ (SvelteKit convention).

VariableRequiredDefaultDescription
PUBLIC_BASE_PATHNo(empty)Base path for the SvelteKit app (must match backend BASE_PATH)
PUBLIC_SUPABASE_URLYesSupabase API URL (e.g., http://localhost:54321)
PUBLIC_SUPABASE_ANON_KEYYesSupabase anonymous key for client-side auth
ORIGINNoThe origin URL, required in production for CSRF protection

The backend uses a plugin registry that automatically registers models when the corresponding API key is provided. No key means that provider is skipped silently.

ProviderEnv varModels registered
OpenAIOPENAI_KEYGPT-4, GPT-4 Turbo, GPT-3.5 Turbo
MistralMISTRAL_KEYMistral 7B, Mistral Large, Mistral Small, Codestral
GeminiGEMINI_KEYGemini 1.5 Flash, Gemini 1.5 Pro, Gemini 1.0 Pro
HuggingFaceHF_KEYFlan-T5 Small, Flan-T5 Base
OllamaOLLAMA_HOSTAuto-discovered from running Ollama instance

Chatty the Lab uses Supabase Auth with Google as the OAuth provider.

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to APIs & Services > Credentials
  4. Click Create Credentials > OAuth client ID
  5. Select Web application
  6. Add authorized redirect URIs:
    • Local development: http://localhost:54321/auth/v1/callback
    • Production: https://your-domain.com/auth/callback (add the base path if you set one)
  7. Note the Client ID and Client Secret

For local development (supabase/config.toml):

[auth.external.google]
enabled = true
client_id = "your-google-client-id"
secret = "your-google-client-secret"
redirect_uri = "http://localhost:54321/auth/v1/callback"

For production (via environment variables in docker-compose.prod.yml):

supabase-auth:
environment:
GOTRUE_EXTERNAL_GOOGLE_ENABLED: "true"
GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOTRUE_EXTERNAL_GOOGLE_SECRET: ${GOOGLE_CLIENT_SECRET}
GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI: https://tec.citius.usc.es/chatty/auth/callback

After configuring, restart Supabase (supabase stop && supabase start) and navigate to the login page. Clicking “Sign in with Google” should redirect to the Google consent screen.