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 or newer (the host runs v22.23.1) | isomorphic-dompurify, Vite 8 and the Svelte plugin all pin recent engines |
| 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/
node build # 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 Deploy and roll back.
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 |
On the host the service reads them from /etc/chat/chat.env (root-owned, mode 0640, EnvironmentFile in the unit). That file is absent in the current deployment; creating it is the only step to enable the assistant. No key is stored in the repository or in this wiki.
Data directory
DATA_DIR (~/chat on the host) holds rooms/<slug>/events.jsonl and rooms/<slug>/room.json per room, both append-only or write-once. Copying the directory is a complete backup; the service needs write access to it 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.