VITE_ to be accessible in the client-side application.
Required variables
These environment variables are required for the application to function:VITE_SUPABASE_URL
The URL of your Supabase project.
- Go to your Supabase Dashboard
- Select your project
- Navigate to Settings > API
- Copy the “Project URL” value
VITE_SUPABASE_ANON_KEY
The anonymous (public) API key for your Supabase project.
- Go to your Supabase Dashboard
- Select your project
- Navigate to Settings > API
- Copy the “anon public” key under “Project API keys”
Optional variables
These environment variables have default values and are optional:VITE_MAX_FILE_SIZE_MB
Maximum file upload size in megabytes.
10 (MB)
Example:
src/components/FileUpload.tsx:48 and src/FileUpload.tsx:46
If not set, the application will use the default value of 10MB and log a warning in the console.
VITE_BUCKET_NAME
The name of the Supabase Storage bucket for file uploads.
00000000-default-bucket
Example:
src/components/FileUpload.tsx:49 and src/FileUpload.tsx:47
Ensure the bucket exists in your Supabase project (Dashboard > Storage) and has appropriate RLS policies configured.
VITE_APP_VERSION
Application version string sent in API headers.
x-application-name header with Supabase requests. Useful for tracking which version of the app is making requests.
Default: dev
Example:
src/supabase.ts:75 and src/lib/supabase.ts:75
VITE_SUPABASE_DETECT_SESSION_IN_URL
Enable OAuth session detection from URL parameters.
false (disabled for better performance)
Example:
src/supabase.ts:78 and src/lib/supabase.ts:78
This is disabled by default to improve performance. Only enable if you’re using OAuth authentication providers.
VITE_OPENAI_API_KEY
OpenAI API key for AI-powered features.
src/services/openaiService.ts:13
Setting environment variables
How you set environment variables depends on your deployment platform:Local development
Create a.env file in the root of your project:
Never commit your
.env file to version control. Add it to .gitignore.Netlify
- Go to Site Settings > Build & Deploy > Environment
- Click “Add a variable”
- Add each environment variable and its value
- Deploy or re-deploy your site
Vercel
- Go to Project Settings > Environment Variables
- Add each environment variable
- Select which environments to apply to (Production, Preview, Development)
- Save and re-deploy
Docker
Pass environment variables when running the container:Build-time validation
The Vite configuration (vite.config.ts:5-27) validates environment variables at build time:
Security considerations
Safe to expose:VITE_SUPABASE_URL- Public URLVITE_SUPABASE_ANON_KEY- Public anon key (respects RLS)- Other
VITE_prefixed configuration values
- Service role keys
- Database passwords
- Private API keys (unless proxied through a backend)
- Secrets or tokens
Next steps
Deploy to Netlify
Configure environment variables in Netlify
Deploy to Vercel
Configure environment variables in Vercel
Docker Deployment
Pass environment variables to Docker containers
Deployment Overview
Back to deployment overview