Environment Configuration
Fataplus requires several environment variables for proper operation across different services and integrations.Configuration Overview
Environment variables are managed differently depending on the deployment target:- Local Development:
.env.localfile - Cloudflare Workers:
wrangler.toml[vars]section - Cloudflare Pages: Dashboard environment variables
Core Configuration
Cloudflare Settings
Required for deploying to Cloudflare infrastructure:Get your API key
- Go to Cloudflare Dashboard
- Navigate to My Profile > API Tokens
- Create a token with:
- Workers Routes: Edit
- Workers Scripts: Edit
- D1: Edit
- Pages: Edit
Find your Account ID
- Go to Cloudflare Dashboard
- Select any domain
- Scroll down to API section on the right sidebar
- Copy the Account ID
Current production account ID:
f30dd0d409679ae65e841302cc0caa8cDatabase Configuration
Integration Configuration
Figma API Integration
For design system synchronization:Create Figma App
- Go to Figma Developers
- Click Create an app
- Give it a name: “Fataplus Integration”
Claude AI Integration
For AI-powered features:OAuth Configuration
For authentication and authorization:Environment-Specific Variables
Development Environment
For local development (wrangler.toml):
Production Environment
For production deployment:Complete Configuration Example
Setting Environment Variables
Local Development
Cloudflare Workers
For Workers, use the[vars] section in wrangler.toml:
Cloudflare Secrets (Recommended for Sensitive Data)
For sensitive values like API keys:Cloudflare Pages Environment Variables
Navigate to your Pages project
Go to Cloudflare Dashboard > Workers & Pages
Verification
Check Local Configuration
Check Worker Configuration
Security Best Practices
- Never commit sensitive data to version control
- Use Cloudflare Secrets for API keys and tokens
- Rotate credentials regularly (every 90 days recommended)
- Use environment-specific values (different keys for dev/prod)
- Limit API token permissions to only what’s needed
- Monitor API usage for unusual activity
Files to Exclude from Git
Ensure your.gitignore includes:
Required vs Optional Variables
Required for Basic Deployment
CLOUDFLARE_ACCOUNT_IDDATABASE_ID
Required for Full Functionality
CLOUDFLARE_API_KEY(for deployments)FIGMA_ACCESS_TOKEN(for design sync)CLAUDE_API_KEY(for AI features)
Optional
OAUTH_CLIENT_ID/OAUTH_CLIENT_SECRET(if using OAuth)- R2 bucket bindings (if using media storage)
Troubleshooting
Variables not loading
- Check file name is exactly
.env.local - Restart development server
- Verify no syntax errors in
.env.local
Secrets not working in Worker
- Verify secret is set:
wrangler secret list - Redeploy worker:
wrangler deploy - Check secret name matches code exactly (case-sensitive)
Production variables not applied
- Verify
[env.production]section inwrangler.toml - Deploy with environment flag:
wrangler deploy --env production - Check Cloudflare Dashboard for environment variables
Next Steps
- Configure custom domains
- Deploy to Cloudflare
- Explore the API reference