Skip to content

Configuration

Complete reference of all LNbits environment variables - server, database, admin, auth, fees, rate limiting, extensions, and notifications.

LNbits is configured through environment variables, typically set in a .env file.

.env file vs Admin UI

LNbits has two layers of configuration: the .env file and the Admin UI. Understanding which one controls what is critical - getting this wrong means your changes silently do nothing.

How it works

When LNBITS_ADMIN_UI=true (the default for most setups), LNbits splits settings into two groups:

  1. .env-only settings - always read from the .env file, never managed by the Admin UI
  2. Admin UI settings - stored in the database, managed through the Admin UI. The .env values for these are ignored.
Configuration layers - .env-only settings vs Admin UI settings

WARNING

When Admin UI is enabled, editing settings like LNBITS_SITE_TITLE or LNBITS_BACKEND_WALLET_CLASS in your .env file has no effect. You must change them through the Admin UI or the Admin API.

.env-only settings

These are always read from the .env file regardless of whether Admin UI is enabled. They control low-level server behavior that must be set before LNbits starts.

VariableDefaultDescription
LNBITS_ADMIN_UIfalseEnable/disable the Admin UI itself
HOST127.0.0.1Server bind address
PORT5000Server bind port
LNBITS_DATA_FOLDER./dataSQLite data directory
LNBITS_DATABASE_URL-PostgreSQL/CockroachDB connection string
SUPER_USER-Super user ID (highest privilege)
AUTH_SECRET_KEYautoSecret key for JWT signing
FIRST_INSTALL_TOKEN-Required token for /first_install page
DEBUGfalseEnable debug logging
DEBUG_DATABASEfalseLog all database queries
BUNDLE_ASSETStrueBundle static assets for production
ENABLE_LOG_TO_FILEtrueWrite logs to data/logs/
LOG_ROTATION100 MBLog file rotation threshold
LOG_RETENTION3 monthsHow long to keep log files
FORWARDED_ALLOW_IPS*Trusted proxy IPs for HTTPS headers
LNBITS_EXTENSIONS_PATH./lnbits/Directory for extension installation
LNBITS_EXTENSIONS_DEFAULT_INSTALL-Extensions to auto-install on every restart
LNBITS_EXTENSIONS_MANIFESTSofficialExtension manifest URLs
LNBITS_EXT_GITHUB_TOKEN-GitHub token to avoid API rate limits
LNBITS_ALLOWED_FUNDING_SOURCESallFunding sources shown in Admin UI
FUNDING_SOURCE_MAX_RETRIES4Connection retries before falling back to VoidWallet

Settings that move to Admin UI

When LNBITS_ADMIN_UI=true, the following settings are ignored in .env and managed through the Admin UI instead. Their initial values are seeded from the .env on first run, then stored in the database settings table.

CategoryVariables
Site brandingLNBITS_SITE_TITLE, LNBITS_SITE_TAGLINE, LNBITS_SITE_DESCRIPTION, LNBITS_CUSTOM_LOGO, LNBITS_THEME_OPTIONS, LNBITS_HIDE_API
Funding sourceLNBITS_BACKEND_WALLET_CLASS and all backend-specific vars (LND, CLN, Eclair, etc.)
AuthenticationAUTH_TOKEN_EXPIRE_MINUTES, AUTH_ALLOWED_METHODS, OAuth provider configs (Google, GitHub, Keycloak)
FeesLNBITS_SERVICE_FEE, LNBITS_SERVICE_FEE_WALLET, LNBITS_SERVICE_FEE_MAX, LNBITS_RESERVE_FEE_MIN, LNBITS_RESERVE_FEE_PERCENT
Rate limitingLNBITS_RATE_LIMIT_NO, LNBITS_RATE_LIMIT_UNIT, LNBITS_ALLOWED_IPS, LNBITS_BLOCKED_IPS
UsersLNBITS_ALLOWED_USERS, LNBITS_ADMIN_USERS, LNBITS_ALLOW_NEW_ACCOUNTS
ExtensionsLNBITS_ADMIN_EXTENSIONS, LNBITS_USER_DEFAULT_EXTENSIONS, LNBITS_EXTENSIONS_DEACTIVATE_ALL
Wallet limitsLNBITS_WALLET_LIMIT_MAX_BALANCE, LNBITS_WALLET_LIMIT_DAILY_MAX_WITHDRAW, LNBITS_WALLET_LIMIT_SECS_BETWEEN_TRANS
Node UILNBITS_NODE_UI, LNBITS_PUBLIC_NODE_UI, LNBITS_NODE_UI_TRANSACTIONS
OtherLNBITS_DEFAULT_WALLET_NAME, LNBITS_AD_SPACE, LNBITS_CUSTOM_BADGE, LNBITS_ALLOWED_CURRENCIES, LIGHTNING_INVOICE_EXPIRY

