Environment Variables Reference
Complete reference for all Supamode environment variables. Configure the frontend, API, Supabase connection, authentication, and optional features.
Environment variables are configuration values set outside your code that control how Supamode connects to Supabase, handles authentication, and behaves in different environments. They keep secrets out of your codebase and allow the same code to run in development and production.
Supamode uses environment variables to configure both the frontend (Vite) and backend (Hono API). This reference covers all available variables, their purposes, and example values.
Quick Setup
For local development, copy the template files and fill in your values:
# Frontendcp apps/app/.env.template apps/app/.env# Backendcp apps/api/.env.template apps/api/.envFrontend Variables (apps/app/.env)
These variables configure the React frontend. Variables prefixed with VITE_ are exposed to the browser.
Required
| Variable | Description | Example |
|---|---|---|
VITE_SUPABASE_URL | Supabase project URL | http://localhost:54331 (local) or https://abc.supabase.co |
VITE_SUPABASE_ANON_KEY | Supabase anonymous key | eyJhbGciOiJIUzI1NiIs... |
VITE_SITE_URL | Application URL | http://localhost:5173 |
Optional
| Variable | Default | Description |
|---|---|---|
VITE_OAUTH_PROVIDERS | "" | Comma-separated OAuth providers: google,github,azure |
VITE_DEFAULT_THEME | dark | Default UI theme: dark or light |
VITE_ENABLE_VERSION_CHECK | false | Show warning when client/server versions mismatch |
VITE_CAPTCHA_SITE_KEY | "" | Cloudflare Turnstile site key for captcha |
Example .env File
# RequiredVITE_SUPABASE_URL=http://localhost:54331VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...VITE_SITE_URL=http://localhost:5173# OptionalVITE_OAUTH_PROVIDERS=google,githubVITE_DEFAULT_THEME=darkVITE_ENABLE_VERSION_CHECK=falseBackend Variables (apps/api/.env)
These variables configure the Hono API server.
Required
| Variable | Description | Example |
|---|---|---|
SUPABASE_URL | Supabase project URL | http://localhost:54331 |
SUPABASE_ANON_KEY | Supabase anonymous key | eyJhbGciOiJIUzI1NiIs... |
SERVICE_ROLE_KEY | Supabase service role key | eyJhbGciOiJIUzI1NiIs... |
SUPABASE_DATABASE_URL | Direct PostgreSQL connection | postgresql://postgres:postgres@127.0.0.1:54332/postgres |
APP_URL | Frontend URL (for CORS) | http://localhost:5173 |
Optional
| Variable | Default | Description |
|---|---|---|
PERF_LOG_LEVEL | off | Performance logging: off, basic, detailed |
Example .env File
# RequiredSUPABASE_URL=http://localhost:54331SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...SUPABASE_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:54332/postgresAPP_URL=http://localhost:5173# OptionalPERF_LOG_LEVEL=offProduction Configuration
For production deployments, use your hosted Supabase project credentials.
Frontend (Production)
VITE_SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.coVITE_SUPABASE_ANON_KEY=your-production-anon-keyVITE_SITE_URL=https://admin.yourdomain.comVITE_OAUTH_PROVIDERS=googleVITE_ENABLE_VERSION_CHECK=trueBackend (Production)
SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.coSUPABASE_ANON_KEY=your-production-anon-keySERVICE_ROLE_KEY=your-production-service-role-keySUPABASE_DATABASE_URL=postgresql://postgres:PASSWORD@db.YOUR_PROJECT_ID.supabase.co:5432/postgresAPP_URL=https://admin.yourdomain.comProtect Service Role Key
The SERVICE_ROLE_KEY bypasses Row Level Security. Never expose it in frontend code or client-side JavaScript. Only use it in the backend API.
Finding Your Supabase Credentials
Project URL and Anon Key
- Go to your Supabase dashboard
- Select your project
- Navigate to Settings > API
- Copy the Project URL and anon public key
Service Role Key
- In Settings > API
- Under Project API keys, reveal and copy the service_role key
Database URL
- Navigate to Settings > Database
- Copy the Connection string (URI format)
- Replace
[YOUR-PASSWORD]with your database password
OAuth Configuration
To enable OAuth providers:
- Configure providers in your Supabase dashboard (Authentication > Providers)
- Add provider names to
VITE_OAUTH_PROVIDERS
Supported providers:
google- Google OAuthgithub- GitHub OAuthazure- Microsoft Azure ADapple- Apple Sign Indiscord- Discord OAuthslack- Slack OAuth
Example:
VITE_OAUTH_PROVIDERS=google,github,azureCaptcha Configuration
To enable Cloudflare Turnstile captcha on login:
- Create a Turnstile widget at Cloudflare Dashboard
- Add your domain to allowed hostnames
- Copy the Site Key to
VITE_CAPTCHA_SITE_KEY
VITE_CAPTCHA_SITE_KEY=0x4AAAAAAAB...Platform-Specific Configuration
Vercel
Set environment variables in your Vercel project settings:
- Go to Settings > Environment Variables
- Add each variable with appropriate scope (Production, Preview, Development)
Railway
Add environment variables in your Railway service:
- Go to Variables tab
- Add variables using the Railway interface or
.envfile reference
Docker
Pass environment variables via docker-compose.yml:
services: api: environment: - SUPABASE_URL=${SUPABASE_URL} - SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY} - SERVICE_ROLE_KEY=${SERVICE_ROLE_KEY} - SUPABASE_DATABASE_URL=${SUPABASE_DATABASE_URL} - APP_URL=${APP_URL}Or use --env-file:
docker run --env-file .env supamode-apiTroubleshooting
"Invalid API Key"
- Verify the anon key matches your Supabase project
- Ensure there are no trailing spaces or newlines in the key
- Check you're using the correct environment (local vs. production)
"Database Connection Failed"
- Verify the
SUPABASE_DATABASE_URLformat - Ensure the password is correct and URL-encoded if it contains special characters
- Check network connectivity to the database
CORS Errors
- Verify
APP_URLmatches your frontend's actual URL - Include the protocol (
http://orhttps://) - For local development, use
http://localhost:5173
OAuth Not Working
- Confirm providers are enabled in Supabase dashboard
- Check
VITE_OAUTH_PROVIDERSmatches the enabled providers exactly - Verify redirect URLs are configured in each OAuth provider