Overview
Cabina uses environment variables for configuration across different services. This guide covers all required and optional variables.Frontend Variables
Supabase Connection
Note: In the current codebase (
src/lib/supabaseClient.ts), Supabase credentials are hardcoded for the production instance. If you’re forking this project for your own use, you’ll need to update those values directly in the source file or refactor to use environment variables.Your Supabase project URL (if using env vars)Example:
https://elesttjfwfhvzdvldytn.supabase.coWhere to find: Supabase Dashboard → Settings → API → Project URLCurrent setup: Hardcoded in src/lib/supabaseClient.ts:3Supabase anonymous/public API key (if using env vars)Example:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Where to find: Supabase Dashboard → Settings → API → anon public keyCurrent setup: Hardcoded in src/lib/supabaseClient.ts:4AI Integration
Google Gemini API key for AI featuresExample:
AIzaSyD...Where to find: Google AI StudioUsed for vision analysis and content generation features
Edge Function Variables
These variables are configured in Supabase Dashboard → Edge Functions → Settings.Supabase Service
Supabase project URL (server-side)Example:
https://elesttjfwfhvzdvldytn.supabase.coAuto-injected: Yes (available by default in Edge Functions)Supabase service role key with elevated permissionsExample:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Where to find: Supabase Dashboard → Settings → API → service_role keyPayment Integration
Mercado Pago access token for payment processingExample:
APP_USR-1234567890123456-123456-abcdef1234567890...Where to find:- Go to Mercado Pago Developers
- Navigate to Your integrations → Credentials
- Copy the Production or Test access token
AI Model Integration
Kie.ai (Banana) API key for image generationExample:
e12c19f419743e747757b4f164d55e87Where to find: Kie.ai Dashboard → API KeysUsed by: cabina-vision edge functionLocal Development Setup
.env.local Template
Create this file in your project root:.env.local
Supabase Edge Functions Secrets
Set secrets using the Supabase CLI:- Go to Edge Functions → Settings
- Click “Add new secret”
- Enter the variable name and value
Vite Build Configuration
Vite injects environment variables at build time. Variables must be prefixed withVITE_ to be exposed to client code.
vite.config.ts
The
GEMINI_API_KEY is aliased as both process.env.API_KEY and process.env.GEMINI_API_KEY for compatibility.Production Deployment
Vercel / Netlify
Add environment variables in your hosting platform:Docker Deployment
Use a.env file or pass variables:
Dockerfile
Security Best Practices
Use different keys per environment
Production, staging, and development should have separate API keys
Rotate keys regularly
Change API keys periodically, especially after team member changes
Monitor usage
Track API usage in Supabase, Mercado Pago, and Kie.ai dashboards
Implement rate limiting
Use Supabase RLS and edge function rate limits
Environment Variable Checklist
-
VITE_SUPABASE_URLconfigured -
VITE_SUPABASE_ANON_KEYconfigured -
GEMINI_API_KEYconfigured -
SUPABASE_SERVICE_ROLE_KEYset in Edge Functions -
MP_ACCESS_TOKENset in Edge Functions -
BANANA_API_KEYset in Edge Functions - All secrets added to
.gitignore - Production values different from development
- Team members have access to secrets vault
Troubleshooting
Environment variables not loading
Environment variables not loading
Vite variables:
- Ensure they start with
VITE_ - Restart dev server after changing
.env.local
- Check they’re set in Supabase Dashboard → Edge Functions → Settings
- Redeploy the edge function after adding secrets
CORS errors with Supabase
CORS errors with Supabase
Check that:
VITE_SUPABASE_URLmatches your actual project URLVITE_SUPABASE_ANON_KEYis the correct public key- Your domain is allowed in Supabase Auth settings
Payment webhook not working
Payment webhook not working
Ensure:
MP_ACCESS_TOKENis set correctly- Edge function is deployed and accessible
- Mercado Pago webhook URL is configured correctly
Next Steps
Deployment Guide
Deploy your configured app to production
Supabase Integration
Learn more about Supabase setup