Skip to content

Configuration reference

Araru runs from separate repositories. Configure araru-server and araru-web independently; they do not need a shared working directory.

Terminal window
cd araru-server
cp .env.example .env
npm ci
npm run migrate
npm run dev

In a second terminal:

Terminal window
cd araru-web
cp .env.example .env
npm ci
npm run dev

The server reads .env from its repository root. Relative paths are resolved from that root. The complete, source-of-truth list of names is araru-server/.env.example.

NODE_ENV=development
PORT=3001
DATABASE_URL=postgres://araru:password@localhost:5432/araru
REDIS_ENABLED=true
REDIS_URL=redis://localhost:6379
FRONTEND_URL=http://localhost:5173
PUBLIC_BACKEND_URL=http://localhost:3001
ALLOWED_ORIGINS=http://localhost:5173
APP_ACCESS_SECRET=replace-with-a-long-random-secret

PostgreSQL is the source of truth for catalog, users, reading state, and provider metadata. Redis is optional cache/coordination and must not be treated as durable data.

VariableDefaultDescription
NODE_ENVdevelopmentRuntime mode.
PORT3001HTTP port.
DATABASE_URL—PostgreSQL URL; required for normal operation.
DATABASE_SSLfalsePostgreSQL TLS.
DATABASE_POOL_MAX10Maximum database pool size.
DATABASE_IDLE_TIMEOUT_MS30000Idle connection timeout.
DATABASE_CONNECTION_TIMEOUT_MS5000Connection timeout.
REDIS_ENABLEDtrueEnable Redis.
REDIS_URL—Redis URL when enabled.
REDIS_KEY_PREFIXararu:Redis key namespace.
FRONTEND_URLhttp://localhost:5173Canonical frontend URL.
PUBLIC_BACKEND_URLhttp://localhost:<PORT>Public API URL for generated links.
ALLOWED_ORIGINSFRONTEND_URLExact comma-separated CORS origins.
VariableDefaultDescription
DATA_DIRstoragePersistent server data directory.
LOCAL_LIBRARY_DIRstorage/pdfsLocal library directory.
COVER_CACHE_DIRstorage/cache/coversRegenerable cover cache.
DRIVE_FOLDERS_CONFIGstorage/drive-folders.jsonDrive folder/category mapping.
MANUAL_CATEGORIAS_PATHstorage/categorias.jsonManual metadata overrides.
LOCAL_FILES_ROUTE/arquivosLocal resource route prefix.
LIBRARY_WATCH_ENABLEDtrueWatch local library changes.
LIBRARY_WATCH_DEBOUNCE_MS1200Watcher debounce.
JOBS_ENABLEDtrueEnable scheduled jobs.
CATALOG_REFRESH_INTERVAL_MINUTES60Catalog refresh interval.
MAINTENANCE_INTERVAL_MINUTES1440Maintenance interval.
CATALOG_MISSING_RETENTION_DAYS30Missing-row retention.
VariableDefaultDescription
ENABLE_GOOGLE_DRIVEtrueEnable Drive integration.
GOOGLE_API_KEYemptyPublic-resource/API-key access.
GOOGLE_CLIENT_IDemptyOAuth client ID.
GOOGLE_CLIENT_SECRETemptyOAuth client secret.
GOOGLE_REDIRECT_URIhttp://localhost:3001/api/v1/auth/callbackOAuth callback URL.
DRIVE_FOLDER_IDemptyRoot folder to index.
DRIVE_REQUEST_TIMEOUT15000Request timeout in milliseconds.
DRIVE_CONCURRENCY6Concurrent Drive operations.

See the storage guide for OAuth setup, folder mapping, synchronization, and limitations.

VariableDefaultDescription
TRUST_PROXYfalseTrust forwarded headers only behind a trusted proxy.
RATE_LIMIT_ENABLEDfalseEnable API rate limiting.
RATE_LIMIT_WINDOW_MS60000Rate-limit window.
API_RATE_LIMIT_PER_MINUTE300Requests per window.
APP_ACCESS_SECRETemptyLong random secret for sessions/OAuth state.
ACCESS_SESSION_SECONDS86400Session lifetime.
SECURE_COOKIESfalseSet true over HTTPS.
COOKIE_SAME_SITElaxlax, strict, or none; none requires secure cookies.
LOG_LEVELinfoerror, warn, info, or debug.
USE_MOCK_DATAfalseDevelopment-only mock mode.
VariableDescription
VITE_API_URL/api for same-origin, or an absolute API URL.
VITE_DEV_PROXY_TARGETBackend target for the Vite development proxy.
VITE_ALLOWED_HOSTSAllowed LAN/tunnel development hosts.

Only VITE_* values reach the browser. Never put database passwords, OAuth secrets, or R2 secret keys in the Web environment file.

  • Use NODE_ENV=production, HTTPS, SECURE_COOKIES=true, exact ALLOWED_ORIGINS, and a long random APP_ACCESS_SECRET.
  • Enable rate limiting when the API is reachable from the Internet.
  • Keep R2 private and issue signed URLs from the server when direct delivery is needed.
  • Mount DATA_DIR, PostgreSQL data, and the original library on durable storage.
  • Do not expose /health/details or administrative routes without authentication.
  • Do not log environment objects, access tokens, signed URLs, or request authorization headers.