AuthConfig

The Auth constructor takes a partial AuthConfig. Options are deep-merged over defaults. The hosted service and the template expose these as environment variables.

Session

OptionDefaultDescription
session.expiresIn7 daysAccess token lifetime
session.idleTimeout4 hoursSession expires after inactivity
session.absoluteLifetime30 daysHard ceiling on session lifetime
session.maxConcurrentSessions10Oldest sessions are revoked beyond this

Rate limiting

OptionDefaultDescription
rateLimit.maxAttempts10Sign-in attempts before throttling
rateLimit.windowMs15 minutesRate limit window

Captcha

OptionDescription
captcha.providernone, hcaptcha, or turnstile
captcha.siteKeyPublic widget key
captcha.secretServer-side verification secret

Captcha providers

ProviderSupportedNotes
hCaptchaDefault. Has a known Safari/WebKit issue where api.hcaptcha.com/authenticate returns 401 due to third-party storage isolation.
TurnstileRecommended for Safari-heavy deployments. No known WebKit incompatibility.

RBAC

Permissions are strings in the form resource:action (for example admin:panel). Users carry a role and a permission list. Defaults for roles can be set in config.rbac. The admin role bypasses permission checks.

Environment variables

Used by the hosted service and the fullstack template. See .env.example in the repository for the complete list.

VariablePurpose
DATABASE_URLPostgres connection string
CAPTCHA_PROVIDERCaptcha provider (none disables)
HCAPTCHA_SITE_KEY, CAPTCHA_SECREThCaptcha keys
TURNSTILE_SITE_KEY, TURNSTILE_SECRETTurnstile keys
SESSION_EXPIRES_IN and friendsSession lifetimes in milliseconds
RATE_LIMIT_MAX_ATTEMPTS, RATE_LIMIT_WINDOW_MSRate limits
RESEND_API_KEY, RESEND_FROMPassword-reset email
ALLOWED_ORIGINCORS origin
PUBLIC_BASE_URLBase URL used in generated links

Sensitive values are always injected through environment variables or configuration. They are never hardcoded or committed.