Getting Started
Environment Setup
Configure your development environment for CONA
Environment Setup
This guide details all the environment variables needed to run CONA and how to configure them for both the webapp and temporal workers.
Quick Start
- Copy the example environment files from both apps:
- Fill in the required variables in both
.env.local
files
Application Architecture
CONA consists of two main applications that require environment configuration:
- Webapp (
apps/webapp
): Next.js application handling web UI, API routes, and integrations - Temporal Workers (
apps/temporal-workers
): Background workers processing workflows and long-running tasks
Both applications share some common environment variables but have specific requirements.
Webapp Environment Variables
Database Configuration
What these do:
DATABASE_URL
: Main database connection using pgBouncer for connection pooling - optimized for high-throughput applicationsDIRECT_URL
: Direct database connection for migrations, schema changes, and operations requiring transaction isolation
Supabase Configuration
What these do:
NEXT_PUBLIC_SUPABASE_URL
: Your Supabase project URL for database and auth servicesNEXT_PUBLIC_SUPABASE_ANON_KEY
: Public anonymous key for client-side Supabase operations (safe to expose)
Security & Encryption
What this does:
- Encrypts sensitive data like API keys, tokens, and PII before storing in database
- Generate using:
openssl rand -base64 32
- Must be the same across webapp and temporal-workers
Auth0 Configuration
What these do:
AUTH0_DOMAIN
: Your Auth0 tenant domain for user authenticationAUTH0_CLIENT_ID/SECRET
: Application credentials for Auth0 SDKAUTH0_SECRET
: Random string for encrypting session cookiesAUTH0_API_BASE_URL
: Management API endpoint for user management operationsAUTH0_WEBHOOK_SECRET
: Validates webhook payloads from Auth0AUTH0_M2M_CLIENT_ID/SECRET
: Machine-to-machine credentials for server-side Auth0 operations
Application URLs
What these do:
APP_BASE_URL
: Server-side base URL for redirects and API callsNEXT_PUBLIC_APP_URL
: Client-side accessible URL for frontend operations
Development & Debugging
What this does:
- Password-protects development routes and debugging tools in non-production environments
Integration APIs
Shopify Integration
What these do:
- OAuth credentials for Shopify app integration
- Allows connecting to Shopify stores and accessing store data
- Obtained from Shopify Partners dashboard
PayPal Integration
What these do:
- OAuth credentials for PayPal integration
PAYPAL_API_BASE_URL
: API endpoint (sandbox for testing, live for production)PAYPAL_AUTH_URL
: OAuth authorization endpoint- Enables PayPal transaction import and reconciliation
Amazon SP-API Integration
What these do:
- OAuth credentials for Amazon Selling Partner API
- Enables Amazon marketplace data import and order processing
- Obtained from Amazon Developer Console
Analytics & Monitoring
What these do:
- PostHog analytics for user behavior tracking and feature analytics
NEXT_PUBLIC_POSTHOG_HOST
: PostHog instance URL (EU for GDPR compliance)
File Upload
What this does:
- Enables file upload functionality for documents and attachments
- Handles secure file storage and CDN delivery
Error Tracking
What this does:
- Sentry integration for error tracking and performance monitoring
- Automatically captures and reports application errors
Temporal Workers Environment Variables
Temporal Configuration
What these do:
TEMPORAL_ADDRESS
: Temporal server connection string (localhost for dev, cloud URL for production)TEMPORAL_NAMESPACE
: Isolated workflow environment (use different namespaces for dev/staging/prod)TEMPORAL_API_KEY
: Required for Temporal Cloud (leave empty for local development)
Security & Encryption
What this does:
- Must match the webapp encryption key exactly
- Used to decrypt sensitive data stored by the webapp
- Critical for workflow activities that handle encrypted data
Environment Setup by Environment
Local Development
Security Best Practices
- Never commit
.env
files to version control - Use different credentials for each environment
- Rotate secrets regularly (especially encryption keys and API keys)
- Limit access to production credentials to essential personnel only
- Use environment-specific namespaces for Temporal workflows
- Validate all environment variables on application startup
- Use secure methods to share credentials with team members (password managers, secure vaults)
Environment Variable Validation
Both applications validate required environment variables on startup. Missing or invalid variables will cause startup failures with helpful error messages.