Overview
NeuraTrade uses environment variables for system configuration. Copy.env.example to .env in your repository root and configure the values for your deployment.
Quick Start
Core Configuration
NeuraTrade Home Directory
Absolute path to NeuraTrade config and data directory. This is where SQLite DB, Redis data, and logs will be stored.Note: Use an absolute path. Shell shortcuts like
~ are not expanded by all launch scripts.Network Configuration
Single port exposed to host for backend API (use 5-digit port to avoid conflicts). Access NeuraTrade at
http://localhost:{port}.Internal server port for the backend API service.
Server bind address. Use
0.0.0.0 to accept connections from all interfaces.Application environment mode.Options:
development, production, testDatabase Configuration
SQLite (Default)
Database driver selection.Options:
sqlite, postgresAbsolute path to SQLite database file. Should match your
NEURATRADE_HOME setting.PostgreSQL (Production)
PostgreSQL server hostname.
PostgreSQL server port.
PostgreSQL username.
PostgreSQL password.
PostgreSQL database name.
PostgreSQL SSL mode.Options:
disable, require, verify-ca, verify-fullComplete PostgreSQL connection string (preferred for managed databases like Digital Ocean).Format:
postgres://username:password@host:port/dbname?sslmode=requireWhen set, this overrides individual database settings.
Connection Pool Settings
Maximum number of open database connections (PostgreSQL only).
Maximum number of idle database connections in the pool.
Maximum lifetime of a database connection.
Maximum time a connection can remain idle.
Redis Configuration
Redis server hostname.
Redis server port.
Redis authentication password (optional).
Redis database number (0-15).
CCXT Service Configuration
URL for the CCXT exchange integration service.
Timeout for CCXT service requests.
Port for the CCXT service (used by ccxt-service component).
Telegram Configuration
Telegram bot token from @BotFather.Get your token: https://t.me/BotFather
Public URL for webhook mode (production).
Secret to validate incoming webhook requests.Generate with:
openssl rand -base64 32Use polling mode (development) vs webhook mode (production).
Path for the webhook endpoint.
Port for the Telegram service.
URL of the backend-api service for Telegram to call.
Enable/disable the Telegram service.
Use external TypeScript Telegram service (disables legacy Go-based bot).
Security Configuration
Secret key for JWT token signing (minimum 32 characters).Generate with:
openssl rand -base64 32BCrypt hashing cost factor (higher = more secure but slower).Range: 4-31 (recommended: 10-14)
API key for securing admin endpoints.Generate with:
openssl rand -base64 32External API Keys
CoinMarketCap API key for market data (optional).
Logging Configuration
Logging verbosity level.Options:
debug, info, warn, errorLog output format.Options:
json, textFeature Flags
Enable Telegram bot integration.
Enable web interface.
Enable real trading (disable for paper trading only).
Enable paper trading simulation.
Monitoring Configuration
Enable Prometheus metrics collection.
Port for exposing Prometheus metrics.
Market Data Configuration
Interval for collecting market data from exchanges.
Number of symbols to process in each batch.
Arbitrage Configuration
Minimum profit threshold percentage for arbitrage opportunities.
Maximum trade amount for arbitrage in quote currency.
Interval for checking arbitrage opportunities.
Technical Analysis Configuration
Interval for calculating technical indicators.
Test Environment (Development Only)
JWT secret for testing (development only).
Database password for testing (development only).
Environment Variable Precedence
- Explicitly set environment variables
.envfile in repository root- Default values from
.env.example - Application defaults
Security Best Practices
- Generate Strong Secrets: Use
openssl rand -base64 32for all secrets - Never Commit Secrets: Add
.envto.gitignore - Use Environment-Specific Configs: Separate
.envfiles for dev/staging/prod - Rotate Credentials: Regularly update API keys and secrets
- Limit Permissions: Use read-only database users where possible
- Enable SSL/TLS: Use secure connections for databases and external services
- Monitor Access: Enable audit logging for admin operations
Example Production Configuration
.env