Overview
ActumX uses environment variables for configuration. The API and Dashboard have separate environment files.API Environment Variables
Environment variables for the API are stored inapi/.env.
Server Configuration
The port number the API server listens on.
The Node.js environment. Set to
production in production deployments.Database Configuration
PostgreSQL connection string. Must include username, password, host, port, and database name.Development:Production:
Authentication Configuration
The base URL where the API is accessible. Used by Better Auth for generating callback URLs and verification links.Development:Production:
Secret key for signing authentication tokens. Must be at least 32 characters long.Development:Production:
Generate a secure random string:
The URL of the Dashboard application. Used for CORS configuration to allow cross-origin requests.Development:Production:
Solana Configuration
API .env.example
Complete example fromapi/.env.example:
Dashboard Environment Variables
Environment variables for the Dashboard are stored indashboard/.env.local.
Next.js requires variables prefixed with
NEXT_PUBLIC_ to be accessible in the browser. Variables without this prefix are only available server-side.API Configuration
The base URL of the ActumX API. Used by the Dashboard to make API requests.Development:Production:
Dashboard .env.example
Complete example fromdashboard/.env.example:
Environment Setup by Deployment Type
Local Development
API (.env):Staging Environment
API:Production Environment
API:Docker Environment Variables
When using Docker, pass environment variables via:Docker Run
Docker Compose
Environment File
Create a.env file and use with Docker Compose:
Security Best Practices
Never Commit Secrets
Add environment files to.gitignore:
Use Different Secrets Per Environment
Generate unique secrets for development, staging, and production:Rotate Secrets Regularly
ChangeBETTER_AUTH_SECRET periodically and redeploy:
- Generate new secret
- Update environment variable
- Redeploy API
- Users will need to re-authenticate
Use Secret Management
For production, consider using:- AWS Secrets Manager
- HashiCorp Vault
- Doppler
- 1Password Secrets Automation
Validate Required Variables
The API uses Zod for environment validation (seeapi/src/config/env.ts). Missing or invalid variables will cause startup failures with clear error messages.
Troubleshooting
Variables Not Loading
API:- Verify file is named
.env(not.env.txt) - Ensure it’s in the
api/directory - Restart the server after changes
- Verify file is named
.env.local - Ensure it’s in the
dashboard/directory - Restart Next.js dev server
- Rebuild for production:
pnpm build
Connection Refused
If services can’t connect:- Check URLs match actual service locations
- Verify ports aren’t blocked by firewalls
- Use correct protocol (http vs https)
- Ensure services are running
CORS Errors
If Dashboard can’t reach API:- Verify
DASHBOARD_ORIGINin API matches Dashboard URL exactly - Include protocol and port (if non-standard)
- Don’t include trailing slash
Authentication Failures
If auth doesn’t work:- Verify
BETTER_AUTH_SECRETis at least 32 characters - Ensure
BETTER_AUTH_URLmatches where API is accessible - Check
DASHBOARD_ORIGINallows your Dashboard domain - Confirm same secret is used across all API instances
Database Connection Errors
If can’t connect to database:- Verify
DATABASE_URLformat: - Test connection manually:
- Check firewall rules allow connection
- For SSL, add
?sslmode=requireto URL
Solana RPC Issues
If Solana integration fails:- Verify
SOLANA_RPC_URLis accessible: - Try alternative RPC endpoint
- Check for rate limiting
- Consider using a paid RPC provider
Reference
Required vs Optional Variables
API Required:DATABASE_URLBETTER_AUTH_URLBETTER_AUTH_SECRETDASHBOARD_ORIGINSOLANA_RPC_URL
PORT(defaults to 3001)NODE_ENV(defaults to development)
NEXT_PUBLIC_API_BASE_URL
Default Values
| Variable | Default | Override |
|---|---|---|
PORT | 3001 | Yes |
NODE_ENV | development | Yes |
| All others | None | Required |