During development, you can run Cloudflare Workers locally to test server-side logic without deploying. Workers are managed as git submodules via the unoff CLI.


Step 1 — Add workers with the CLI

Use unoff add <worker> to add workers as git submodules. The CLI automatically updates package.json workspaces and injects the corresponding start script.

Worker Command Script added Port
Announcement Worker unoff add announcement-worker start:announcements 8888
Auth Worker unoff add auth-worker start:token 8787
CORS Worker unoff add cors-worker start:cors 8989
# Add the workers you need
unoff add announcement-worker
unoff add auth-worker
unoff add cors-worker

# Install dependencies (including new workspaces)
npm install

Step 2 — Start workers locally

Each worker has its own start script:

# Start the announcement worker (port 8888)
npm run start:announcements

# Start the auth worker (port 8787)
npm run start:token

# Start the CORS worker (port 8989)
npm run start:cors

Step 3 — Configure your plugin to use local workers

Update your .env.local file to point to the local endpoints:

VITE_AUTH_WORKER_URL=http://localhost:8787
VITE_ANNOUNCEMENTS_WORKER_URL=http://localhost:8888
VITE_CORS_WORKER_URL=http://localhost:8989

Step 4 — Worker use cases

Announcement Worker (port 8888)

Fetches in-app announcements and onboarding content from a Notion database. In production, the Notion API key is stored as a Cloudflare Worker secret (wrangler secret put NOTION_API_KEY).

Related files: src/app/external/cms/ — initNotion(), getAnnouncements.ts, getOnboarding.ts, checkAnnouncementsVersion.ts.

Auth Worker (port 8787)