Install & run (local)
Purpose
Stand up VibeSwitch on a developer workstation and confirm every major surface works: the Fastify API, the Vite-served React UI, Swagger, the in-app Docs panel, and at least one ingestion command. This guide assumes you've read the Quickstart; it goes deeper into the moving parts, options, and things that usually trip people up.
Prerequisites
- Required: Node.js 20+ and npm 10+.
- Required: A bash-compatible shell (macOS Terminal, Linux, WSL, Git Bash).
- Required:
git, and a local clone of the repo. - Optional:
ffmpegonPATH— only needed for Audio ingestion. - Optional: a Google Cloud project if you plan to enable auth locally.
Inputs
- Root
.env(for the server):NEWSAPI_API_KEY(required for news ingestion)ANTHROPIC_API_KEY(required for signal extraction and narratives)OPENAI_API_KEY(required only for audio transcription)AUTH_REQUIRED=false(recommended for local dev unless you're testing auth)SQLITE_PATH(optional — defaults to a path under the repo)
client/.env.local(only if you're enabling auth):VITE_FIREBASE_API_KEY,VITE_FIREBASE_AUTH_DOMAIN,VITE_FIREBASE_PROJECT_ID
Outputs
- API running: Fastify on
http://localhost:3000serving/api/*and the built SPA (if present). - UI running (dev mode): Vite on
http://localhost:5173with live reload and an/apiproxy to:3000. - Swagger UI:
http://localhost:3000/api/swagger. - Docs index:
http://localhost:3000/api/docs/indexreturns a non-empty JSON array. - SQLite DB: a file created on first write (default inside the repo unless
SQLITE_PATHoverrides).
Constraints
- Never commit
.envorclient/.env.local. These are in.gitignore— keep them there. VITE_*is build-time only. In dev, Vite re-reads it when you restartnpm run client:dev. In production, you must rebuild the client after changing anyVITE_*value.- Auth off by default is deliberate. Local dev is faster without JWT verification. Turn it on only when you're specifically testing auth flows.
- One SQLite file, one writer. Don't share
SQLITE_PATHacross two running servers on the same machine — SQLite's locking is process-local and you'll see sporadicSQLITE_BUSYerrors.
Examples
Clone and install
git clone <your-fork-url> news
cd news
npm install
cd client && npm install
Expected: two install cycles complete without error. The second one runs inside client/.
Minimum .env for local dev
Create ./.env in the repo root:
NEWSAPI_API_KEY=your_newsapi_key
ANTHROPIC_API_KEY=sk-ant-...
AUTH_REQUIRED=false
Expected: the server starts and accepts API calls without a Bearer token.
Start the API
npm run start
Expected: server starts and logs a line like Server listening on http://0.0.0.0:3000. Keep this terminal open.
Start the UI (second terminal)
npm run client:dev
Expected: Vite prints Local: http://localhost:5173/. Open that URL in a browser. The header should read Vibes Witch — Home Front Command · Daily Assessment.
Verify Swagger and OpenAPI
curl -sS http://localhost:3000/api/openapi.json | head -n 5
Expected: JSON starting with { and containing an "openapi" field near the top.
Open Swagger UI: http://localhost:3000/api/swagger.
Verify the in-app Docs endpoint
curl -sS http://localhost:3000/api/docs/index | head -c 200
Expected: JSON with a pages array containing this page and every other product doc.
Run your first ingestion
npm run homefront-to-md
Expected: a dated markdown file appears under business_modules/news-sites/articles_extracted/.
Tail server logs
The server logs to stdout. Pipe or redirect as needed:
npm run start 2>&1 | tee server.log
Expected: startup lines, then one log line per request. Errors include a stack trace.
Troubleshooting
- UI loads but API requests fail with 502/CORS
- Check: the API server is running on
:3000and the Vite proxy is intact. - Fix: verify
client/vite.config.jsproxies/api→http://localhost:3000. Restart both servers.
- Check: the API server is running on
- Server fails with "API key is required"
- Check: root
.envcontainsNEWSAPI_API_KEYand the server was restarted after adding it. - Fix: set the key and restart. dotenv reads
.envonly at startup.
- Check: root
- Every
/api/*returns 401- Check:
AUTH_REQUIRED=truein.env. - Fix: set it to
falsefor local dev, or finish the flow in Auth setup.
- Check:
Cannot find moduleerrors- Check: you ran
npm installin both the root andclient/. - Fix: run both installs again. Delete
node_modulesand retry if needed — never edit lockfiles by hand.
- Check: you ran
- Port 3000 or 5173 already in use
- Check:
lsof -i :3000(or:5173) to see what's holding it. - Fix: kill the other process, or set
PORT=3001 npm run startand update the Vite proxy.
- Check:
- SQLite errors on write
- Check:
SQLITE_PATHpoints to a writable directory. - Fix: ensure the parent directory exists and the process user has write permission.
- Check:
- Docs panel in the app says "failed to load"
- Check:
curl http://localhost:3000/api/docs/indexdirectly. - Fix: if that works, the UI has a stale proxy — hard-reload the page. If it doesn't, server is not serving
product_docs/correctly; see Observability.
- Check: