Environment Variable Management
Overview
This project intentionally tracks the.env file in git, which differs from standard best practices. This document explains the rationale and security considerations.
Why .env is Tracked
Rationale
- Vibecode Development Environment: This project is developed within the Vibecode Incorporated development system
- Controlled Access: Repository access is limited to authorized team members
- Development Keys Only: The tracked .env contains development/staging credentials, not production secrets
- Simplified Onboarding: New developers get working environment immediately after clone
- Consistency: Ensures all developers use the same environment configuration
Security Considerations
What’s Safe:- ✅ Supabase publishable key (protected by RLS policies)
- ✅ Development API keys with usage limits
- ✅ Non-sensitive configuration values
- ❌ Production database credentials (stored in EAS Secrets)
- ❌ Production API keys (stored in Supabase Secrets)
- ❌ Service role keys (never committed)
Cursor Cloud Agent Secrets
For AI Agents and Cloud Development: When using Cursor Cloud Agents (background agents), secrets should be managed via Cursor’s built-in secret management rather than local.env files.
Why Use Cursor Secrets?
- ✅ Persistent across sessions - Secrets survive agent restarts
- ✅ Secure storage - Managed by Cursor, encrypted at rest
- ✅ Automatic injection - Available as environment variables automatically
- ✅ Works with MCP servers - Shared with Model Context Protocol integrations
- ✅ No local file management - No need to manage
~/.sentryclircmanually
Setting Up Cloud Agent Secrets
-
Open Cursor Settings:
- Cursor → Settings (or
Cmd+,on Mac) - Navigate to: Cloud Agents → Secrets
- Cursor → Settings (or
-
Add Required Secrets:
MCP Server Secrets (Required for AI Agents):
SENTRY_AUTH_TOKEN- Sentry User Auth Token (for CLI and MCP)GITHUB_PERSONAL_ACCESS_TOKEN- GitHub Personal Access TokenINTERCOM_ACCESS_TOKEN- Intercom API Access TokenSUPABASE_ACCESS_TOKEN- Supabase Account Access TokenSUPABASE_PROJECT_REF- Supabase Project Reference ID
.envinstead):EXPO_PUBLIC_SUPABASE_URL- Supabase project URLEXPO_PUBLIC_SUPABASE_KEY- Supabase publishable key
-
Restart Cursor:
- Restart Cursor or start a new Cloud Agent session
- Secrets are automatically injected as environment variables
How Secrets Are Used
Setup Workflow (/setup):
- Automatically detects secrets from Cursor Cloud Agent Secrets
- Configures CLI tools automatically (
~/.sentryclirc,gh auth, etc.) - No manual intervention needed
.cursor/mcp.jsonreferences secrets via${SECRET_NAME}placeholders- Cursor resolves placeholders from Cloud Agent Secrets
- All 5 MCP servers (Vercel, Sentry, GitHub, Intercom, Supabase) use shared secrets
sentry-clireads from~/.sentryclirc(auto-configured fromSENTRY_AUTH_TOKEN)ghCLI uses GitHub token (can useGITHUB_PERSONAL_ACCESS_TOKENor existinggh auth)supabaseCLI uses Supabase token (fromSUPABASE_ACCESS_TOKEN)
When to Use Cloud Agent Secrets vs .env
| Use Case | Method | Reason |
|---|---|---|
| Cloud Agents | Cursor Secrets | Persists across sessions, works with MCP |
| Local Development | .env file | Traditional workflow, git-tracked for team |
| CI/CD Pipeline | GitHub Secrets | Standard CI/CD secret management |
| Production Builds | EAS Secrets | Expo-specific secret management |
Best Practices
DO:- ✅ Use Cursor Secrets for Cloud Agent development
- ✅ Use
.envfor local development (human developers) - ✅ Keep secrets synchronized (same values in both places)
- ✅ Document which secrets are needed in setup docs
- ❌ Store production secrets in Cursor Secrets (use EAS Secrets)
- ❌ Commit sensitive tokens to
.env(use.env.localfor personal overrides) - ❌ Mix Cloud Agent Secrets with local
.envunnecessarily
.cursor/README.md for more details on Cursor configuration.
Production Deployment
CRITICAL: Production deployments do NOT use the committed.env file.
Production secrets are managed through:
- EAS Secrets - For Expo application secrets
- Supabase Secrets - For Edge Function secrets (OpenAI API key, etc.)
- GitHub Secrets - For CI/CD pipeline
- Cursor Cloud Agent Secrets - For Cloud Agent development (not used in production builds)
For New Developers
If you need different local credentials:- Create
.env.local(git-ignored) with your overrides - Values in
.env.localtake precedence over.env - See
.env.examplefor all available variables
Best Practices
DO:- ✅ Use
.envfor shared development configuration - ✅ Use
.env.localfor personal overrides - ✅ Use Cursor Cloud Agent Secrets for Cloud Agent development
- ✅ Use EAS Secrets for production deployments
- ✅ Rotate keys if they’re exposed publicly
- ✅ Keep Cloud Agent Secrets and
.envsynchronized
- ❌ Commit production credentials to
.env - ❌ Commit service role keys
- ❌ Share
.envoutside the team - ❌ Use
EXPO_PUBLIC_*for sensitive secrets - ❌ Store production secrets in Cursor Cloud Agent Secrets
Security Model
This approach works because:- Development keys have limited scope - Can only access development/staging environments
- RLS policies protect data - Even with the publishable key, users can only access their own data
- Production uses different secrets - Deployed apps never use the committed .env
- Repository is private - Only authorized team members have access