Install Sugar#
Before you start#
- Node.js 20.9 or newer and npm.
- Git.
- Authorised access to the private Sugar source repository.
- A writable private directory for persistent data.
- At least one supported provider credential or reachable Local Ollama service.
Obtain an authorised checkout from the maintainer, then run from its root:
npm ci
cp .env.example .env.local
On PowerShell use Copy-Item .env.example .env.local.
Set a final local URL, a long private bootstrap code, an independent auth secret, a persistent data directory and a stable 32-byte credential-encryption key encoded as 64 hexadecimal characters.
Managed providers read their API key from a documented environment variable. Self-hosted providers such as Local Ollama read none: configure their endpoint and credential on the Providers page after the service is running.
Generate the encryption key once:
node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"
Start Sugar:
npm run dev
The development server binds to loopback on port 3211 by default.
Verify#
Open http://localhost:3211/login. Confirm the service is reachable only from
the intended machine, create the owner through the private bootstrap flow, then
check /api/health. It can report not ready until a provider lane is configured.
To exercise the whole path without a provider key, run npm run build first and
then npm run smoke, or use SMOKE_MODE=dev npm run smoke to skip the build. It
starts an isolated Sugar instance and a fake upstream, then walks bootstrap,
provider setup, model exposure, key issue, buffered and streamed completions,
usage and quota, and exits non-zero at the first failed step. Set SMOKE_PORT
and SMOKE_UPSTREAM_PORT above 3050 if those ports are in use.
If it does not work#
| Symptom | Check | Recovery |
|---|---|---|
The service starts but health returns 503 |
What readiness names as missing | See Health returns 503 |
| It refuses to start on a missing key | Whether the credential key is set | Provider credentials cannot be decrypted without it; do not generate a new one over an existing store |
| The port is already in use | What holds it | Local development defaults to 3211 and the launcher refuses the suite-reserved range |
| Configuration does not persist across a restart | Whether the data directory is writable and outside the release tree | See Configuration |