Awwwth Docs

Awwwth / Server configuration

Configuration

Back to README

Direct execution uses the variables below. Start with .env.example. Docker production settings are supplied through oci.env.example and mapped by compose.oci.yml.

Application settings

VariableDefault when omittedMeaning
NODE_ENVProduction mode is offExactly production enables HTTPS validation and secure cookies
HOST127.0.0.1Listening interface; Compose uses 0.0.0.0 inside the container
PORT4100Integer from 1 through 65535
AUTH_ORIGINhttp://localhost:4100Browser origin and OIDC issuer
AUTH_API_ORIGINAUTH_ORIGINAdvertised server-side OAuth endpoint origin
AUTH_BACKENDnativeSet keycloak to delegate credentials and sign-in
KEYCLOAK_ISSUERRequired for KeycloakPublic realm URL, such as https://auth.example.com/realms/techinject
KEYCLOAK_BACKCHANNEL_URLKEYCLOAK_ISSUERPrivate realm URL for token, key, introspection and same-domain form requests; required on a separate origin when the public issuer uses AUTH_ORIGIN. Production requires HTTPS
KEYCLOAK_CLIENT_IDRequired for KeycloakConfidential OIDC broker client
KEYCLOAK_CLIENT_SECRETRequired for KeycloakBackend-only secret, distinct from downstream app credentials
DATABASE_URLRequiredPostgreSQL connection URL
ENCRYPTION_KEYRequiredCanonical base64url encoding of 32 random bytes
SIGNING_KEY_PATH.local/signing.pemPath to an Ed25519 private key in PEM format
MAIL_MODEspoolspool, sendmail, or resend
MAIL_FROMAwwwth <accounts@example.com>Sender address; replace for actual delivery
RESEND_API_KEYEmptyRequired when mail mode is resend
SENDMAIL_PATH/usr/sbin/sendmailExecutable used by sendmail mode
TRUSTED_PROXY_IPEmptyExact peer IP allowed to provide a valid X-Real-IP

Origins must be canonical origins without a path, query, or trailing slash; for example, https://auth.example.com. Both origins must use HTTPS in production. Production rejects spool mode. Resend mode rejects a missing API key or an example.com sender.

The setup script defaults to .local/keys, while the configuration fallback for the signing key is .local/signing.pem. Set SIGNING_KEY_PATH=.local/keys/signing.pem, as the example environment does. AWWWTH_SECRET_DIRECTORY changes the setup script's output directory only.

Keys and persistence

bun run setup creates encryption.key and signing.pem only when missing, using restricted file permissions. The encryption key protects TOTP secrets, queued email bodies, authorization request data, and Keycloak tokens and PKCE verifiers. The signing key signs ID and logout tokens; its public key is exposed through /oauth/jwks.

Compose stores both files in secret_data and reads the encryption key into the app environment at startup. Back up these keys together with the database. There is no automated key rotation or multi-key migration workflow in this repository; replacing the encryption key makes existing encrypted data unreadable.

Browser and API origins

AUTH_API_ORIGIN changes discovery metadata, not the application's accepted Host header. The service still validates incoming requests against AUTH_ORIGIN. If the API has a separate public hostname, its reverse proxy must forward the issuer hostname upstream. See the Nginx template.

Account APIs are same-origin cookie APIs. The public /awwwth.js module permits cross-origin loading; that does not enable cross-origin calls to account or token APIs.

Email

ModeBehavior
spoolWrites private .eml files under .local/mail; development only
resendSends through Resend with a delivery ID as the idempotency key
sendmailInvokes SENDMAIL_PATH -t -i; requires an installed executable and working relay

The provided OCI override requires DOCKER_RESEND_API_KEY even if DOCKER_MAIL_MODE is changed. A sendmail deployment needs an adapted image/configuration and Compose override; changing the mode alone does not install a relay.

Tracing

VariablePurpose
OTEL_SERVICE_NAMEService name; application fallback is awwwth-auth
OTEL_EXPORTER_OTLP_ENDPOINTOTLP/HTTP exporter base endpoint; leave empty to disable export
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTOptional trace-specific endpoint recognized by direct execution
OTEL_EXPORTER_OTLP_HEADERSExporter authentication headers
OTEL_RESOURCE_ATTRIBUTESResource metadata such as deployment environment
OTEL_TRACES_SAMPLERSampler selection; example uses parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARGSampling argument; example uses 1
OTEL_SDK_DISABLEDExactly true disables telemetry

The supplied Compose file passes the common variables listed in .env.example; add an override to pass the trace-specific endpoint or SDK-disable flag. Request traces normalize unknown URL segments to :id and omit /healthz. A separate SigNoz configuration is in observability/casting.yaml.