2.1 KiB
Architecture
Nuxt 3 app, Nitro node-server, Vue 3. Production image is node:22.23.4-alpine with ffmpeg added in the runner stage. The container listens on port 3000 and reads the library from LIBRARY_DIR (default /data/library).
Library
server/utils/library.ts stores one catalog per owner under users/<owner>/. The owner key is a hash of the session identity, or a single private-instance id when password auth is on. Catalog writes are serialized per owner and written to a temp file, then renamed.
deleteStill, deleteStillFamily, and wipeFolderContents update the catalog even if rmSync fails. After those writes, pruneMissingStillMasters drops any remaining still whose master file is gone. publicLibrary and publicLibraryPage run that prune before they return rows or folder counts.
Studio 2 reads a paged /api/library list. After a delete it refetches that list and clears form slots that pointed at the deleted id.
Auth
server/middleware/auth.ts allows a fixed set of paths with case-sensitive prefixes (/api/auth/login, /api/health, /login, and the other listed public paths). Every other /api/ path without a session returns 401. Other pages redirect to login. Cache headers for /api/generate/ and /api/prompt/ are set in server/middleware/cache-headers.ts, not Nitro routeRules.
LoRAs
Comfy returns relative paths under models/loras/. server/utils/loras.ts caches that list and ?fresh=1 forces a live object-info scan so new files appear without a restart. Matching lives in utils/loras.ts.
A path segment xaigen or xiagen is xAIGen-only. A path segment aigen is visible on AIGen. The directory immediately under that segment is the engine (flux, krea, moss, and minimax, ltx, or qwen when present). Filename tokens such as krea-something.safetensors still match when the file has not been moved. The value stored on a stack is the Comfy-relative path.
Generation
Studio 2 jobs are built in server/utils/studio2/ and sent to the configured Comfy host. Klein, Krea, MOSS, MiniMax, and LTX graph construction is separate from library delete and from LoRA folder matching.