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
| Variable | Default | Description |
|---|
APP_KEY | — required | Secret used to sign session tokens and derive encryption keys. Generate with openssl rand -base64 48. |
NODE_ENV | development | development or production. The Docker image sets production. |
PORT | 3000 | HTTP 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_SUBJECT | APP_URL, then mailto:admin@localhost | Contact for push services. Must be a mailto: or https: URL. |
TRUST_PROXY | true | Trust X-Forwarded-* headers from a reverse proxy. |
Storage
| Variable | Default | Description |
|---|
DB_URL | mongodb://127.0.0.1/yacs | MongoDB connection string. |
CACHE_URL | redis://localhost | Redis connection string. |
MEDIA_URL | file://./public/media | Where uploaded media is stored. Only file:// is supported; relative paths resolve from the repository root. |
Sign-in and sessions
| Variable | Default | Description |
|---|
GOOGLE_AUTH_CLIENT | — | Google OAuth web client ID. Empty disables Google sign-in. |
COOKIE_SECURE | false | Mark the session cookie Secure. Set to true behind HTTPS. |
SESSION_DAYS | 30 | Session lifetime. |
GUEST_RETENTION_DAYS | 30 | Guest accounts inactive for this long are deleted. |
Nearby discovery
| Variable | Default | Description |
|---|
DISCOVER_TTL_DAYS | 14 | Discovery switches off this many days after a user last refreshed their location. |
Calls (TURN)
| Variable | Default | Description |
|---|
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_SECONDS | 86400 | Lifetime of generated TURN credentials. |
Limits
| Variable | Default | Description |
|---|
RATE_LIMIT_ENABLED | true | Enable API rate limiting (backed by Redis). |
RATE_LIMIT_MAX | 100 | Requests allowed per window. |
RATE_LIMIT_WINDOW_SECONDS | 60 | Window length. |
MAX_IMAGE_KB | 10240 | Maximum uploaded image size in KB. Larger uploads get 413. |
Some limits are fixed in @yacs/dto/limits and shared by client and server:
| Limit | Value |
|---|
| Display name | 60 chars |
| About | 500 chars |
| Group name | 100 chars |
| Reply quote | 500 chars |
| Label length / count | 30 chars / 20 labels |
| Envelope size | 64 KB |
| Image dimension | 2560 px |
Logging
| Variable | Default | Description |
|---|
LOG_LEVEL | info | trace, debug, info, warn, error or fatal. |
LOG_PRETTY | true in development, else false | Human-readable logs instead of JSON (pino). |