Skip to content

Running Locally

Michael Marras edited this page Jun 7, 2026 · 1 revision

Ingest Worker

Prerequisites: Node.js 20+, npm 10+

Install

cd workers/ingest
npm install

Apply migrations locally

wrangler d1 migrations apply watchtower --local

Start dev server

npm run dev

Keeps running in a separate terminal when smoke testing.

Run tests

npm test

Lint

npm run lint

Smoke test (requires dev server running)

./scripts/smoke.sh

Targets http://localhost:8787 by default. To test a deployed instance:

BASE_URL=https://your-worker.workers.dev ./scripts/smoke.sh

Secrets / env vars

Non-sensitive vars go in wrangler.jsonc under vars. For secrets, create a gitignored .dev.vars file:

API Worker

Prerequisites: Node.js 20+, npm 10+, Python 3 (for JSON pretty-printing), ingest worker running on :8787

Install

cd workers/api
npm install

Apply migrations locally

wrangler d1 migrations apply watchtower --local

Start dev server

npm run dev -- --port 8788

Runs at http://localhost:8788. Keep this running in a separate terminal when smoke testing.

Run tests

npm test

Lint

npm run lint

Smoke test (requires both workers running)

./scripts/smoke.sh

Requires the ingest worker on :8787 and the API worker on :8788. Defaults to the seeded demo project and user. Override with env vars:

INGEST_URL=https://ingest.example.workers.dev/ingest \
API_BASE=https://api.example.workers.dev \
PROJECT=wt_demo \
EMAIL=demo@watchtower.dev \
PASSWORD=demo1234 \
./scripts/smoke.sh

Secrets / env vars

Non-sensitive vars go in wrangler.toml under vars. For secrets, create a gitignored .dev.vars file:

SESSION_SECRET=anything

Wrangler loads it automatically on npm run dev.

Clone this wiki locally