OneraOnera Docs
Self-Hosting

Configuration

Environment variables, Supabase setup, and WebAuthn configuration

Configuration

Onera is configured through environment variables. There are three .env.example files in the repository:

  • Root .env.example — Shared variables used by Docker Compose
  • apps/server/.env.example — Backend-specific variables
  • apps/web/.env.example — Frontend-specific variables

When deploying with Docker Compose, all variables are set in the root .env file.

Required Variables

These must be set for Onera to function:

VariableDescription
POSTGRES_PASSWORDPassword for the PostgreSQL database (Docker Compose only)
DATABASE_URLPostgreSQL connection string. Set automatically in Docker Compose. For non-Docker setups: postgresql://user:pass@host:5432/onera
SUPABASE_URLSupabase project URL from supabase.com/dashboard
SUPABASE_SECRET_KEYSupabase service_role key
VITE_SUPABASE_URLSupabase project URL (build-time, same as SUPABASE_URL)
VITE_SUPABASE_PUBLISHABLE_KEYSupabase publishable key

URL Variables

VariableDefaultDescription
FRONTEND_URLhttp://localhost:5173Frontend origin, used for CORS. Comma-separated for multiple origins.
VITE_API_URLhttp://localhost:3000Backend API URL, baked into the frontend at build time
VITE_WS_URLhttp://localhost:3000WebSocket URL, baked into the frontend at build time

For production with a reverse proxy, all three should be your public domain (e.g. https://chat.example.com).

WebAuthn / Passkeys

WebAuthn (passkeys) are domain-bound. If you deploy to a custom domain, you must configure these or passkey registration and authentication will fail:

VariableDefaultDescription
WEBAUTHN_RP_IDlocalhostYour domain without protocol or port (e.g. example.com)
WEBAUTHN_RP_NAMEOneraDisplay name shown during passkey prompts
WEBAUTHN_ORIGINhttp://localhost:5173Full origin URL including protocol (e.g. https://chat.example.com)

Important: The WEBAUTHN_RP_ID must match the domain users access Onera from. If you use a subdomain like chat.example.com, set WEBAUTHN_RP_ID to either chat.example.com or example.com (the latter allows passkeys to work across subdomains).

Optional Variables

VariableDefaultDescription
PORT3000Backend server port
NODE_ENVproductionSet automatically in Docker
DODO_PAYMENTS_API_KEYDodo Payments API key (for billing)
DODO_PAYMENTS_WEBHOOK_SECRETDodo Payments webhook secret

Supabase Setup

Onera uses Supabase for authentication and database. To set up:

  1. Create a project at supabase.com/dashboard
  2. Go to Settings → API to get your keys
  3. Copy:
    • Project URLSUPABASE_URL and VITE_SUPABASE_URL
    • service_role keySUPABASE_SECRET_KEY
    • publishable keyVITE_SUPABASE_PUBLISHABLE_KEY
  4. Go to Settings → Database for the connection string → DATABASE_URL

Auth Providers

In your Supabase dashboard under Authentication → Providers, configure:

  • Email — enabled by default
  • Google OAuth — add your Google Cloud credentials
  • Apple OAuth — add your Apple Developer credentials

Build-Time vs Runtime Variables

Some variables are baked into the frontend at build time (during docker compose build):

VariableWhen Applied
VITE_API_URLBuild time
VITE_WS_URLBuild time
VITE_SUPABASE_URLBuild time
VITE_SUPABASE_PUBLISHABLE_KEYBuild time
All other variablesRuntime

If you change a VITE_* variable, you must rebuild the web container:

docker compose build web
docker compose up -d web

Example Production .env

# Database
POSTGRES_PASSWORD=a-very-strong-random-password

# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SECRET_KEY=sb_secret_...
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_PUBLISHABLE_KEY=sb_publishable_...

# URLs (all pointing to your public domain)
FRONTEND_URL=https://chat.example.com
VITE_API_URL=https://chat.example.com
VITE_WS_URL=https://chat.example.com

# WebAuthn (required for passkeys on your domain)
WEBAUTHN_RP_ID=example.com
WEBAUTHN_RP_NAME=Onera
WEBAUTHN_ORIGIN=https://chat.example.com

On this page