The app is plain SvelteKit with npm; there is no monorepo, no Bun requirement, and no database to provision.
Toolchain
| Requirement | Value | Why |
|---|---|---|
| Node.js | 22.23.1, the verified host version | Use a version supported by every locked dependency; “any version ≥22” incorrectly includes unsupported early 22.x and odd majors |
| Package manager | npm with the committed package-lock.json | keep one lockfile |
| Vite | ^8 | @sveltejs/vite-plugin-svelte@7.3.0 needs peer vite ^8; vite@7 fails with ERESOLVE |
| SvelteKit plugin import | import { sveltekit } from '@sveltejs/kit/vite' | the export was removed from @sveltejs/vite-plugin-svelte |
| Sanitizer | isomorphic-dompurify | bare dompurify throws sanitize is not a function under SSR |
Build and run
From the project root (~/dev/svelte-chat on the host):
npm ci
npm run build # vite build → build-dev/ unless BUILD_OUT is set
node build-dev/index.js # adapter-node entry; honours PORT, HOST and DATA_DIRFor development, npx vite --host 127.0.0.1 --port 4319 serves with HMR; npx vite preview serves the last build. Production uses scripts/deploy.sh, described in Operations (sign-in required).
Assistant environment
The assistant activates only when an upstream is configured. Without it /api/status reports assistant.configured=false, @ai messages produce a system message saying no model is configured, and the UI shows “Assistant offline”.
| Variable | Meaning |
|---|---|
CHAT_MODEL_URL | Base URL of an OpenAI-compatible API (for example a local …/v1) |
CHAT_MODEL | Model identifier sent to that endpoint |
CHAT_MODEL_KEY | Optional bearer credential; never committed, never copied between hosts |
The host unit loads the optional /etc/chat/chat.env environment file. An operator authorized to configure an upstream must supply both CHAT_MODEL_URL and CHAT_MODEL, plus a credential only if that upstream requires one, and restart the service so the process receives the environment. Merely creating an empty file does not enable the assistant. No key is stored in the repository or in this wiki; the D-181 work does not provision or change an upstream.
Data directory
DATA_DIR (~/chat on the host) holds rooms/<slug>/ containing append-only event logs, room metadata, participant and read-cursor state, and attachment staging/uploads. A complete data backup must include this directory and its attachments; coordinate the snapshot or copy with writers to obtain a consistent recovery point. The service needs write access to this data directory and nothing else outside its build.
Related
- Architecture for the routes this build exposes.
- Research for the pinned versions and security floor behind the toolchain table.