YACS

Configuration

The API reads configuration from environment variables. In development it also loads a .env file from the repository root; real environment variables take precedence. In Docker, pass them to the container.

App

VariableDefaultDescription
APP_KEY— requiredSecret used to sign session tokens and derive encryption keys. Generate with openssl rand -base64 48.
NODE_ENVdevelopmentdevelopment or production. The Docker image sets production.
PORT3000HTTP port.
APP_URL—Public URL, e.g. https://chat.example.com. When set, push notifications are also sent in the declarative Web Push format.
VAPID_SUBJECTAPP_URL, then mailto:admin@localhostContact for push services. Must be a mailto: or https: URL.
TRUST_PROXYtrueTrust X-Forwarded-* headers from a reverse proxy.

Storage

VariableDefaultDescription
DB_URLmongodb://127.0.0.1/yacsMongoDB connection string.
CACHE_URLredis://localhostRedis connection string.
MEDIA_URLfile://./public/mediaWhere uploaded media is stored. Only file:// is supported; relative paths resolve from the repository root.

Sign-in and sessions

VariableDefaultDescription
GOOGLE_AUTH_CLIENT—Google OAuth web client ID. Empty disables Google sign-in.
COOKIE_SECUREfalseMark the session cookie Secure. Set to true behind HTTPS.
SESSION_DAYS30Session lifetime.
GUEST_RETENTION_DAYS30Guest accounts inactive for this long are deleted.

Nearby discovery

VariableDefaultDescription
DISCOVER_TTL_DAYS14Discovery switches off this many days after a user last refreshed their location.

Calls (TURN)

VariableDefaultDescription
TURN_URLS—Comma-separated TURN URLs, e.g. turn:turn.example.com:3478,turns:turn.example.com:5349.
TURN_SECRET—Shared secret configured on the TURN server (coturn static-auth-secret).
TURN_TTL_SECONDS86400Lifetime of generated TURN credentials.

Limits

VariableDefaultDescription
RATE_LIMIT_ENABLEDtrueEnable API rate limiting (backed by Redis).
RATE_LIMIT_MAX100Requests allowed per window.
RATE_LIMIT_WINDOW_SECONDS60Window length.
MAX_IMAGE_KB10240Maximum uploaded image size in KB. Larger uploads get 413.

Some limits are fixed in @yacs/dto/limits and shared by client and server:

LimitValue
Display name60 chars
About500 chars
Group name100 chars
Reply quote500 chars
Label length / count30 chars / 20 labels
Envelope size64 KB
Image dimension2560 px

Logging

VariableDefaultDescription
LOG_LEVELinfotrace, debug, info, warn, error or fatal.
LOG_PRETTYtrue in development, else falseHuman-readable logs instead of JSON (pino).