Overview
Quality Hub GINEZ uses environment variables to configure external integrations and application settings. All sensitive configuration should be stored in a.env.local file that is never committed to version control.
Setup Instructions
- Copy the example environment file:
- Fill in the actual values for each variable
- Restart your development server for changes to take effect
Environment Variables Reference
Google Sheets Integration
These variables configure the CSV data sources for the product catalog.Materia Prima (Raw Materials) CSV URLGoogle Sheets published CSV URL for raw materials catalog. This sheet contains all raw material specifications and documentation links.Format:
https://docs.google.com/spreadsheets/d/e/YOUR_ID/pub?gid=SHEET_ID_MP&single=true&output=csvHow to get this URL:- Open your Google Sheet
- Go to File → Share → Publish to web
- Select the specific sheet/tab for Raw Materials
- Choose “Comma-separated values (.csv)” format
- Click “Publish” and copy the generated URL
Producto Terminado (Finished Products) CSV URLGoogle Sheets published CSV URL for finished products catalog. This sheet contains all finished product specifications and documentation links.Format:
https://docs.google.com/spreadsheets/d/e/YOUR_ID/pub?gid=SHEET_ID_PT&single=true&output=csvHow to get this URL:- Open your Google Sheet
- Go to File → Share → Publish to web
- Select the specific sheet/tab for Finished Products
- Choose “Comma-separated values (.csv)” format
- Click “Publish” and copy the generated URL
The catalog syncs on every page load. For better performance in production, consider implementing caching with periodic revalidation.
Next.js Configuration
Application Base PathOptional base path for the application if deployed to a subdirectory. Leave empty for root deployment.Example: If deploying to Default: Empty string (root path)
https://example.com/quality-hub, set:Supabase Configuration
These variables connect the application to your Supabase project for authentication and database access.Supabase Project URLThe public URL for your Supabase project. This is safe to expose in the browser.Format:
https://your-project-id.supabase.coWhere to find it:- Go to Supabase Dashboard
- Select your project
- Navigate to Settings → API
- Copy the “Project URL” value
Supabase Anonymous KeyThe public anonymous key for browser-side Supabase client initialization. This key is safe to expose as it respects Row Level Security (RLS) policies.Where to find it:
- Go to Supabase Dashboard
- Select your project
- Navigate to Settings → API
- Copy the “anon public” key from the “Project API keys” section
Supabase Service Role Key (Server-side only)Used for server-side operations that require elevated privileges.Where to find it:
- Go to Supabase Dashboard
- Select your project
- Navigate to Settings → API
- Copy the “service_role” key (click to reveal)
Complete Example File
Validation
After configuring your environment variables, verify they’re loaded correctly:- ✅ Successful Supabase client initialization
- ✅ Product catalog loading from Google Sheets
- ✅ Authentication system responding
Troubleshooting
Error: Missing environment variable
Error: Missing environment variable
Solution: Ensure your
.env.local file exists in the project root and contains all required variables. Restart the dev server after making changes.Supabase connection fails
Supabase connection fails
Check:
- URL format is correct (should start with
https://and end with.supabase.co) - Anonymous key is copied completely (usually 200+ characters)
- No extra spaces or quotes in the values
- RLS policies are configured (see Supabase Setup)
Google Sheets data not loading
Google Sheets data not loading
Verify:
- Sheet is published to web (File → Share → Publish to web)
- URL format includes
/pub?andoutput=csv - Sheet permissions allow public access
- CSV structure matches expected format
Changes not taking effect
Changes not taking effect
Try:
- Stop the dev server (Ctrl+C)
- Delete
.nextfolder:rm -rf .next - Restart:
npm run dev
Security Best Practices
Never Commit Secrets
Add
.env.local to .gitignore. Use .env.example for documentation only.Rotate Keys Regularly
Periodically regenerate API keys, especially if exposed or when team members leave.
Use Separate Environments
Maintain separate Supabase projects and Google Sheets for development, staging, and production.
Validate on Startup
Implement runtime validation to ensure all required variables are present before app initialization.
Next Steps
Supabase Setup
Configure your Supabase database tables and Row Level Security policies
Google Sheets Integration
Set up your product catalog spreadsheets for the application
