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.Setup procedure
Follow the canonical local development setup in the root README to copy the workspace templates and prepare the database. This page describes the environment variables; the README owns the setup commands. The database workspace usespackages/database/.env.example, copied to packages/database/.env. Set ADMIN_DIRECT_URL for Prisma schema commands and ADMIN_DATABASE_URL for seeding to your local database. See the database README for database-specific operations.
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
Webapp Environment Variables
Database Configuration
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
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
- 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
AUTH0_DOMAIN: User-facing custom domain for login/signup flows (the branded URL users see, e.g.auth.cona.app)AUTH0_TENANT_DOMAIN: Canonical tenant domain used only for the Management API v2 (e.g.your-tenant.eu.auth0.com). The Management API is not served on custom domains, so this must be the raw tenant host. If unset, the Management client falls back to parsing the hostname out ofAUTH0_API_BASE_URL.AUTH0_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_M2M_CLIENT_ID/SECRET: Machine-to-machine credentials for server-side Auth0 operations
Application URLs
APP_BASE_URL: Server-side base URL for redirects and API callsNEXT_PUBLIC_APP_URL: Client-side accessible URL for frontend operations
Development & Debugging
- Password-protects development routes and debugging tools in non-production environments
Vercel Environment Detection (Staging/Preview)
NEXT_PUBLIC_VERCEL_ENV: The deployment environment (development,preview, orproduction)NEXT_PUBLIC_VERCEL_TARGET_ENV: The custom environment name (e.g.,staging) when using Vercel custom environments
NEXT_PUBLIC_ prefix to access environment variables in the browser. The getEnvironmentInfo() utility uses these variables to detect the current environment on both server and client.
Integration APIs
Shopify Integration
- OAuth credentials for Shopify app integration
- Allows connecting to Shopify stores and accessing store data
- Obtained from Shopify Partners dashboard
PayPal Integration
- 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
- OAuth credentials for Amazon Selling Partner API
- Enables Amazon marketplace data import and order processing
- Obtained from Amazon Developer Console
Analytics & Monitoring
- PostHog analytics for user behavior tracking and feature analytics
NEXT_PUBLIC_POSTHOG_HOST: PostHog instance URL (EU for GDPR compliance)
File Storage (Supabase)
- Enables private file storage for logos, CSV imports, and GoBD-compliant documents
- Supabase secret key (prefer
sb_secret_...) allows server-side uploads and signed URL generation - Uses the same Supabase project as the database
Error Tracking
- Sentry integration for error tracking and performance monitoring
- Automatically captures and reports application errors
Temporal Workers Environment Variables
Temporal Configuration
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
- Must match the webapp encryption key exactly
- Used to decrypt sensitive data stored by the webapp
- Critical for workflow activities that handle encrypted data
File Storage (Supabase)
- Must match the webapp Supabase secret key exactly
- Required for Temporal activities that upload DATEV ZIPs, Sammelbeleg PDFs, and delete CSV batch files
- Without this, file cleanup and document storage workflows will fail
Environment Setup by Environment
Local Development
Security Best Practices
- Never commit
.envfiles 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)