Overview
Kuest Prediction Market uses environment variables to configure various aspects of the application, including authentication, database connections, storage, and third-party integrations. Copy.env.example to .env and configure the variables according to your deployment needs.
Required Variables
These variables must be set for the application to function properly.Kuest CLOB Authentication
Your Kuest CLOB wallet address (EVM address, 0x… format on Polygon). Get your credentials by connecting your wallet at https://auth.kuest.com.
API key for Kuest CLOB authentication. Obtain from https://auth.kuest.com after connecting your wallet.
API secret for Kuest CLOB authentication. Keep this value secure and never commit it to version control.
Passphrase for Kuest CLOB authentication. Required for signing API requests.
Admin Configuration
Comma-separated list of EVM wallet addresses (0x… format on Polygon) that have admin privileges. Admin users can access special features and management interfaces.You can also use JSON array format:
Wallet Connection
Your Reown AppKit project ID for Web3 wallet connections. Create a project at https://dashboard.reown.com.
Authentication Secret
Random 32-character secret for Better Auth session encryption. Generate one at https://www.better-auth.com/docs/installation#set-environment-variables.
Cron Jobs
Random secret (at least 16 characters) for authenticating Vercel Cron Jobs or database scheduler endpoints. This protects your sync endpoints from unauthorized access.
Optional Variables
These variables are optional but may be required depending on your deployment setup.Performance Optimization
Enable Next.js image optimization. This can increase hosting costs on platforms like Vercel.
Database Configuration
PostgreSQL connection string for runtime database access. Required outside Vercel/Supabase integration flow.
When using Vercel’s PostgreSQL integration, this is automatically populated. For self-hosted deployments, you must set this manually.
Storage Configuration
Supabase Storage (Option 1)
Supabase Storage (Option 1)
S3-Compatible Storage (Option 2)
S3-Compatible Storage (Option 2)
Use S3 or S3-compatible storage (MinIO, R2, etc.) for file uploads. Required when
SUPABASE_* variables are not configured.Name of your S3 bucket for storing assets.
S3 endpoint URL. Leave empty for AWS S3, or set for S3-compatible services.
AWS region for your S3 bucket. Defaults to
us-east-1 if not specified. Can also be set via AWS_REGION.S3 access key ID. Can also be set via
AWS_ACCESS_KEY_ID.S3 secret access key. Can also be set via
AWS_SECRET_ACCESS_KEY.Custom public URL for accessing S3 assets. If not set, URLs are automatically generated based on the bucket and endpoint configuration.
Use path-style URLs instead of virtual-hosted-style. Automatically defaults to
true when S3_ENDPOINT is set.Monitoring and Error Tracking
Sentry Configuration
Sentry Configuration
Optional Sentry integration for error tracking and performance monitoring. Visit https://sentry.io/ to create a project.
Sentry Data Source Name for error reporting.
Your Sentry organization slug.
Your Sentry project slug.
Sentry authentication token for source map uploads during build.
Environment File Example
Here’s a complete example of a.env file:
.env
Validation
The application validates environment variables at startup:- Missing required variables will cause the application to fail with clear error messages
- Partial storage configuration (e.g., only setting
S3_BUCKETwithout credentials) will throw an error - If both
SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEYare provided, S3 configuration is ignored
Security Best Practices
- Rotate secrets regularly: Change
BETTER_AUTH_SECRETand API keys periodically - Use environment-specific values: Different secrets for development, staging, and production
- Restrict admin access: Only add trusted wallet addresses to
ADMIN_WALLETS - Protect API endpoints: Keep
CRON_SECRETsecure to prevent unauthorized sync operations - Service role keys: Never expose
SUPABASE_SERVICE_ROLE_KEYin client-side code
Next Steps
Database Setup
Configure PostgreSQL and run migrations
Storage Configuration
Set up Supabase Storage or S3 for assets
Authentication
Configure Better Auth and wallet connections
Deployment
Deploy your prediction market