Backend Initialization and Configuration
config/loadEnv.js loads the environment; config/drive.js normalizes values and paths and validates combinations. createApp() loads credentials, validates the environment, and prepares the library before exposing routes.
server.js starts HTTP, maintenance tasks, and a watcher, and handles graceful shutdowns. Refer to the Server .env.example for the full list.
Critical Points
Section titled โCritical PointsโDATABASE_URLis required and must point to PostgreSQL;REDIS_URLis required whenREDIS_ENABLED=true; Redis is a cache, not a source of truth;- in Compose,
DOCKER_DATABASE_URLandDOCKER_REDIS_URLreplace internal services; keep them empty to usepostgresandredisfrom the Docker network; LOCAL_LIBRARY_DIRand the cache need appropriate permissions;- the library can be read-only;
- Drive can be disabled without preventing local catalog access;
TRUST_PROXYshould reflect the topology;- rate limiting is disabled by default; enable it with
RATE_LIMIT_ENABLED=trueand adjustRATE_LIMIT_WINDOW_MSandAPI_RATE_LIMIT_PER_MINUTEas needed for API exposure; - CORS uses either an exact origin or the same-host provided by the proxy;
- secrets and tokens should never appear in logs/documentation.
The supported runtime is Node.js 22+. Initialization fails early if PostgreSQL is not configured or accessible.
