Skip to content

Configuration Reference

No configuration is required to get started. All variables have safe defaults. Create a .env file in the project root to override any of them.

bash
cp .env.example .env

Uncomment only the lines you need to change. The file is loaded automatically by Docker Compose and by the Express server at startup.


Docker

VariableDefaultDescription
HOST_PORT1453Externally-exposed port that maps to the container's internal port. Change this to run OpenBin on a different host port.

Server

VariableDefaultDescription
PORT1453Internal Express server port. Rarely needs changing unless you have a port conflict inside the container.

Authentication

VariableDefaultDescription
JWT_SECRET(auto-generated)JWT signing secret. Auto-generated on first run and persisted to /data/.jwt_secret if unset. Set explicitly to keep sessions valid across container rebuilds.
JWT_EXPIRES_IN7dLegacy token lifetime used for API key compatibility.
ACCESS_TOKEN_EXPIRES_IN15mLifetime of the short-lived access token stored in an httpOnly cookie.
REFRESH_TOKEN_MAX_DAYS7Refresh token lifetime in days. Accepted range: 1–90.
COOKIE_SECURE(auto)Forces the Secure flag on cookies. Defaults to true in production automatically. Set explicitly if needed.
BCRYPT_ROUNDS12Password hashing cost factor. Range: 4–31. Higher values are more secure but slower.
REGISTRATION_ENABLEDtrueSet to false to disable new user registration. Existing users can still log in.

Upload Limits

VariableDefaultDescription
MAX_PHOTO_SIZE_MB5Maximum size per photo upload in megabytes. Accepted range: 1–50.
MAX_AVATAR_SIZE_MB2Maximum size per avatar upload in megabytes. Accepted range: 1–10.

AI Provider (server-wide fallback)

When set, all users get AI features without needing to configure their own API keys. Individual users can still override with their own settings in their profile.

VariableDefaultDescription
AI_PROVIDER(unset)AI provider to use. Accepted values: openai, anthropic, gemini, openai-compatible.
AI_API_KEY(unset)API key for the configured provider.
AI_MODEL(unset)Model name to use. Examples: gpt-4o, claude-sonnet-4-5-20250514, gemini-2.0-flash.
AI_ENDPOINT_URL(unset)Custom endpoint URL. Required only when AI_PROVIDER=openai-compatible (e.g. http://localhost:11434/v1 for Ollama).

Supported providers

OpenBin supports OpenAI, Anthropic (Claude), Google Gemini, and any OpenAI-compatible API such as Ollama or LM Studio. Each user can also configure their own key independently via their profile settings.


AI Encryption

VariableDefaultDescription
AI_ENCRYPTION_KEY(unset)Encrypts user AI API keys at rest using AES-256-GCM. Generate a key with openssl rand -base64 32. If unset, API keys are stored in plaintext.

Generating an encryption key

bash
openssl rand -base64 32

Copy the output into your .env file as AI_ENCRYPTION_KEY=<value>. Do not change this value after users have saved API keys, or the existing keys will become unreadable.


Backups

VariableDefaultDescription
BACKUP_ENABLEDfalseSet to true to enable automatic database backups.
BACKUP_INTERVALdailyBackup schedule. See Backup Schedule Formats below.
BACKUP_RETENTION7Number of days to keep backup files before they are automatically deleted. Accepted range: 1–365.
BACKUP_WEBHOOK_URL(unset)Optional URL that receives a POST request on backup failure. Payload: { event, error, timestamp }.

Backup files are written to /data/backups/ inside the container (BACKUP_PATH in docker-compose.yml maps to the api_data volume).


Rate Limiting

VariableDefaultDescription
DISABLE_RATE_LIMITfalseSet to true to disable all rate limiters. Useful in development or automated test environments. Do not disable in production.

Advanced

VariableDefaultDescription
CORS_ORIGINhttp://localhost:5173Allowed CORS origin for API requests. Only relevant for non-Docker local development where the frontend and API run on different origins.
TRUST_PROXYfalseSet to true when running behind a reverse proxy such as Nginx or Caddy. Required for correct IP detection in rate limiting and for the Secure cookie flag to work over HTTPS.

Backup Schedule Formats

The BACKUP_INTERVAL variable accepts the following values:

ValueBehavior
hourlyRuns a backup every hour
dailyRuns a backup once per day at midnight
weeklyRuns a backup once per week
Custom cron expressionAny valid 5-field cron expression

Custom cron examples:

0 3 * * *       # Every day at 3:00 AM
0 */6 * * *     # Every 6 hours
0 2 * * 0       # Every Sunday at 2:00 AM

TIP

Use a tool like crontab.guru to build and verify cron expressions.

Released under the GPL-3.0 License.