Environment Reference (.env)
Generated .env files are intentionally compact. They contain the values a new App needs to start locally, not every optional override supported by the generated runtime.
Use this page as the complete environment reference when you need to add an override, configure a production driver, or understand a value already present in an .env file. Feature guides explain behavior and deployment tradeoffs; this page owns the exhaustive public variable contract.
Keep .env Intentional
Add a variable only when the App needs a value different from its runtime fallback or rendered local default. Keep secrets in the deployment environment or secret manager outside local development.
Resolution and Naming
GoForj Apps load .env files before their Wire graph is initialized. See Configuration Reference for file precedence, app overlays, compiled defaults, and compiled overrides.
GoForj uses two reusable naming patterns:
- App overlay:
<APP>_<KEY>overrides<KEY>for one selected App. For example,ADMIN_APP_URLoverlaysAPP_URL, andADMIN_CACHE_SESSIONS_DRIVERoverlaysCACHE_SESSIONS_DRIVERwhile theadminApp runs. - Named resource:
<FAMILY>_<NAME>_<SUFFIX>configures one generated resource. For example,CACHE_SESSIONS_DRIVERselects thesessionscache driver andSTORAGE_UPLOADS_BUCKETconfigures theuploadsdisk.
The default resource omits <NAME>. Unless a section says otherwise, each default variable below also accepts a named form by inserting <NAME> after its family prefix.
Variables for components that are not selected are not rendered and have no generated owner. Compatibility aliases are identified explicitly. Internal process handoff variables, test-only controls, and accepted settings with no runtime behavior are not configuration options and are not listed as public variables.
Driver Options
The resource tables list the driver values GoForj Apps accept.
| Pattern | Meaning |
|---|---|
<FAMILY>_SUPPORTED_DRIVERS | Comma-separated drivers compiled into the App. Changing this value requires generation and a rebuild. |
<FAMILY>_DRIVER | Active driver for the default resource. |
<FAMILY>_<NAME>_DRIVER | Active driver for one named resource. |
To add driver support, update SUPPORTED_DRIVERS and run forj build. To switch between compiled drivers, update the active driver and restart the App. Unsupported selections fail during generation or App construction.
- Database, Cache, and File Storage
- Search and Feature Flags
- Events, Queue, Mail, and Notifications
See Driver Selection to compare local and shared backends.
App and Runtime
| Variable | Default | Purpose |
|---|---|---|
APP_NAME | Project name when rendered | App display and service name. |
APP_KEY | Generated base64: key | Application encryption key. The standalone Crypt library consumes it through crypt.NewFromEnv; generated subsystems do not consume it automatically. Keep it secret and stable. |
APP_PREVIOUS_KEYS | Empty | Comma-separated older APP_KEY values used by the Crypt library during key rotation. |
APP_ENV | local | Environment name, such as local, staging, or production. |
APP_TZ | UTC | App timezone for local dates, log timestamps, and schedules. |
APP_DEBUG | 0 | Numeric log verbosity from 0 through 3. |
APP_URL | http://localhost:3000 when Web API is rendered | Public base URL used by generated browser and runtime features. |
APP_MAINTENANCE_ENABLED | false | Force HTTP maintenance mode from process startup while keeping operational routes available. Queue workers and scheduled tasks continue normally. Prefer the live ./bin/<app> maintenance:enable and maintenance:disable commands for planned work; they connect to the App's configured HTTP port over loopback. Restart after changing this environment policy. |
APP_MAINTENANCE_DRIVER | memory | Maintenance state mechanism. memory is local-only, process-scoped, and not recommended for production. Use cache with a distributed generated cache resource in production. |
APP_MAINTENANCE_STORE | default | Resource selected from the App runtime's existing generated cache manager when APP_MAINTENANCE_DRIVER=cache. A value such as operations selects the existing CACHE_OPERATIONS_* driver and connection settings. |
APP_DIAG_TOKEN | Generated when Web API is rendered | Bearer token for protected diagnostic commands and endpoints. |
APP_SHUTDOWN_TIMEOUT | 30s | Root graceful-shutdown budget. |
APP_VERSION | Empty | Deployment version reported to Lighthouse. |
APP_REVISION | Empty | Immutable deployment revision used by framework-managed metrics discovery. Keep it bounded and low-cardinality, such as a commit SHA. |
APP_INSTANCE_ID | Empty | Explicit process or replica identity reported to Lighthouse. When empty, Lighthouse identifies the instance by hostname, then its generated agent ID. |
APP_INSTANCE_KIND | Empty | Optional deployment-specific instance classification reported to Lighthouse. |
APP_MODE | Empty | Optional runtime mode used in generated log labels. Runtime commands normally set their own context. |
APP_LOG_PREFIX | Empty | Optional log-label prefix. Generated runtime commands set this when they need a source label. |
App Timezone
Set APP_TZ in .env or in the deployment environment using an IANA timezone name. The App reads the setting at startup.
APP_TZ=America/ChicagoAPP_TZ sets the default timezone for Go's time.Local, log timestamps, and cron and calendar schedules. Generated Compose services inherit the same setting. Database sessions and automatic persistence use UTC.
HTTP and OpenAPI
| Variable | Default | Purpose |
|---|---|---|
API_HTTP_HOST | 0.0.0.0 | HTTP bind host. |
API_HTTP_PORT | App port, starting at 3000 | HTTP bind port. |
PORT | Empty | Compatibility override for the default or selected App HTTP port. When set, it takes precedence over API_HTTP_PORT; prefer leaving it unset and configuring API_HTTP_PORT. |
HTTP_ACCESS_LOG_ENABLED | true | Enable generated HTTP access log events. |
HTTP_SPA_ACCESS_LOG_ENABLED | false | Include successful requests served by a registered SPA in HTTP access logs. SPA failures remain visible when disabled. |
HTTP_CORS_ALLOW_ENDPOINTS | http://localhost:8080 in local; otherwise empty | Comma-separated credentialed CORS origins. Configure production origins explicitly. |
API_SWAGGER_ENABLED | true | Enable generated API reference routes. |
SWAGGER_ENABLED | true | Compatibility fallback for API_SWAGGER_ENABLED. Prefer API_SWAGGER_ENABLED. |
OPENAPI_SPEC_PATH | build/openapi.json; additional apps use build/<app>/openapi.json | Path to the OpenAPI artifact served by the generated API reference routes. |
Frontend
Only values with an explicit frontend prefix are exposed to generated browser code. Treat every frontend value as public.
| Variable Pattern | Purpose |
|---|---|
FRONTEND_<KEY> | Exposes VITE_<KEY> to every generated frontend. |
<APP>_FRONTEND_<KEY> | Overrides one App frontend, such as ADMIN_FRONTEND_BACKEND_URL. |
VITE_BACKEND_URL | Compatibility fallback for FRONTEND_BACKEND_URL. Prefer the GoForj frontend prefix in shared environment files. |
FRONTEND_BACKEND_URL | Backend proxy target. Resolution falls back to <APP>_APP_URL, APP_URL, then the App HTTP port. |
FRONTEND_AUTH_PASSWORD_MIN_LENGTH | Vue password guidance matching AUTH_PASSWORD_MIN_LENGTH. |
FRONTEND_AUTH_PASSWORD_REQUIRE_UPPER | Vue password guidance matching AUTH_PASSWORD_REQUIRE_UPPER. |
FRONTEND_AUTH_PASSWORD_REQUIRE_LOWER | Vue password guidance matching AUTH_PASSWORD_REQUIRE_LOWER. |
FRONTEND_AUTH_PASSWORD_REQUIRE_NUMBER | Vue password guidance matching AUTH_PASSWORD_REQUIRE_NUMBER. |
FRONTEND_AUTH_PASSWORD_REQUIRE_SYMBOL | Vue password guidance matching AUTH_PASSWORD_REQUIRE_SYMBOL. |
The backend auth policy remains authoritative. The password-policy frontend values are consumed only by the Vue starter.
Generated frontends expose the selected App's <APP>_APP_ENV, or the global APP_ENV, as VITE_APP_ENV.
Auth
Generated auth has secure runtime fallbacks, so a new .env includes only its generated signing secret and local bootstrap account.
| Variable | Default | Purpose |
|---|---|---|
API_JWT_SECRET_KEY | Empty; generated locally | JWT signing secret. Supply a unique deployment secret outside local development. |
AUTH_ACCESS_TOKEN_TTL | 15m | Access-token lifetime. |
AUTH_SESSION_IDLE_TTL | 2h | Maximum session inactivity before sign-in is required. |
AUTH_SESSION_TTL | 24h | Absolute session lifetime. |
AUTH_REMEMBER_SESSION_TTL | 720h | Absolute lifetime for remembered sessions. |
AUTH_REGISTER_REQUIRES_EMAIL_VERIFICATION | false | Delay session issuance until a new account verifies its email. |
AUTH_PASSWORD_MIN_LENGTH | 8 | Minimum local-password length. |
AUTH_PASSWORD_REQUIRE_UPPER | true | Require an uppercase character. |
AUTH_PASSWORD_REQUIRE_LOWER | false | Require a lowercase character. |
AUTH_PASSWORD_REQUIRE_NUMBER | false | Require a number. |
AUTH_PASSWORD_REQUIRE_SYMBOL | true | Require a symbol. |
AUTH_COOKIE_SECURE | auto | Secure-cookie policy. auto follows the request scheme and enables secure cookies for HTTPS requests. |
AUTH_PASSWORD_RESET_TTL | 1h | Password-reset token lifetime. |
AUTH_PASSWORD_RESET_RETURN_TOKEN | true in local; otherwise false | Return reset tokens in API responses. Enable outside local development only for a controlled integration. |
AUTH_EMAIL_VERIFICATION_TTL | 24h | Email-verification token lifetime. |
AUTH_EMAIL_VERIFICATION_RETURN_TOKEN | true in local; otherwise false | Return verification tokens in API responses. Enable outside local development only for a controlled integration. |
AUTH_LOGIN_LOCKOUT_ATTEMPTS | 5 | Failed attempts before temporary account lockout. |
AUTH_LOGIN_LOCKOUT_DURATION | 15m | Account lockout duration. |
AUTH_LOGIN_RATE_LIMIT_ATTEMPTS | 10 | Login attempts allowed during the rate-limit window. |
AUTH_LOGIN_RATE_LIMIT_DURATION | 15m | Login rate-limit window. |
AUTH_BOOTSTRAP_USERNAME | Empty; rendered local value is admin | Local bootstrap username. Bootstrap is skipped when username or password is empty. |
AUTH_BOOTSTRAP_EMAIL | Derived as <username>@local.invalid; rendered local value is [email protected] | Local bootstrap email. |
AUTH_BOOTSTRAP_PASSWORD | Empty; rendered local value is admin | Local bootstrap password. Replace or remove it outside local development. |
See Auth, Sessions and Cookies, and Production Hardening.
OAuth
OAuth credential stubs are intentionally absent from generated .env files. A provider remains disabled until every required value is present.
| Provider | Required Variables |
|---|---|
| GitHub | AUTH_OAUTH_GITHUB_CLIENT_ID, AUTH_OAUTH_GITHUB_CLIENT_SECRET |
AUTH_OAUTH_GOOGLE_CLIENT_ID, AUTH_OAUTH_GOOGLE_CLIENT_SECRET | |
| Microsoft | AUTH_OAUTH_MICROSOFT_CLIENT_ID, AUTH_OAUTH_MICROSOFT_CLIENT_SECRET |
| Apple | AUTH_OAUTH_APPLE_CLIENT_ID, AUTH_OAUTH_APPLE_TEAM_ID, AUTH_OAUTH_APPLE_KEY_ID, AUTH_OAUTH_APPLE_PRIVATE_KEY |
Common and advanced provider settings:
| Variable | Default | Purpose |
|---|---|---|
AUTH_OAUTH_STATE_TTL | 10m | Lifetime of one-time OAuth state records. |
AUTH_OAUTH_MICROSOFT_TENANT | common | Microsoft tenant segment. |
AUTH_OAUTH_GITHUB_AUTH_URL | GitHub authorize endpoint | Advanced authorization endpoint override. |
AUTH_OAUTH_GITHUB_TOKEN_URL | GitHub token endpoint | Advanced token endpoint override. |
AUTH_OAUTH_GITHUB_USERINFO_URL | GitHub user endpoint | Advanced user-info endpoint override. |
AUTH_OAUTH_GITHUB_EMAILS_URL | GitHub email endpoint | Advanced verified-email endpoint override. |
AUTH_OAUTH_GOOGLE_AUTH_URL | Google authorize endpoint | Advanced authorization endpoint override. |
AUTH_OAUTH_GOOGLE_TOKEN_URL | Google token endpoint | Advanced token endpoint override. |
AUTH_OAUTH_GOOGLE_USERINFO_URL | Google OpenID user-info endpoint | Advanced user-info endpoint override. |
AUTH_OAUTH_MICROSOFT_AUTH_URL | Tenant-specific Microsoft authorize endpoint | Advanced authorization endpoint override. |
AUTH_OAUTH_MICROSOFT_TOKEN_URL | Tenant-specific Microsoft token endpoint | Advanced token endpoint override. |
AUTH_OAUTH_MICROSOFT_USERINFO_URL | Microsoft Graph OpenID user-info endpoint | Advanced user-info endpoint override. |
AUTH_OAUTH_APPLE_AUTH_URL | Apple authorize endpoint | Advanced authorization endpoint override. |
AUTH_OAUTH_APPLE_TOKEN_URL | Apple token endpoint | Advanced token endpoint override. |
AUTH_OAUTH_APPLE_JWKS_URL | Apple signing-key endpoint | Advanced JWKS endpoint override. |
AUTH_OAUTH_APPLE_RESPONSE_MODE | form_post | Apple callback response mode. |
Endpoint overrides are primarily for provider-compatible gateways, controlled testing, and private identity infrastructure. See OAuth for account-linking and callback behavior.
Database
The default connection uses DB_<SUFFIX>. Named connections use DB_<NAME>_<SUFFIX>, such as DB_ANALYTICS_DRIVER. DB_SUPPORTED_DRIVERS is project-wide.
| Variable | Default | Purpose |
|---|---|---|
DB_SUPPORTED_DRIVERS | Active drivers when unset | Comma-separated drivers compiled into the App. Choices are sqlite, mysql, postgres. Root key only. |
DB_DEFAULT | default | Named connection returned by the default accessor. Root key only. |
DB_DRIVER | sqlite; renderer writes the selected driver | Active connection driver. |
DB_DSN | Empty | Complete connection DSN. When set, it takes precedence over individual connection fields. |
DB_HOST | Empty | MySQL or Postgres host. |
DB_PORT | Empty | MySQL or Postgres port. |
DB_DATABASE | _data/sqlite/app.db for default SQLite; named SQLite uses its resource name | Database name or SQLite path. |
DB_SQLITE_DATABASE | Empty | SQLite-specific path override when one configuration also carries server-database fields. |
DB_USERNAME | Empty | MySQL or Postgres username. |
DB_PASSWORD | Empty | MySQL or Postgres password. |
DB_QUERY_LOGGING | false | Enable GORM query logging for the connection. |
DB_SLOW_QUERY_THRESHOLD | 250ms | Duration above which an observed query is classified as slow. |
DB_MAX_IDLE_CONNECTIONS | Driver default | Maximum idle connections when greater than zero. |
DB_MAX_OPEN_CONNECTIONS | Driver default | Maximum open connections when greater than zero. |
DB_CONN_MAX_LIFETIME_MINUTES | 3 | Maximum connection lifetime in minutes. |
DB_ROOT_PASSWORD | Empty | Root password used only by the generated local MySQL service. Root key only. |
MYSQL_MAX_IDLE_CONNECTIONS | Driver default | Compatibility fallback for DB_MAX_IDLE_CONNECTIONS. Prefer the DB_ key. |
MYSQL_MAX_OPEN_CONNECTIONS | Driver default | Compatibility fallback for DB_MAX_OPEN_CONNECTIONS. Prefer the DB_ key. |
DB_CONNECTIONS, DB_SUPPORTED_CONNECTIONS | Empty | Legacy comma-separated connection-name discovery used by backup commands. New Apps discover DB_<NAME>_* directly. |
forj new selects mysql by default. The runtime fallback when DB_DRIVER is unset is SQLite. The renderer supplies usable local MySQL or Postgres connection values when those services are selected. Active driver values also accept the compatibility aliases sqlite3, mariadb, and postgresql; supported-driver lists and new configuration should use the canonical names above. See Database Connections and Database Shell.
Shared Redis and NATS
Redis-backed Cache, Storage, Events, and Queue resources share the host, port, and password values described below unless their family table says otherwise. Cache, Events, and Queue also use REDIS_DB; Storage defaults its scoped DB to 0.
| Variable | Default | Purpose |
|---|---|---|
REDIS_HOST | redis in generated runtime fallbacks | Shared Redis host. .env.host uses localhost for local host commands. |
REDIS_PORT | 6379 | Shared Redis port and generated local-service published port. |
REDIS_PASSWORD | Empty | Shared Redis password. |
REDIS_DB | 0 | Shared Redis database number. |
NATS_URL | nats://127.0.0.1:4222 | Fallback URL for the NATS cache driver. Other NATS-backed resource families use their scoped URL setting. |
Cache
Use CACHE_<SUFFIX> for the default cache and CACHE_<NAME>_<SUFFIX> for named caches such as CACHE_SESSIONS_DRIVER.
Auth projects render CACHE_SESSIONS_DRIVER. The demo App also renders CACHE_SETTINGS_DRIVER. Both are ordinary named caches and accept the same named suffixes below.
Common settings:
| Variable | Default | Purpose |
|---|---|---|
CACHE_SUPPORTED_DRIVERS | Active drivers when unset | Comma-separated drivers compiled into the App. Choices are memory, file, null, redis, memcached, dynamodb, sqlite, postgres, mysql, nats. Root key only. |
CACHE_DRIVER | memory | Active driver. |
CACHE_DEFAULT_TTL_SECONDS | 300 | Default entry lifetime in seconds. |
CACHE_PREFIX | app | Backend key prefix. |
CACHE_COMPRESSION | none | Value compression: none or gzip. |
CACHE_MAX_VALUE_BYTES | 0 | Maximum shaped value size in bytes; 0 disables the limit. |
CACHE_ENCRYPTION_KEY | Empty | Raw 16, 24, or 32-byte AES key for cache values. This is not APP_KEY format. |
Driver settings:
| Variable | Driver | Default or Format |
|---|---|---|
CACHE_MEMORY_CLEANUP_SECONDS | memory | 600 seconds. |
CACHE_FILE_DIR | file | Cache-specific directory under the operating-system temp root. |
CACHE_ADDRESSES | memcached | Comma-separated host:port values. |
CACHE_ENDPOINT | dynamodb | Empty provider endpoint override. |
CACHE_REGION | dynamodb | us-east-1. |
CACHE_TABLE | dynamodb | cache_entries. |
CACHE_DSN | sqlite | Temporary SQLite file for the cache name. |
CACHE_TABLE | sqlite | cache_entries. |
CACHE_DSN | postgres, mysql | Required connection DSN. |
CACHE_TABLE | postgres, mysql | cache_entries. |
CACHE_URL | nats | NATS_URL, then nats://127.0.0.1:4222. |
CACHE_BUCKET | nats | Derived from the cache name. |
CACHE_BUCKET_TTL | nats | false; use JetStream bucket TTL mode instead of value-envelope expiration. |
CACHE_BUCKET_TTL_SECONDS | nats | 0; bucket-wide JetStream TTL when provisioning a bucket. 0 disables it. |
CACHE_DESCRIPTION | nats | Empty. |
CACHE_HISTORY | nats | 1. |
CACHE_MAX_BYTES | nats | 0. |
CACHE_MAX_VALUE_SIZE | nats | 0. |
CACHE_REPLICAS | nats | 1. |
CACHE_STORAGE | nats | file. |
CACHE_COMPRESSED | nats | false. |
CACHE_ADDR | redis | REDIS_HOST:REDIS_PORT. |
CACHE_USERNAME | redis | Empty. |
CACHE_PASSWORD | redis | REDIS_PASSWORD. |
CACHE_DB | redis | REDIS_DB. |
CACHE_TLS | redis | false. |
CACHE_INSECURE_SKIP_VERIFY | redis | false; use only in controlled development. |
| None | null | No driver-specific settings. |
Compression and encryption change the persisted value envelope. See Cache before changing them in a mixed-version deployment. The Cache library compares individual driver capabilities.
File Storage
Use STORAGE_<SUFFIX> for the default disk and STORAGE_<NAME>_<SUFFIX> for named disks such as STORAGE_PUBLIC_ROOT.
New Projects render STORAGE_PUBLIC_DRIVER and STORAGE_PUBLIC_ROOT. The demo App also renders STORAGE_FAVICONS_DRIVER and STORAGE_FAVICONS_ROOT. These are ordinary named disks and accept the same named suffixes below.
Common settings:
| Variable | Default | Purpose |
|---|---|---|
STORAGE_SUPPORTED_DRIVERS | Active drivers when unset | Comma-separated drivers compiled into the App. Choices are local, memory, redis, ftp, sftp, s3, gcs, dropbox, rclone. Root key only. |
STORAGE_DRIVER | local | Active driver. |
STORAGE_PREFIX | Empty | Backend object-key prefix. |
Driver settings:
| Variable | Driver | Default or Format |
|---|---|---|
STORAGE_ROOT | local | storage/app/private for the default disk; named disks default to storage/app/<name>, including the rendered public disk. |
| None | memory | No driver-specific settings. |
STORAGE_ADDR | redis | REDIS_HOST:REDIS_PORT. |
STORAGE_USERNAME | redis | Empty. |
STORAGE_PASSWORD | redis | REDIS_PASSWORD. |
STORAGE_DB | redis | 0. |
STORAGE_HOST | ftp | Required host. |
STORAGE_PORT | ftp | 21. |
STORAGE_USER, STORAGE_PASSWORD | ftp | Empty credentials. |
STORAGE_TLS | ftp | false. |
STORAGE_INSECURE_SKIP_VERIFY | ftp | false; use only in controlled development. |
STORAGE_HOST | sftp | Required host. |
STORAGE_PORT | sftp | 22. |
STORAGE_USER | sftp | root. |
STORAGE_PASSWORD | sftp | Empty. |
STORAGE_KEY_PATH | sftp | Empty private-key path. |
STORAGE_KNOWN_HOSTS_PATH | sftp | Empty known-hosts path. |
STORAGE_INSECURE_IGNORE_HOST_KEY | sftp | false; use only in controlled development. |
STORAGE_BUCKET | s3 | Required bucket. |
STORAGE_ENDPOINT | s3 | Empty provider endpoint override. |
STORAGE_REGION | s3 | us-east-1. |
STORAGE_ACCESS_KEY_ID, STORAGE_SECRET_ACCESS_KEY | s3 | Empty credentials. |
STORAGE_USE_PATH_STYLE | s3 | false. |
STORAGE_UNSIGNED_PAYLOAD | s3 | false. |
STORAGE_BUCKET | gcs | Required bucket. |
STORAGE_CREDENTIALS_JSON | gcs | Empty JSON credential string. |
STORAGE_ENDPOINT | gcs | Empty provider endpoint override. |
STORAGE_TOKEN | dropbox | Required access token. |
STORAGE_REMOTE | rclone | Required remote name. |
STORAGE_RCLONE_CONFIG_PATH | rclone | Empty config-file path. |
STORAGE_RCLONE_CONFIG_DATA | rclone | Empty inline config data. |
See File Storage for path and durability guidance and the Storage library for driver capabilities.
Search
Enable search in the owning App. Use bleve for a local, single-process index and meilisearch for an externally managed service. Bleve is always compiled. The Search guide shows how to provision and query an index.
| Variable | Default | Purpose |
|---|---|---|
SEARCH_DRIVER | bleve | Active backend for indexes without a named driver override. |
SEARCH_SUPPORTED_DRIVERS | bleve when rendered; active drivers plus bleve when unset | Root build manifest. Choices are bleve, meilisearch. Add meilisearch before generating and building an App that uses it. |
SEARCH_PATH | storage/search; additional Apps render storage/search/<app> | Root directory for Bleve indexes. Each index defaults to a child directory named after its exact logical name. |
SEARCH_URL | Empty | Required Meilisearch endpoint when that driver is active. The framework does not provision the service. |
SEARCH_API_KEY | Empty | Meilisearch API key. Supply deployment credentials outside committed files. |
SEARCH_PREFIX | Empty | Meilisearch physical index-name prefix. Use distinct prefixes for independently owned App indexes. |
Define index schemas in app/search.go or app/<app>/search.go. Environment variables select backends and locations; they do not declare schemas or create an implicit default index. After declaring a catalog index, its local configuration can be:
SEARCH_DRIVER=bleve
SEARCH_SUPPORTED_DRIVERS=bleve
SEARCH_PATH=storage/search
SEARCH_CATALOG_PATH=storage/search/catalogNamed overrides use SEARCH_<NAME>_DRIVER, SEARCH_<NAME>_PATH, SEARCH_<NAME>_URL, SEARCH_<NAME>_API_KEY, and SEARCH_<NAME>_PREFIX. A named path is the complete physical index path, not a root directory. Driver and remote-service settings inherit root defaults before more-specific named settings apply. SEARCH_SUPPORTED_DRIVERS remains a root build setting.
App overrides use forms such as ADMIN_SEARCH_PATH and ADMIN_SEARCH_CATALOG_URL. Resolution proceeds from global root to App root to global named to App named settings. Index aliases ignore case and replace hyphens with underscores, so catalog-v2 uses SEARCH_CATALOG_V2_*; the logical name and default physical path keep their original spelling. Alias collisions are rejected. Known App prefixes take precedence over ambiguous index prefixes.
Run forj generate --search after changing the build manifest or named index configuration, then forj build. A declared catalog index gets manager.Catalog(). Provision schemas explicitly before first startup; startup validates existing schemas and rejects incompatible definitions. Stop the owner process before provisioning the same Bleve path, and use a separate path or service prefix when rebuilding a schema. See the Search library for the portable index API.
Feature Flags
Enable feature in the owning App. The memory and file sources are both compiled. Each named resource configures an evaluator that can read multiple flags. Follow Feature Flags to load a definition file and check a flag.
| Variable | Default | Purpose |
|---|---|---|
FEATURE_DRIVER | memory | Active source: memory or file. Vendor SDK adapters are not part of this integration. |
FEATURE_SUPPORTED_DRIVERS | memory,file | Root build manifest. Choices are memory, file. |
FEATURE_DOCUMENT | {"schema":1,"flags":{}} | Startup JSON document for a memory source. Optional for tests and small fixtures; an empty source needs no override. |
FEATURE_PATH | Empty | Required definition-file path for a file source. Relative paths resolve from the process working directory. |
FEATURE_INITIALIZATION_TIMEOUT | 5s | Positive Go duration bounding initial source loading. Invalid or unavailable initial configuration fails startup. |
FEATURE_REFRESH_INTERVAL | 30s | Fallback polling and source-read retry interval. Go duration of at least 10ms. Healthy watched files do not poll at this interval. |
For a file-backed checkout evaluator, create the definition file before starting the App and configure:
FEATURE_CHECKOUT_DRIVER=file
FEATURE_CHECKOUT_PATH=storage/flags/checkout.jsonRun forj generate --feature and forj build; the named evaluator is then available through manager.Checkout(). Named settings use FEATURE_<NAME>_DRIVER, FEATURE_<NAME>_DOCUMENT, FEATURE_<NAME>_PATH, FEATURE_<NAME>_INITIALIZATION_TIMEOUT, and FEATURE_<NAME>_REFRESH_INTERVAL. Named evaluators have their own runtime defaults rather than inheriting the default evaluator's settings. FEATURE_SUPPORTED_DRIVERS remains a root build setting.
App overlays use the same names with an App prefix, such as BILLING_FEATURE_CHECKOUT_PATH. Root-declared evaluators are inherited by participating Apps; an evaluator declared only for one App is not initialized by another App.
Flag keys, values, targeting, and rollout rules belong in the definition document. Memory sources start empty by default, and undefined boolean checks return false. File sources refresh through filesystem notifications, with polling when notifications are unavailable. Invalid updates retain the last valid decisions; shutdown stops the file workers. Keep authorization policy separate from flag-controlled presentation or rollout decisions. The Feature library covers standalone SDK drivers.
Events
Use EVENTS_<SUFFIX> for the default bus and EVENTS_<NAME>_<SUFFIX> for named buses.
| Variable | Driver | Default or Format |
|---|---|---|
EVENTS_SUPPORTED_DRIVERS | All | Active drivers when unset. Choices are inproc, null, redis, nats, natsjetstream, kafka, gcppubsub, sns. Root key only. |
EVENTS_DRIVER | All | inproc. |
| None | inproc, null | No driver-specific runtime settings. |
EVENTS_ADDR | redis | REDIS_HOST:REDIS_PORT; authentication uses shared REDIS_PASSWORD and REDIS_DB. |
EVENTS_URL | nats | nats://127.0.0.1:4222. |
EVENTS_URL | natsjetstream | nats://127.0.0.1:4222. |
EVENTS_SUBJECT_PREFIX | natsjetstream | events.. |
EVENTS_STREAM_NAME_PREFIX | natsjetstream | EVENTS_. |
EVENTS_INACTIVE_THRESHOLD_SECONDS | natsjetstream | 30. |
EVENTS_ACK_WAIT_SECONDS | natsjetstream | 30. |
EVENTS_FETCH_MAX_WAIT_MS | natsjetstream | 250. |
EVENTS_STORAGE | natsjetstream | memory. |
EVENTS_BROKERS | kafka | Comma-separated brokers; default 127.0.0.1:9092. |
EVENTS_PROJECT_ID | gcppubsub | Required project ID. |
EVENTS_URI | gcppubsub | Optional emulator or provider URI. |
EVENTS_REGION | sns | us-east-1. |
EVENTS_ENDPOINT | sns | Empty provider endpoint override. |
EVENTS_TOPIC_NAME_PREFIX, EVENTS_QUEUE_NAME_PREFIX | sns | Empty. |
EVENTS_WAIT_TIME_SECONDS | sns | 1. |
EVENTS_VISIBILITY_TIMEOUT_SECONDS | sns | 30. |
See Events for delivery and durability differences. The standalone Events library calls the local driver sync; the framework uses inproc and names its JetStream driver natsjetstream.
Queue
Use QUEUE_<SUFFIX> for the default queue and QUEUE_<NAME>_<SUFFIX> for named queues.
Common settings:
| Variable | Default | Purpose |
|---|---|---|
QUEUE_SUPPORTED_DRIVERS | Active drivers when unset | Comma-separated drivers compiled into the App. Choices are null, sync, workerpool, redis, nats, sqs, rabbitmq, sqlite, postgres, mysql. Root key only. |
QUEUE_DRIVER | workerpool | Active driver. |
QUEUE_WORKERS | 30 | Worker count. Named queues inherit the root value when unset. |
QUEUE_NAME | default; named resources use their resource name | Physical backend queue name before App namespacing. |
QUEUE_DEFAULT_QUEUE | QUEUE_NAME | Compatibility alias for QUEUE_NAME. Prefer QUEUE_NAME. |
QUEUE_SHUTDOWN_TIMEOUT | 10s | Worker drain budget, capped at APP_SHUTDOWN_TIMEOUT. A non-positive value inherits the App budget. |
QUEUE_WORKERPOOL_WORKERS | 30 | Compatibility fallback used only when QUEUE_WORKERS is non-positive. Prefer QUEUE_WORKERS. |
Driver settings:
| Variable | Driver | Default or Format |
|---|---|---|
| None | null, sync, workerpool | No driver-specific runtime settings. |
QUEUE_ADDR | redis | REDIS_HOST:REDIS_PORT. |
QUEUE_PASSWORD | redis | REDIS_PASSWORD. |
QUEUE_DB | redis | REDIS_DB. |
QUEUE_QUEUES | redis | Comma-separated queue=weight map; the configured default queue gets weight 1. |
QUEUE_SERVER_LOG_LEVEL | redis | Backend default; accepted values include debug, info, warn, error, and fatal. |
QUEUE_URL | nats | nats://127.0.0.1:4222. |
QUEUE_REGION | sqs | us-east-1. |
QUEUE_ENDPOINT | sqs | Empty provider endpoint override. |
QUEUE_ACCESS_KEY, QUEUE_SECRET_KEY | sqs | Empty credentials. |
QUEUE_URL | rabbitmq | amqp://guest:[email protected]:5672/. |
QUEUE_DSN | sqlite | Temporary SQLite file per queue. |
QUEUE_DSN | postgres, mysql | Required connection DSN. |
QUEUE_PROCESSING_RECOVERY_GRACE_SECONDS | sqlite, postgres, mysql | 2. |
QUEUE_PROCESSING_LEASE_NO_TIMEOUT_SECONDS | sqlite, postgres, mysql | 300. |
See Queues for selection and dispatch, Queue Workers for lifecycle and scaling, and the Queue library for individual driver capabilities.
Scheduler and Process Shutdown
Configure the scheduler's default timezone through the App timezone.
| Variable | Default | Purpose |
|---|---|---|
SCHEDULER_COMMAND_TIMEOUT | 10m | Maximum runtime for a command launched by a scheduled task. |
SCHEDULER_SUBPROCESS_SHUTDOWN_TIMEOUT | APP_SHUTDOWN_TIMEOUT | Grace period for scheduler-owned subprocesses, capped at the App budget. A non-positive value inherits the App budget. |
QUEUE_SHUTDOWN_TIMEOUT | 10s | Worker drain budget, capped at APP_SHUTDOWN_TIMEOUT. A non-positive value inherits the App budget. |
Mail
Use MAIL_<SUFFIX> for the default mailer and MAIL_<NAME>_<SUFFIX> for named mailers.
| Variable | Driver | Default or Format |
|---|---|---|
MAIL_SUPPORTED_DRIVERS | All | Active drivers when unset. Choices are log, smtp, resend, postmark, mailgun, sendgrid, ses. Root key only. |
MAIL_DRIVER | All | log; rendered Docker projects use smtp. |
MAIL_FROM_ADDRESS | All | [email protected]. |
MAIL_FROM_NAME | All | APP_NAME; the renderer writes the project name. |
MAIL_LOG_BODIES | log | false. |
MAIL_SMTP_HOST | smtp | Required host. Docker projects render mailpit. |
MAIL_SMTP_PORT | smtp | 587; Mailpit projects render 1025. |
MAIL_SMTP_USERNAME, MAIL_SMTP_PASSWORD, MAIL_SMTP_IDENTITY | smtp | Empty. |
MAIL_SMTP_FORCE_TLS | smtp | false. |
MAIL_RESEND_API_KEY | resend | Required API key. |
MAIL_RESEND_ENDPOINT | resend | Provider default. |
MAIL_POSTMARK_SERVER_TOKEN | postmark | Required server token. |
MAIL_POSTMARK_ENDPOINT | postmark | Provider default. |
MAIL_POSTMARK_MESSAGE_STREAM | postmark | Empty. |
MAIL_MAILGUN_DOMAIN, MAIL_MAILGUN_API_KEY | mailgun | Required provider values. |
MAIL_MAILGUN_ENDPOINT | mailgun | Provider default. |
MAIL_SENDGRID_API_KEY | sendgrid | Required API key. |
MAIL_SENDGRID_ENDPOINT | sendgrid | Provider default. |
MAIL_SES_REGION | ses | Empty. |
MAIL_SES_ACCESS_KEY_ID, MAIL_SES_SECRET_ACCESS_KEY, MAIL_SES_SESSION_TOKEN | ses | Empty credentials. |
MAIL_SES_ENDPOINT | ses | AWS SDK default. |
MAIL_SES_CONFIGURATION_SET | ses | Empty. |
See Mail for local delivery and named mailers. The standalone Mail library compares providers and includes an in-memory driver for tests.
Notifications
Enable notification in the owning App. The manager supports synchronous log capture and webhook delivery. Follow Notifications to send an alert and configure delivery or retries.
| Variable | Default | Purpose |
|---|---|---|
NOTIFICATION_DRIVER | log | Active sender: log for redacted local capture or webhook for a configured destination. |
NOTIFICATION_SUPPORTED_DRIVERS | log when rendered; active drivers plus log when unset | Root build manifest. Choices are log, webhook. Include webhook before generating and building an App that uses it. The local log driver remains available. |
NOTIFICATION_WEBHOOK_URL | Empty | Required destination URL when webhook is active. Use a trusted deployment-controlled endpoint. |
NOTIFICATION_WEBHOOK_FORMAT | generic | Payload format: generic or slack. |
NOTIFICATION_WEBHOOK_TIMEOUT | 5s | Positive Go duration for the webhook request timeout. |
NOTIFICATION_WEBHOOK_BEARER_TOKEN | Empty | Optional bearer authentication token. Keep it in the deployment environment or secret manager. |
NOTIFICATION_WEBHOOK_ALLOW_PRIVATE | false | Allow private and loopback destinations when explicitly required by the deployment, such as a local test receiver. |
Keep local capture as the default while adding a named webhook sender:
NOTIFICATION_DRIVER=log
NOTIFICATION_SUPPORTED_DRIVERS=log,webhook
NOTIFICATION_ALERTS_DRIVER=webhook
NOTIFICATION_ALERTS_WEBHOOK_URL=https://hooks.example.com/alertsRun forj generate --notification and forj build; the named sender is then available through manager.Alerts(). Named senders accept NOTIFICATION_<NAME>_DRIVER and every NOTIFICATION_<NAME>_WEBHOOK_* setting above. Each sender has its own runtime defaults; an unset named driver uses log, and a named webhook needs its own URL. NOTIFICATION_SUPPORTED_DRIVERS remains a root build setting.
App overlays include forms such as REPORTS_NOTIFICATION_DRIVER and REPORTS_NOTIFICATION_ALERTS_WEBHOOK_URL. Root-declared named senders are inherited by participating Apps; a sender declared only for one App is not initialized by another App. Changing an active driver already in the build manifest requires configuration and restart; adding a driver requires regeneration and a rebuild.
Successful send completion means local capture or provider acceptance, not confirmed recipient receipt. Construction makes no network requests, and shutdown closes owned transport resources. Use queues for durable deferred work and Mail for email composition. The standalone Notification library supports additional drivers.
Logging
| Variable | Default | Purpose |
|---|---|---|
APP_LOG_FORMAT | console | Output format: console or json. |
APP_LOG_TIME | Disabled; rendered .env enables it | Include timestamps in App logs. Values 0, false, off, and no disable it. |
APP_LOG_CALLER | Disabled | Include caller metadata. Values 0, false, off, and no disable it. |
APP_LOG_DEDUPE_ENABLED | true | Coalesce repeated similar log messages. |
APP_LOG_DEDUPE_WINDOW_MS | 1200 | Dedupe window in milliseconds. |
APP_LOG_DEDUPE_BURST | 2 | Matching messages emitted before suppression begins within a window. |
APP_LOG_DEDUPE_SUMMARY_EVERY | 1000 | Suppressed occurrences between summary messages. |
APP_LOG_REDACT_KEYS | Empty | Comma-separated application-specific field names to redact in addition to mandatory secret-bearing names. |
APP_LOG_REDACT_MESSAGE_PATTERNS | Empty | JSON array of regular expressions replaced with [REDACTED] before output and sink delivery. Invalid JSON or expressions fail during logger construction. |
See Logging for event shape, output modes, and sensitive-data guidance.
Metrics and Runtime Ports
Generated runtime metadata assigns the default App ports 3000, 10000, 10001, and 10002. Each additional app receives the next non-conflicting block.
| Variable | Default App Default | Purpose |
|---|---|---|
METRICS_PORT | 10000 | Shared App metrics port and canonical HTTP metrics port. |
API_METRICS_PORT | METRICS_PORT | Accepted HTTP metrics alias. |
METRICS_API_PORT | METRICS_PORT | Compatibility HTTP metrics alias. |
SCHEDULER_METRICS_PORT | 10001 | Accepted scheduler metrics alias. |
METRICS_SCHEDULER_PORT | 10001 | Canonical generated scheduler metrics port. |
WORKER_METRICS_PORT | 10002 | Accepted worker metrics alias. |
JOBS_METRICS_PORT | 10002 | Accepted jobs metrics alias. |
METRICS_JOBS_PORT | 10002 | Canonical generated jobs metrics port. |
Every port key accepts the <APP>_ overlay. For example, the first additional app can use ADMIN_METRICS_PORT=10010, ADMIN_METRICS_SCHEDULER_PORT=10011, and ADMIN_METRICS_JOBS_PORT=10012.
Framework-owned instrumentation toggles all default to true when their component exists:
| Variable | Surface |
|---|---|
METRICS_HTTP_ENABLED | HTTP requests. |
METRICS_CACHE_ENABLED | Cache operations. |
METRICS_STORAGE_ENABLED | Storage operations. |
METRICS_EVENTS_ENABLED | Event operations. |
METRICS_MAIL_ENABLED | Mail sends. |
METRICS_QUEUE_ENABLED | Queue operations. |
METRICS_DATABASE_ENABLED | Database operations. |
METRICS_AUTH_ENABLED | Auth flows. |
METRICS_SCHEDULER_ENABLED | Scheduler operations. |
METRICS_MONITORING_ENABLED | Monitoring metrics in the demo App. |
See Metrics for endpoints, labels, and scrape topology.
OpenTelemetry
These app-wide settings configure trace and application log export and do not use the named-resource pattern above. New .env files show only the common overrides; add the settings below when you need to change a default. Metrics use the app's Prometheus-compatible endpoints independently.
Local Defaults and Remote Export
Projects with Grafana, Observability, and Docker export traces and logs through Alloy to Tempo and Loki automatically when APP_ENV=local and the grafana Compose profile is active. Host processes use http://127.0.0.1:14318 for HTTP/protobuf or port 14317 for gRPC. Containers use http://alloy:4318 or http://alloy:4317. The host address follows IP_ADDRESS, with wildcard bind addresses resolved to loopback; the published ports follow TEMPO_OTLP_HTTP_PORT and TEMPO_OTLP_GRPC_PORT.
Staging, production, and test processes have no automatic destination. To send traces and logs to an external HTTP/protobuf collector, add:
OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.example.com:4318
OTEL_LOGS_EXPORTER=otlpA generic endpoint enables trace export, but does not enable remote application logs by itself. Logs require OTEL_LOGS_EXPORTER=otlp or a log-specific endpoint. Explicit endpoints override the local receiver for their signal. Set OTEL_TRACES_EXPORTER=none or OTEL_LOGS_EXPORTER=none to disable that signal's export.
Restart the app after changing these settings. Request an HTTP route with access logging enabled, then check the collector for a request span and a request log carrying the same trace ID. Application logs use the active execution's identity when written through appLogger.WithContext(ctx).
Identity and Signal Selection
| Variable | Default | Purpose |
|---|---|---|
OTEL_SERVICE_NAME | Go module path followed by / and the current app name | Service identity shared by traces and logs. |
OTEL_RESOURCE_ATTRIBUTES | Empty | Comma-separated key=value resource attributes, such as service.version=1.2.0,service.namespace=orders. OTEL_SERVICE_NAME takes precedence over a service.name attribute. |
OTEL_TRACES_EXPORTER | otlp when an endpoint or the local Grafana default selects it; otherwise none | Supports otlp and none. Disabling external trace export does not disable Lighthouse inspect capture. |
OTEL_LOGS_EXPORTER | otlp for the local Grafana default or a log-specific endpoint; otherwise none | Supports otlp and none. Explicit otlp enables logs at the configured generic endpoint. Console and Lighthouse log outputs remain independent. |
OTEL_SDK_DISABLED | false | Disable OTel span recording and OTLP log export. Console logging remains available. |
Endpoints, Protocols, and Headers
| Variable | Default | Purpose |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Unset; local Grafana supplies a receiver when eligible | Shared collector base URL. For HTTP/protobuf, exporters append /v1/traces and /v1/logs for enabled signals. |
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | Generic endpoint or local receiver | Trace-specific destination. For HTTP/protobuf, provide the complete URL, including /v1/traces. Setting this endpoint enables traces unless explicitly disabled. |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT | Generic endpoint or local receiver when logs are enabled | Log-specific destination. For HTTP/protobuf, provide the complete URL, including /v1/logs. Setting this endpoint enables logs unless explicitly disabled. |
OTEL_EXPORTER_OTLP_PROTOCOL | http/protobuf | Shared transport: http/protobuf or grpc. |
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL | OTEL_EXPORTER_OTLP_PROTOCOL | Override the trace transport. |
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL | OTEL_EXPORTER_OTLP_PROTOCOL | Override the log transport. |
OTEL_EXPORTER_OTLP_HEADERS | Empty | Comma-separated name=value authentication or collector headers. Percent-encode reserved characters in values, such as Authorization=Bearer%20example-token. |
OTEL_EXPORTER_OTLP_TRACES_HEADERS | OTEL_EXPORTER_OTLP_HEADERS | Replace the generic headers for trace export. |
OTEL_EXPORTER_OTLP_LOGS_HEADERS | OTEL_EXPORTER_OTLP_HEADERS | Replace the generic headers for log export. |
Use absolute http:// or https:// endpoint URLs. For gRPC, use the collector's gRPC port without an HTTP signal path. For example, https://collector.example.com:4317 with OTEL_EXPORTER_OTLP_PROTOCOL=grpc selects gRPC for both enabled signals. Invalid endpoints, headers, exporter selections, and unsupported protocols fail during app construction. Keep credentials in the deployment environment or secret manager, and use HTTPS for remote collectors.
Export Transport Overrides
The Go OTel exporters consume these settings. Each generic variable also accepts a signal-specific form by inserting TRACES_ or LOGS_ after OTEL_EXPORTER_OTLP_. For example, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT overrides OTEL_EXPORTER_OTLP_TIMEOUT for traces. A signal-specific value takes precedence over the generic value for that signal.
| Variable | Default | Purpose |
|---|---|---|
OTEL_EXPORTER_OTLP_TIMEOUT | 10000 | Exporter request timeout in milliseconds. |
OTEL_EXPORTER_OTLP_COMPRESSION | None | Set gzip to compress exported payloads. |
OTEL_EXPORTER_OTLP_CERTIFICATE | System trust roots | Path to a PEM certificate file used to verify the collector's TLS certificate. |
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE | Empty | Path to the client PEM certificate chain for mutual TLS. Configure it with the matching client key. |
OTEL_EXPORTER_OTLP_CLIENT_KEY | Empty | Path to the PEM private key for mutual TLS. |
OTEL_EXPORTER_OTLP_INSECURE | false | Exporter transport-security switch. An explicit endpoint URL's http or https scheme takes precedence; use the URL scheme to select transport security. |
Trace Sampling and Limits
| Variable | Default | Purpose |
|---|---|---|
OTEL_TRACES_SAMPLER | parentbased_always_on when trace export or Lighthouse inspect capture is enabled; otherwise always_off | Head sampler used by the app's trace provider. |
OTEL_TRACES_SAMPLER_ARG | 1.0 | Ratio between 0 and 1, used by traceidratio and parentbased_traceidratio. |
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT | 128 | Maximum attributes per span. |
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT | Unlimited | Maximum string attribute value length on a span. |
OTEL_ATTRIBUTE_COUNT_LIMIT | 128 | Fallback when OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT is unset. |
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT | Unlimited | Fallback when OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT is unset. |
OTEL_SPAN_EVENT_COUNT_LIMIT | 128 | Maximum events retained on a span. |
OTEL_SPAN_LINK_COUNT_LIMIT | 128 | Maximum links retained on a span. |
OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT | 128 | Maximum attributes per span event. |
OTEL_LINK_ATTRIBUTE_COUNT_LIMIT | 128 | Maximum attributes per span link. |
Supported samplers are always_on, always_off, parentbased_always_on, parentbased_always_off, traceidratio, and parentbased_traceidratio. Ratio values outside 0 through 1 and unsupported sampler names fail during app construction. For example, parentbased_traceidratio with an argument of 0.1 samples approximately 10% of new root traces while respecting an incoming parent's sampling decision.
OTel sampling controls span recording for external export and Lighthouse projection. LIGHTHOUSE_INSPECT_SAMPLE_RATE can further reduce Lighthouse detail capture without reducing external export. Log export is independent of trace sampling, so an exported log can refer to an unsampled trace that is absent from the trace backend.
Batch Delivery
Queues are bounded and telemetry delivery is best effort. Trace batches use the SDK defaults below; the framework overrides the log batch size and log batch timeout to 256 records and 5000 milliseconds. Explicit batch environment settings take precedence. All delay and timeout values in this table are milliseconds, not Go duration strings.
| Variable | Default | Purpose |
|---|---|---|
OTEL_BSP_MAX_QUEUE_SIZE | 2048 | Maximum queued spans awaiting export. |
OTEL_BSP_MAX_EXPORT_BATCH_SIZE | 512 | Maximum spans per export batch, bounded by queue capacity. |
OTEL_BSP_SCHEDULE_DELAY | 5000 | Maximum interval between trace batch exports. |
OTEL_BSP_EXPORT_TIMEOUT | 30000 | Trace processor's export deadline. The transport timeout applies separately. |
OTEL_BLRP_MAX_QUEUE_SIZE | 2048 | Maximum queued log records. A full log queue drops its oldest records. |
OTEL_BLRP_MAX_EXPORT_BATCH_SIZE | 256 | Maximum log records per export batch, bounded by queue capacity. |
OTEL_BLRP_SCHEDULE_DELAY | 1000 | Maximum interval between log batch exports. |
OTEL_BLRP_EXPORT_TIMEOUT | 5000 | Log processor's export deadline. The transport timeout applies separately. |
Shutdown flushes telemetry within the app's shutdown context. Collector failures affect telemetry delivery rather than app readiness. Application log contents can be exported; review logged messages and fields before enabling a remote destination. See Logging for application logging and Inspects for bounded Lighthouse capture.
Lighthouse and Inspects
| Variable | Default | Purpose |
|---|---|---|
LIGHTHOUSE_ENABLED | true | Enable Lighthouse runtime integration. |
LIGHTHOUSE_URL | ws://localhost:3000/lighthouse/ws/agent | Lighthouse agent websocket URL. |
LIGHTHOUSE_SECRET | Empty; generated locally | Shared agent/server authentication secret. |
LIGHTHOUSE_DEBUG | Disabled | Enable Lighthouse debug output. |
LIGHTHOUSE_VSCODE_CMD | code | VS Code command used by Lighthouse source links. |
LIGHTHOUSE_GOLAND_CMD | goland | GoLand command used by Lighthouse source links. |
LIGHTHOUSE_INSPECT_ENABLED | false; .env.local sets true | Enable inspect capture. |
LIGHTHOUSE_INSPECT_MAX_TOTAL | 250; .env.local sets 1000 | Maximum retained inspect records. |
LIGHTHOUSE_INSPECT_MAX_INFLIGHT | 100; .env.local sets 250 | Maximum in-flight inspect records. |
LIGHTHOUSE_INSPECT_MAX_EVENTS | 200; .env.local sets 500 | Maximum events recorded per inspect. |
LIGHTHOUSE_INSPECT_SAMPLE_RATE | 1.0 | Capture rate from 0.0 through 1.0. |
LIGHTHOUSE_INSPECT_BUFFER_SIZE | 4096 | Finished-inspect delivery buffer size. |
LIGHTHOUSE_INSPECT_FLUSH_BATCH_SIZE | 100 | Maximum records per Lighthouse delivery batch. |
LIGHTHOUSE_INSPECT_FLUSH_INTERVAL | 1s | Maximum delay between delivery flushes. |
See Lighthouse and Inspects.
Local Observability
These values configure generated local VictoriaMetrics and Grafana infrastructure. Production observability may use different deployment configuration.
| Variable | Default | Purpose |
|---|---|---|
OBSERVABILITY_VM_PORT | 8428 | Published VictoriaMetrics HTTP port. |
GRAFANA_PORT | 13001 | Published Grafana HTTP port. |
GRAFANA_ADMIN_USER | admin | Local Grafana administrator username. |
GRAFANA_ADMIN_PASSWORD | admin | Local Grafana administrator password. Change it before network exposure. |
TEMPO_HTTP_PORT | 13200 | Published Tempo query API port. |
TEMPO_OTLP_HTTP_PORT | 14318 | Published Alloy OTLP HTTP/protobuf receiver port for local traces and logs. |
TEMPO_OTLP_GRPC_PORT | 14317 | Published Alloy OTLP gRPC receiver port for local traces and logs. |
LOKI_HTTP_PORT | 13100 | Published Loki query API port. |
OBSERVABILITY_METRICS_TARGET_MODE | auto, resolved to local-single | Target topology: auto, local-single, local-multi, compose, or disabled. |
OBSERVABILITY_METRICS_TARGET_HOST | host.docker.internal | Host used by local generated scrape targets. An explicitly empty value preserves the existing target file. |
OBSERVABILITY_API_METRICS_HOST | api | HTTP role host in compose mode. Empty omits the role target. |
OBSERVABILITY_JOBS_METRICS_HOST | jobs | Jobs role host in compose mode. Empty omits the role target. |
OBSERVABILITY_SCHEDULER_METRICS_HOST | scheduler | Scheduler role host in compose mode. Empty omits the role target. |
Backups
| Variable | Default | Purpose |
|---|---|---|
BACKUP_PATH | .goforj/backups | Default local backup root. |
APP_BACKUP_DRIVER | local | Backup repository driver: local, s3, or b2-s3. |
APP_BACKUP_S3_BUCKET | Empty | S3-compatible repository bucket. |
APP_BACKUP_S3_ENDPOINT | Empty | S3-compatible endpoint override. |
APP_BACKUP_S3_REGION | Empty | S3-compatible region. |
APP_BACKUP_S3_ACCESS_KEY_ID | Empty | Repository access key. |
APP_BACKUP_S3_SECRET_ACCESS_KEY | Empty | Repository secret key. |
APP_BACKUP_S3_USE_PATH_STYLE | false | Enable path-style S3 addressing. |
APP_BACKUP_S3_PREFIX | Empty | Object prefix for completed backup sets. |
APP_BACKUP_KEEP_DAILY | 14 | Completed sets retained in recent daily buckets when calendar retention is enabled. |
APP_BACKUP_KEEP_WEEKLY | 4 | Completed sets retained in weekly buckets when calendar retention is enabled. |
APP_BACKUP_KEEP_MONTHLY | 6 | Completed sets retained in monthly buckets when calendar retention is enabled. |
S3-backed STORAGE_<NAME>_* resources can be inventoried as backup inputs, but they are separate from the APP_BACKUP_S3_* repository that stores completed backup sets. See Backup and Restore.
Local Services and Docker
| Variable | Default | Purpose |
|---|---|---|
IP_ADDRESS | 0.0.0.0 | Host address used for generated Compose port publishing. |
COMPOSE_PROFILES | Empty | Compose profiles to activate. The renderer uses redis when a local optional Redis service is selected. |
MAILPIT_SMTP_PORT | 1025 | Published Mailpit SMTP port. |
MAILPIT_HTTP_PORT | 8025 | Published Mailpit inbox port. |
DB_MYSQL_PORT | DB_PORT, then 3306 | Published local MySQL port without changing the App connection port. |
DB_POSTGRES_PORT | DB_PORT, then 5432 | Published local Postgres port without changing the App connection port. |
INNODB_BUFFER_POOL_SIZE | 512MB | Build setting for the generated local MariaDB image. |
Generated local services use the App timezone.
Development Service Compose Settings
The optional services in generated docker-compose.yml carry these defaults directly. New projects list the available profile names and COMPOSE_PROFILES in .env, but omit the settings below until you need to override a default. DEV_SERVICE_IP_ADDRESS controls the loopback bind used by the catalog services. Redis, Mailpit, VictoriaMetrics, and Grafana retain the IP_ADDRESS compatibility bind described above.
| Variable | Default | Purpose |
|---|---|---|
DEV_SERVICE_IP_ADDRESS | 127.0.0.1 | Host address used to publish development-service catalog ports. |
RUSTFS_API_PORT | 9000 | Published RustFS S3 API port. |
RUSTFS_CONSOLE_PORT | 9001 | Published RustFS console port. |
RUSTFS_ACCESS_KEY | rustfsadmin | Local RustFS access key. |
RUSTFS_SECRET_KEY | rustfsadmin | Local RustFS secret key. Replace it before network exposure. |
OPENSEARCH_HTTP_PORT | 9200 | Published OpenSearch HTTPS API port. |
OPENSEARCH_ANALYZER_PORT | 9600 | Published OpenSearch analyzer port. |
OPENSEARCH_DASHBOARDS_PORT | 5601 | Published OpenSearch Dashboards port. |
OPENSEARCH_INITIAL_ADMIN_PASSWORD | G0Forj-Local-OpenSearch-2026! | Bootstrap password for a fresh OpenSearch data volume. |
NATS_CLIENT_PORT | 4222 | Published NATS client port. |
NATS_MONITORING_PORT | 8222 | Published NATS monitoring port. |
NATS_USERNAME | goforj | Local NATS username. |
NATS_PASSWORD | goforj | Local NATS password. |
RABBITMQ_AMQP_PORT | 5672 | Published RabbitMQ AMQP port. |
RABBITMQ_MANAGEMENT_PORT | 15672 | Published RabbitMQ management UI port. |
RABBITMQ_USERNAME | goforj | Local RabbitMQ username. |
RABBITMQ_PASSWORD | goforj | Local RabbitMQ password. |
REDPANDA_ADVERTISED_HOST | localhost | Host advertised by Redpanda for published Kafka and HTTP proxy endpoints. |
REDPANDA_SCHEMA_REGISTRY_PORT | 18081 | Published Redpanda schema registry port. |
REDPANDA_PANDAPROXY_PORT | 18082 | Published Redpanda HTTP proxy port. |
REDPANDA_KAFKA_PORT | 19092 | Published Redpanda Kafka port. |
REDPANDA_ADMIN_PORT | 19644 | Published Redpanda admin API port. |
REDPANDA_CONSOLE_PORT | 18080 | Published Redpanda Console port. |
DYNAMODB_PORT | 8000 | Published DynamoDB Local port. |
ELASTICMQ_PORT | 9324 | Published ElasticMQ SQS API port. |
ELASTICMQ_UI_PORT | 9325 | Published ElasticMQ UI port. |
PUBSUB_PORT | 8085 | Published Google Pub/Sub emulator port. |
MEMCACHED_PORT | 11211 | Published Memcached port. |
MEMCACHED_MEMORY_MB | 64 | Memcached memory limit in MiB. |
SFTPGO_SFTP_PORT | 2022 | Published SFTPGo SFTP port. |
SFTPGO_HTTP_PORT | 8081 | Published SFTPGo administration port. |
SFTPGO_ADMIN_USERNAME | goforj | Bootstrap SFTPGo administrator username. |
SFTPGO_ADMIN_PASSWORD | goforj-local | Bootstrap SFTPGo administrator password. |
ADMINER_PORT | 8080 | Published Adminer HTTP port. |
JAEGER_UI_PORT | 16686 | Published Jaeger UI port. |
JAEGER_OTLP_GRPC_PORT | 4317 | Published Jaeger OTLP gRPC port. |
JAEGER_OTLP_HTTP_PORT | 4318 | Published Jaeger OTLP HTTP port. |
QDRANT_HTTP_PORT | 6333 | Published Qdrant HTTP port. |
QDRANT_GRPC_PORT | 6334 | Published Qdrant gRPC port. |
TEMPORAL_GRPC_PORT | 7233 | Published Temporal gRPC port. |
TEMPORAL_UI_PORT | 8233 | Published Temporal UI port. |
KEYCLOAK_HTTP_PORT | 8180 | Published Keycloak HTTP port. |
KEYCLOAK_MEMORY_LIMIT | 1g | Keycloak container memory limit. |
KEYCLOAK_BOOTSTRAP_ADMIN_USERNAME | admin | Bootstrap Keycloak administrator username. |
KEYCLOAK_BOOTSTRAP_ADMIN_PASSWORD | G0Forj-Local-Keycloak! | Bootstrap Keycloak administrator password. |
MOCKSERVER_PORT | 1080 | Published MockServer HTTP port. |
MOCKSERVER_MEMORY_LIMIT | 1g | MockServer container memory limit. |
MOCKSERVER_LOG_LEVEL | INFO | MockServer log level. |
TOXIPROXY_API_PORT | 8474 | Published Toxiproxy control API port. |
TOXIPROXY_PROXY_PORT | 8666 | Published default Toxiproxy listener port. GoForj does not create a proxy automatically. |
TOXIPROXY_LOG_LEVEL | info | Toxiproxy log level. |
CLICKHOUSE_HTTP_PORT | 8123 | Published ClickHouse HTTP port. |
CLICKHOUSE_NATIVE_PORT | 19000 | Published ClickHouse native protocol port. |
CLICKHOUSE_DATABASE | app | Local ClickHouse database. |
CLICKHOUSE_USERNAME | goforj | Local ClickHouse username. |
CLICKHOUSE_PASSWORD | goforj-local | Local ClickHouse password. |
MEILISEARCH_PORT | 7700 | Published Meilisearch HTTP port. |
Forj Developer Tools
| Variable | Default | Purpose |
|---|---|---|
FORJ_APP | app | Select the active App for source-mode commands. Prefer forj <app> <command> in normal workflows. |
FORJ_MAKE_OPEN | auto | Generated-file opening policy: auto, always, or never. |
FORJ_EDITOR | Auto-detected | Editor command for generated files. Supports {file}, {line}, and {location} placeholders. |
FORJ_DEV_PLAIN | Disabled | Use plain forj dev output instead of the interactive terminal UI. |
FORJ_DEBUG | Disabled | Enable additional CLI and generated-console diagnostics. |
FORJ_DEV | Disabled | Show developer and maintainer commands in CLI help. |
FORJ_RENDER_TIMINGS | Disabled | Print render timing summaries. |
FORJ_RENDER_DEBUG_TIMINGS | Disabled | Print detailed render timing diagnostics. |
FORJ_BUILD_PROFILE_LOG | Empty | File path for compile profile records written by profiled builds. |
FORJ_COMMAND_*, FORJ_SUBPROCESS, FORJ_NATIVE_COMMAND_NAMES, FORJ_MULTI_APP_HELP, and FORJ_BUILD_PROGRESS are reserved process-handoff variables. Do not set them in App configuration.
See Make Command Shared Options and forj dev.
Demo App
These controls exist only when the demo monitoring and Lighthouse benchmark surfaces are rendered.
| Variable | Default | Purpose |
|---|---|---|
MONITOR_POLL_INTERVAL_SECONDS | 30 | Demo monitor polling schedule interval. |
BENCHMARK_HTTP_URL | APP_URL, then http://localhost:3000 | Base URL for the Lighthouse HTTP benchmark. |
BENCHMARK_HTTP_PATH | /-/health | Request path for the Lighthouse HTTP benchmark. |
BENCHMARK_QUEUE_PREFILL_COUNT | 100000 | Queue jobs prepared for a benchmark run. |
BENCHMARK_QUEUE_DRAIN_TIMEOUT_MS | Derived from run duration, bounded from 45 seconds to 3 minutes | Queue benchmark drain timeout in milliseconds. |
Standalone Library Diagnostics
| Variable | Purpose |
|---|---|
HTTP_TRACE | Enables httpx request and response dump output for clients created with httpx.New() when the variable is present. Treat output as sensitive. |