Resetting Admin UI settings back to .env

If you need to go back to file-based configuration:

  1. Set LNBITS_ADMIN_UI=false in your .env
  2. Clear the settings table from the database:
    sql
    DELETE FROM settings;
  3. Restart LNbits - it will read all values from .env again

TIP

The .env.example file in the LNbits repository marks which settings are .env-only with clear ###### .env ONLY SETTINGS ###### comment blocks. When in doubt, check the source.

Core settings

Server

VariableDefaultDescription
HOST127.0.0.1Bind address
PORT5000Bind port
DEBUGfalseEnable debug mode
LNBITS_SITE_TITLELNbitsSite title shown in the UI
LNBITS_SITE_TAGLINEfree and open-source...Tagline on login page
BUNDLE_ASSETStrueBundle static assets for production

Database

VariableDefaultDescription
LNBITS_DATA_FOLDER./dataSQLite data directory
LNBITS_DATABASE_URL-PostgreSQL or CockroachDB connection string
bash
# SQLite (default)
LNBITS_DATA_FOLDER=./data

# PostgreSQL
LNBITS_DATABASE_URL=postgres://user:pass@localhost:5432/lnbits

# CockroachDB
LNBITS_DATABASE_URL=cockroachdb://user:pass@localhost:26257/lnbits

Admin

VariableDefaultDescription
LNBITS_ADMIN_UIfalseEnable the admin settings dashboard
LNBITS_ADMIN_USERS-Comma-separated user IDs with admin access
SUPER_USER-Super user ID (full system access)
LNBITS_ALLOWED_USERS-Restrict login to these user IDs only
LNBITS_ALLOW_NEW_ACCOUNTStrueAllow new user registration

Theming

VariableDefaultDescription
LNBITS_THEME_OPTIONSall themesComma-separated list of available themes
LNBITS_CUSTOM_LOGO-URL to a custom logo image
LNBITS_HIDE_APIfalseHide the API section in the UI

Available themes: classic, bitcoin, flamingo, freedom, mint, autumn, monochrome, salvador, cyber

Authentication

VariableDefaultDescription
AUTH_SECRET_KEYauto-generatedSecret key for signing JWT tokens
AUTH_TOKEN_EXPIRE_MINUTES525960 (1 year)Token validity period
AUTH_ALLOWED_METHODSallComma-separated list of allowed auth methods

OAuth providers

bash
# Google
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-secret

# GitHub
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-secret

# Keycloak
KEYCLOAK_CLIENT_ID=lnbits
KEYCLOAK_CLIENT_SECRET=your-secret
KEYCLOAK_DISCOVERY_URL=https://keycloak.example.com/realms/master/.well-known/openid-configuration

Fees

VariableDefaultDescription
LNBITS_SERVICE_FEE0Service fee percentage (e.g., 0.5 for 0.5%)
LNBITS_RESERVE_FEE_MIN2000Minimum reserve in millisatoshis
LNBITS_RESERVE_FEE_PERCENT1.0Reserve fee percentage
LNBITS_WALLET_LIMIT_MAX_BALANCE0Maximum wallet balance (0 = unlimited)
LNBITS_SERVICE_FEE_WALLET-Wallet ID that receives service fees

Rate limiting

