# Model Manager Self-hosted web UI for downloading and managing local LLMs from Hugging Face. Downloads are done by the official `hf` CLI; the Hub API is used for metadata. ## Architecture - **web** (`next dev` / `next start`): Next.js App Router UI + API routes, OIDC login via Auth.js. - **worker** (`src/worker`): owns the job queue, spawns `hf download`, tracks progress, runs update checks. Applies DB migrations at startup. - They talk only through the SQLite database (`DATABASE_URL`). ## Local development ```bash cp .env.example .env # then fill in OIDC_* and AUTH_SECRET; use local paths, e.g. # DATABASE_URL=file:./data/app.db, MODELS_DIR=./data/models, AUTH_URL=http://localhost:3000 npm install npm run dev # starts web (http://localhost:3000) and worker together ``` OIDC redirect URI for the client in Pocket ID: `/api/auth/callback/pocket-id`. Other scripts: | Script | What it does | | --- | --- | | `npm run dev:web` / `npm run dev:worker` | run one side only | | `npm run db:generate` | create a migration after changing `src/lib/db/schema.ts` | | `npm run db:migrate` | apply migrations without starting the worker | | `npm run typecheck`, `npm run lint` | checks |