Overview
Duckling uses environment variables for configuration, loaded from a.env file. Copy .env.example to .env and customize for your deployment.
Server Configuration
Environment mode
development- Enable debugging, hot reloadproduction- Optimized for performance
HTTP server portPort for the Express.js server (API + frontend).
Base data directoryRoot path for all data storage (databases, backups, metadata).
- Docker:
/app/data(volume mounted from./data) - Development:
./data(relative to project root)
Database Configuration
DuckDB database file pathPath to the default DuckDB database file. With multi-database support, individual databases are configured in
databases.json.DuckDB connection pool sizeMaximum concurrent connections to DuckDB per database.
MySQL source database connection stringConnection string for the source MySQL database to replicate.
With multi-database support, each database has its own connection string configured via the
/api/databases endpoint. This variable is used for the default database only.MySQL connection pool sizeMaximum concurrent connections to MySQL per database.
Sync Configuration
Automatic sync frequencyMinutes between automatic incremental sync runs.
Set to
0 to disable automatic sync (manual triggers only).Records per batch during syncNumber of records to fetch from MySQL in each batch.
Larger batches are faster but use more memory. 1000-5000 is optimal for most cases.
Insert batch sizeNumber of records to insert per SQL statement during incremental sync.
Appender flush interval (ms)Milliseconds between automatic flushes of the DuckDB Appender during full sync.
Retry attempts for failed operationsNumber of times to retry failed sync operations before giving up.
Base delay for exponential backoff (ms)Initial delay in milliseconds before first retry. Doubles on each attempt.
Maximum retry delay (ms)Cap for exponential backoff delay.
Enable incremental syncUse watermark-based incremental sync instead of full sync on every run.
Comma-separated list of tables to excludeTables to skip during sync (e.g., temp tables, large logs).
Leave empty to sync all tables.
Automation Configuration
Auto-start sync on bootAutomatically start sync service when the server starts.
Enable automatic cleanup tasksRun periodic cleanup tasks (DuckDB VACUUM, WAL cleanup).
Hours between cleanup runsFrequency of automatic cleanup tasks.
Retention period for cleanup (days)Number of days to retain old data before cleanup.
Enable automatic backupsCreate local backups on a schedule.
Hours between backupsFrequency of automatic backup creation.
Days to retain backupsNumber of days to keep backups before automatic deletion.
Enable auto-restart on failuresAutomatically reconnect to databases on connection failures.
Maximum recovery attemptsNumber of times to attempt recovery before giving up.
Backup storage directoryDirectory to store local backup files.
Monitoring Configuration
Enable health check monitoringRun periodic health checks on database connections.
Health check interval (ms)Milliseconds between health check runs.
Logging verbosityWinston log level for application logging.
error- Errors onlywarn- Warnings and errorsinfo- General informationdebug- Detailed debugging
Security & Authentication
Admin dashboard usernameUsername for web dashboard login.
Admin dashboard passwordPassword for web dashboard login.
API key for programmatic accessBearer token for API authentication.Generate a secure key:Usage:
Session encryption secretSecret key for encrypting session cookies.Generate:
JWT signing secretSecret key for signing JWT tokens. Falls back to
SESSION_SECRET if not set.JWT expiration timeToken lifetime (e.g.,
1h, 7d, 30m).Rate Limiting
Enable rate limitingProtect API endpoints from abuse.
Rate limit mode
enforce- Block requests exceeding limitsshadow- Log violations but allow requests
Use session-based rate limitingLimit per session instead of per IP address.
Include database in rate limit scopeSeparate rate limits per database.
Read endpoint limit (requests/minute)Max requests per minute for read operations (GET /tables, /status, etc.).
Query endpoint limit (requests/minute)Max requests per minute for query operations (POST /query).
Cost per query requestWeight of a query request for rate limiting.
Cost per write requestWeight of a write request (sync, backup) for rate limiting.
Max concurrent queries (JWT auth)Maximum parallel query executions for JWT-authenticated users.
Max concurrent queries (API key auth)Maximum parallel query executions for API key authentication.
Query in-flight TTL (ms)Time to keep in-flight query tracking (5 minutes default).
CDC (Change Data Capture)
Enable CDC modeUse MySQL binary log replication for real-time sync.
CDC is opt-in. Requires MySQL binary logging to be enabled.
Auto-start CDC on bootAutomatically start CDC service when server starts.
CDC reconnection attemptsNumber of times to retry connecting to MySQL binlog.
CDC reconnect delay (ms)Milliseconds between reconnection attempts.
Verify SSL certificates for CDCReject connections with invalid SSL certificates.
CDC event queue sizeMaximum number of CDC events to buffer before applying backpressure.
MySQL Protocol Server
Enable MySQL wire protocolAccept connections from MySQL clients.
MySQL protocol portPort for MySQL wire protocol server.Connect:
Default database for MySQL connectionsDatabase to use when no database is specified in the connection.
Max MySQL protocol connectionsMaximum concurrent MySQL client connections.
MySQL protocol usernameUsername for MySQL client connections.
MySQL protocol passwordPassword for MySQL client connections. Falls back to
DUCKLING_API_KEY.Query Governor
Max concurrent queriesMaximum number of queries executing simultaneously.
Query timeout (ms)Maximum execution time for a single query.
Query queue sizeMaximum number of queries to queue when at max concurrency.
Worker Threads
Number of worker threadsWorker threads for parallel query execution.
0 = auto (CPU cores - 1, min 1).Read Replica
Enable read replica modeRun as a read-only replica of another Duckling instance.
Replica refresh interval (seconds)Seconds between syncing from the primary instance.
Error Tracking (Sentry)
Sentry DSNData Source Name for Sentry error tracking.
Sentry release versionRelease identifier for Sentry tracking.
Sentry trace sampling ratePercentage of transactions to trace (0.0 to 1.0).
CORS
Enable CORSAllow cross-origin requests from web browsers.
Example Configuration
Production .env
Development .env
Configuration Validation
The server validates security settings on startup. Check for warnings:JWT_SECRETusing default valueADMIN_USERNAMEorADMIN_PASSWORDemptySESSION_SECRETnot set
Next Steps
Docker Deployment
Deploy with Docker and Docker Compose
Security
Secure your deployment
Production Guide
Production best practices