Overview
Money Tracker requires environment variables in two locations:packages/frontend/.env- Frontend application configurationsupabase/functions/.env- Edge Functions configuration
Frontend variables
Location:packages/frontend/.env
The Supabase project URL.
- Local:
http://127.0.0.1:54321 - Production:
https://your-project-ref.supabase.co
The Supabase anonymous (public) API key. This key is safe to use in browser code.
- Local: Displayed in terminal after running
supabase start - Production: Found in Supabase Dashboard under Settings > API
The port where the frontend development server runs.
Optional xAI API key for running E2E tests that involve AI extraction.
Example frontend .env
Edge Functions variables
Location:supabase/functions/.env
Supabase configuration
The Supabase project URL. Must match the frontend value.
- Local:
http://127.0.0.1:54321 - Production:
https://your-project-ref.supabase.co
The Supabase anonymous API key.
The Supabase service role key with elevated privileges. Bypass RLS policies and manage users.
The URL of your frontend application for OAuth redirects.
- Local:
http://localhost:3000 - Production:
https://your-domain.com
Google OAuth configuration
OAuth 2.0 client ID from Google Cloud Console. Required for Gmail integration.
OAuth 2.0 client secret from Google Cloud Console.
The OAuth callback URL. Must match the authorized redirect URI in Google Cloud Console.
- Local:
http://localhost:3000/auth/callback - Production:
https://your-domain.com/auth/callback
Your Google Cloud project ID. Required for Pub/Sub integration.
The Google Cloud Pub/Sub topic name for Gmail push notifications.Example:
gmail-notificationsAI configuration
API key for xAI Grok model. Used for extracting transaction data from emails and documents.Get your key from x.ai.
Langfuse configuration
Langfuse provides observability for AI operations.Langfuse secret key for authentication.
Langfuse public key for authentication.
Langfuse API base URL. Use default for cloud hosting or your self-hosted URL.
CORS configuration
Comma-separated list of allowed origins for CORS.Example:
http://localhost:3000,http://127.0.0.1:3000Whether to allow credentials in CORS requests.
Internal authentication
Internal secret token for edge function authentication. Used by the
renew-watches cron job.- Local:
local-dev-internal-secret(matches seed data) - Production: Generate a secure random string
Optional runtime environment identifier for logging and debugging.
Example Edge Functions .env
Production deployment
For production deployments, set Edge Functions secrets using the Supabase CLI or Dashboard.Using the CLI
Using the Dashboard
- Navigate to your project in the Supabase Dashboard
- Go to Settings > Edge Functions
- Click “Add secret”
- Enter each key-value pair
After setting secrets, you must redeploy your Edge Functions for the new values to take effect.
Security best practices
- Add
.envto your.gitignorefile - Use different values for local and production environments
- Rotate secrets regularly, especially after team member departures
- Use environment-specific service accounts for Google Cloud integration
- Monitor API usage for unusual patterns
- Enable Google Cloud audit logging for OAuth and Pub/Sub access