VariableDefaultDescription
LNBITS_RATE_LIMIT_NO200Number of requests allowed
LNBITS_RATE_LIMIT_UNITminuteTime unit (second, minute, hour)
LNBITS_ALLOWED_IPS-Whitelist of IP addresses
LNBITS_BLOCKED_IPS-Blocklist of IP addresses

Extensions

VariableDefaultDescription
LNBITS_EXTENSIONS_DEFAULT_INSTALL-Extensions to auto-install on startup
LNBITS_ADMIN_EXTENSIONS-Extensions only admins can activate
LNBITS_USER_DEFAULT_EXTENSIONS-Extensions auto-activated for new users
LNBITS_EXTENSIONS_DEACTIVATE_ALLfalseDisable all extensions (core-only mode)
LNBITS_EXTENSIONS_MANIFESTSofficialExtension manifest URLs

Notifications

See Notifications for full setup guides and trigger details.

VariableDefaultDescription
LNBITS_NOTIFICATION_SETTINGS_UPDATEfalseNotify on config changes
LNBITS_NOTIFICATION_CREDIT_DEBITfalseNotify on balance changes
NOTIFICATION_BALANCE_DELTA_THRESHOLD_SATS0Min sats delta to trigger alert
LNBITS_NOTIFICATION_SERVER_START_STOPfalseNotify on server start/stop
LNBITS_NOTIFICATION_WATCHDOGfalseNotify on node balance drift
LNBITS_WATCHDOG_INTERVAL_MINUTES60Watchdog check frequency
LNBITS_NOTIFICATION_SERVER_STATUS_HOURS0Periodic status interval (0 = off)
LNBITS_NOTIFICATION_INCOMING_PAYMENT_AMOUNT_SATS0Min sats for incoming alert
LNBITS_NOTIFICATION_OUTGOING_PAYMENT_AMOUNT_SATS0Min sats for outgoing alert
LNBITS_EMAIL_NOTIFICATIONS_ENABLEDfalseEnable email channel
LNBITS_EMAIL_NOTIFICATIONS_SERVER-SMTP server
LNBITS_EMAIL_NOTIFICATIONS_PORT587SMTP port
LNBITS_EMAIL_NOTIFICATIONS_EMAIL-Sender email
LNBITS_EMAIL_NOTIFICATIONS_USERNAME-SMTP username
LNBITS_EMAIL_NOTIFICATIONS_PASSWORD-SMTP password
LNBITS_EMAIL_NOTIFICATIONS_TO_EMAILS-Recipient emails (comma-separated)
LNBITS_TELEGRAM_NOTIFICATIONS_ENABLEDfalseEnable Telegram channel
LNBITS_TELEGRAM_NOTIFICATIONS_ACCESS_TOKEN-Telegram bot token
LNBITS_TELEGRAM_NOTIFICATIONS_CHAT_ID-Telegram chat ID
LNBITS_NOSTR_NOTIFICATIONS_ENABLEDfalseEnable Nostr DM channel
LNBITS_NOSTR_NOTIFICATIONS_PRIVATE_KEY-Nostr sender nsec
LNBITS_NOSTR_NOTIFICATIONS_IDENTIFIERS-Recipient npubs (comma-separated)

Funding source

Set the backend with:

bash
LNBITS_BACKEND_WALLET_CLASS=VoidWallet

See Funding Sources for all backend-specific configuration.

Example .env

bash
# Server
HOST=0.0.0.0
PORT=5000

# Database
LNBITS_DATABASE_URL=postgres://lnbits:secret@localhost:5432/lnbits

# Admin
LNBITS_ADMIN_UI=true
LNBITS_ADMIN_USERS=abc123,def456

# Funding source
LNBITS_BACKEND_WALLET_CLASS=LndRestWallet
LND_REST_ENDPOINT=https://localhost:8080
LND_REST_CERT=/path/to/tls.cert
LND_REST_MACAROON=hex-encoded-macaroon

# Fees
LNBITS_SERVICE_FEE=0.5
LNBITS_RESERVE_FEE_MIN=2000

# Theme
LNBITS_SITE_TITLE=My LNbits
LNBITS_THEME_OPTIONS=classic,bitcoin,mint

Next steps

News · Shop · SaaS · Telegram · Released under the MIT License.