Skip to content

Environment Variables ​

Holo reads secrets and per-machine settings from environment variables. Most of them are used inside config/*.ts files through env(), so you can rename or remove them by editing the config file. This page lists every variable Holo itself or its generated config files read.

Env files and loading order ​

Holo loads .env files from your project root, then applies real environment variables on top. Later files override earlier ones, and real environment variables always win.

EnvironmentFiles, in order
development.env, .env.development, .env.local
production.env, .env.production, .env.prod, .env.local
test.env, .env.test

If both .env.production and .env.prod exist, .env.production is used and .env.prod is ignored with a warning.

The environment comes from APP_ENV. The --env option wins over a real environment variable, which wins over APP_ENV in .env. If none of them sets it, the environment is production. It must be development, production, or test; any other value stops Holo with an error.

bash
APP_ENV=production npx holo start
npx holo migrate --env=test

WARNING

Commit .env.example, never .env. New projects generate both: .env with local values and .env.example with empty keys for teammates to copy.

Values and types ​

ini
APP_NAME="My Blog"
APP_DEBUG=false
MAIL_PORT=587
  • Quotes around values are removed. \n, \r, and \t are turned into real characters.
  • On Windows, %NAME% is replaced with the value of the real environment variable NAME, and %% becomes a single %. A %NAME% whose variable isn't set stays as written. Variables from other .env files aren't used. macOS and Linux leave values unchanged.
  • Lines starting with # are comments. A leading export is allowed.
  • When env('KEY', fallback) has a boolean fallback, true, 1, yes, and on mean true, and false, 0, no, and off mean false. A number fallback converts the value to a number. An empty value uses the fallback. A value that doesn't convert throws an error that names the variable, so a typo like APP_DEBUG=ture fails at startup instead of silently using the fallback.

Runtime ​

These are read by Holo directly, not through config files.

VariableDefaultDescription
APP_ENVproductionPicks the environment and which .env files load. See Env files and loading order.
NODE_ENVnoneNot used to pick the environment. holo start sets it to production for the framework server. The running app reads the config cache when the resolved APP_ENV is production and a cache exists.
PORTframework defaultPort for holo dev and holo start when you don't pass --port. Must be a whole number up to 65535.

App ​

Used in config/app.ts. See app.ts.

VariableDefaultDescription
APP_NAMEproject nameApp name.
APP_KEYemptySecret key for signing CSRF tokens and storage URLs and encrypting social tokens. Create it with npx holo key:generate.
APP_URLhttp://localhost:3000 (5173 for SvelteKit)Public URL of the app. Also used for the broadcast worker's allowed origins and auth endpoint.
APP_TIMEZONEUTCApp timezone.
APP_ENVproductiondevelopment, production, or test. Sets app.env and decides whether migrate:fresh, migrate:rollback, and seed ask for confirmation. New projects set it to development in .env.
APP_DEBUGfalseShows the messages of unexpected errors in SvelteKit responses. Nuxt's useHoloDebug() returns it. Next.js doesn't read it. Set APP_DEBUG=true in local .env files.

Database ​

Used in config/database.ts. See database.ts. Holo reads them only where your config calls env(), so they apply to the app and to CLI commands such as holo migrate alike.

VariableDefaultDescription
DB_CONNECTIONmainDefault connection name.
DB_DRIVERchosen at holo newsqlite, postgres, or mysql.
DB_URL./storage/database.sqlite (SQLite)Connection URL or SQLite file path.
DB_HOST127.0.0.1Database host.
DB_PORT5432 (Postgres), 3306 (MySQL)Database port.
DB_USERNAMEpostgres / rootDatabase user.
DB_PASSWORDemptyDatabase password.
DB_DATABASEproject nameDatabase name.
DB_SCHEMApublicPostgres schema. Sets the search_path.
DB_POOL_MAX4Postgres: maximum pool size.
DB_CONNECTION_TIMEOUT_MS5000Postgres: connection timeout.
DB_IDLE_TIMEOUT_MS30000Postgres: idle connection timeout.
DB_MAX_CONCURRENT_QUERIES4Postgres: queries running at once.
DB_QUERY_QUEUE_LIMIT32Postgres: queries allowed to wait.
DB_SSLfalsetrue or false. Turns on TLS for MySQL connections whose config reads it, as new MySQL projects do. PostgreSQL TLS comes from sslmode in DB_URL or from PGSSLMODE.
DB_LOGGINGfalsetrue or false. Turns on the connection's built-in query logging.

Redis ​

Used in config/redis.ts. See redis.ts.

VariableDefaultDescription
REDIS_CONNECTIONdefaultDefault Redis connection name.
REDIS_URLnoneFull redis:// or rediss:// URL. Wins over host and port.
REDIS_HOST127.0.0.1Host.
REDIS_PORT6379Port.
REDIS_USERNAMEnoneUsername.
REDIS_PASSWORDnonePassword.
REDIS_DB0Database number.

Queue and cache ​

VariableDefaultDescription
QUEUE_CONNECTIONdriver chosen at install (sync)Default queue connection.
CACHE_DRIVERdriver chosen at install (file)Default cache store.
CACHE_PREFIXemptyPrefix for every cache key.

Storage ​

Used in config/storage.ts. See File Storage.

VariableDefaultDescription
STORAGE_DEFAULT_DISKlocalDefault disk.
STORAGE_ROUTE_PREFIX/storageURL prefix for public files.
STORAGE_DISKS_PUBLIC_ROOT./storage/app/publicFolder for the public disk.
STORAGE_DISKS_S3_ACCESS_KEY_IDnoneS3 access key.
STORAGE_DISKS_S3_SECRET_ACCESS_KEYnoneS3 secret key.
STORAGE_DISKS_S3_REGIONus-east-1S3 region.
STORAGE_DISKS_S3_BUCKETnoneS3 bucket.
STORAGE_DISKS_S3_URLnonePublic base URL for S3 files.
STORAGE_DISKS_S3_ENDPOINTnoneEndpoint for S3-compatible services.
STORAGE_DISKS_S3_FORCE_PATH_STYLE_ENDPOINTfalseUse path-style S3 URLs.

Override any disk from the environment ​

Holo also checks STORAGE_DISKS_<DISK>_<OPTION> for every disk, even if your config file doesn't use env() for it. <DISK> is the disk name in upper case.

SuffixDisk option
_DRIVERdriver
_ROOTroot
_URLurl
_VISIBILITYvisibility
_BUCKETbucket
_REGIONregion
_ENDPOINTendpoint
_ACCESS_KEY_IDaccessKeyId
_SECRET_ACCESS_KEYsecretAccessKey
_SESSION_TOKENsessionToken
_FORCE_PATH_STYLE_ENDPOINTforcePathStyleEndpoint

For example, STORAGE_DISKS_MEDIA_BUCKET=blog-uploads sets the bucket of a disk named media.

These overrides are read from the process environment when storage starts. Values that only exist in a .env file may not reach them, so for settings you want in .env, use env() in config/storage.ts instead.

Media ​

Used in config/media.ts. See Media Library.

VariableDefaultDescription
MEDIA_DISKpublicDisk for media in collections that don't set disk().

Mail ​

Used in config/mail.ts. See Mail Drivers.

VariableDefaultDescription
MAIL_MAILERpreviewDefault mailer.
MAIL_FROM_ADDRESS[email protected]Default sender address.
MAIL_FROM_NAMEHolo AppDefault sender name.
MAIL_LOG_BODIESfalseInclude message bodies when using the log mailer.
MAIL_HOST127.0.0.1SMTP host.
MAIL_PORT1025SMTP port.
MAIL_SECUREfalseUse TLS for SMTP.
MAIL_USERNAMEnoneSMTP user.
MAIL_PASSWORDnoneSMTP password.

Sessions ​

Used in config/session.ts. See Sessions.

VariableDefaultDescription
SESSION_DRIVERfileSession store.
SESSION_CONNECTIONdefault database connectionDatabase connection for the database store.
SESSION_COOKIEholo_sessionCookie name.
SESSION_PATH/Cookie path.
SESSION_DOMAINnoneCookie domain.
SESSION_SECUREfalseHTTPS-only cookie. Set true in production.
SESSION_SAME_SITElaxlax, strict, or none.
SESSION_IDLE_TIMEOUT120Minutes of inactivity before expiry.
SESSION_LIFETIME120Maximum session age in minutes.
SESSION_REMEMBER_ME_LIFETIME43200"Remember me" lifetime in minutes.

Auth ​

Used in config/auth.ts. See Authentication.

VariableDefaultDescription
AUTH_GUARDwebDefault guard.
AUTH_PASSWORD_BROKERusersDefault password reset broker.
AUTH_<PROVIDER>_CLIENT_IDnoneSocial login client ID. <PROVIDER> is GOOGLE, GITHUB, DISCORD, FACEBOOK, APPLE, or LINKEDIN.
AUTH_<PROVIDER>_CLIENT_SECRETnoneSocial login client secret.
AUTH_<PROVIDER>_REDIRECT_URInoneSocial login callback URL.
AUTH_WORKOS_PROVIDERdashboardWorkOS provider name.
WORKOS_CLIENT_IDnoneWorkOS client ID.
WORKOS_API_KEYnoneWorkOS API key.
WORKOS_REDIRECT_URInoneWorkOS callback URL.
AUTH_CLERK_PROVIDERappClerk provider name.
CLERK_PUBLISHABLE_KEYnoneClerk publishable key.
CLERK_SECRET_KEYnoneClerk secret key.
CLERK_API_URLnoneClerk API URL.
CLERK_FRONTEND_APInoneClerk frontend API.
CLERK_REDIRECT_URInoneClerk callback URL.
CLERK_SESSION_COOKIE__sessionClerk session cookie name.

holo install auth also writes AUTH_EMAIL_VERIFICATION_ROUTE and AUTH_PASSWORD_RESET_ROUTE to .env. The generated config/auth.ts doesn't read them; change the routes in config/auth.ts instead.

Security and CORS ​

VariableDefaultDescription
RATE_LIMIT_DRIVERfileRate limit store: memory, file, or redis.
FRONTEND_URLhttp://localhost:3000Origin allowed by config/cors.ts.
FRONTEND_DOMAINlocalhost:3000Stateful domain in config/cors.ts.

Broadcasting ​

Used in config/broadcast.ts. See Broadcast Drivers and Config.

VariableDefaultDescription
BROADCAST_CONNECTIONholoDefault broadcast connection.
BROADCAST_APP_IDnoneApp ID shared by the app and the worker.
BROADCAST_APP_KEYnonePublic app key.
BROADCAST_APP_SECRETnoneSecret used to sign channel auth.
BROADCAST_HOST127.0.0.1Host the app and clients use to reach the worker.
BROADCAST_PORT8080Worker port.
BROADCAST_SCHEMEhttphttps turns on TLS.

DANGER

Holo has no default for the broadcast app ID, key, or secret. holo new writes generated values into .env, and holo install broadcast does the same for an existing app. Set your own values in production.

Next steps ​

Released under the MIT License.