Local development
Prerequisites
Section titled “Prerequisites”- Node.js 20+ and pnpm
- An Anthropic API key
git clone https://github.com/PMDevSolutions/Claudius.gitcd Claudius
# Worker (terminal 1)cd workerpnpm installcp .dev.vars.example .dev.vars # add your ANTHROPIC_API_KEYpnpm dev # http://localhost:8787
# Widget (terminal 2)cd widgetpnpm installpnpm dev # http://localhost:5173Open http://localhost:5173 — the dev app renders the widget pointed at the
local worker. The worker’s CORS allows any http://localhost:* origin during
development, and wrangler provides a local KV store automatically.
Running tests
Section titled “Running tests”cd widgetpnpm test # Unit + integration (Vitest)pnpm test:coverage # Coverage report (80% thresholds)pnpm e2e:install # One-time: download Chromiumpnpm e2e # Playwright end-to-end
cd ../workerpnpm test # API, validation, rate-limit, analytics testsThe E2E suite mocks **/api/chat, so the worker doesn’t need to run during
Playwright tests.
Component Storybook
Section titled “Component Storybook”Every widget component has stories covering its meaningful states — themes (light / dark / auto), error and empty states, the mobile bottom sheet, RTL layout, and the proactive greeting. It’s a fast feedback loop for UI work and doubles as living documentation.
cd widgetpnpm storybook # http://localhost:6006pnpm build-storybook # static build -> widget/storybook-staticThe latest main is published at
claudius-storybook.pages.dev. Use the
toolbar Theme, Locale, and Direction controls to preview each
component across color schemes, languages, and writing direction.
Repository layout
Section titled “Repository layout”| Path | What it is |
|---|---|
widget/ | React widget: components, hooks, locales, embed entry |
worker/ | Cloudflare Worker: Hono routes, chat, rate limiting, analytics |
clients/ | Per-client JSON configs + schema |
scripts/ | pnpm claudius CLI (init, validate, snippet) |
docs/ | This documentation site |
cdn/ | Built embed bundle served via jsDelivr |