Local Development
This guide covers setting up LordClaw for local development.
Prerequisites
- Node.js v18 or later
- Docker (for PostgreSQL)
- A running OpenClaw gateway (default:
ws://localhost:18789)
Setup
Clone the repository
git clone https://github.com/InternetJohnny/lordclaw.git
cd lordclawInstall dependencies
npm installStart PostgreSQL
docker compose up -dThis starts a PostgreSQL 16 container on port 5555 (not the default 5432, to avoid conflicts).
Run database migrations
npx prisma migrate devStart the dev server
npm run dev -- --hostname 127.0.0.1 --port 3334On the Mac Mini, public port 3333 is reserved by the LordClaw proxy. Run the Next dev server on 127.0.0.1:3334.
The proxy forwards remote traffic from port 3333 to the app server on 3334.
Accessing from another device
If your dev machine is on Tailscale:
- Open
http://<tailscale-ip>:3333orhttp://<magic-dns>:3333 - Set the gateway URL to
wss://<magic-dns>if the gateway is exposed through Tailscale Serve
See Remote Access via Tailscale for the canonical Tailscale Serve example. Keep that setup in one place so the commands do not drift.
Database
| Setting | Value |
|---|---|
| Image | postgres:16-alpine |
| Port | 5555 → container 5432 |
| Database | LordClaw |
| User | LordClaw_user |
| Password | LordClaw_password |
Connection string
postgresql://LordClaw_user:LordClaw_password@localhost:5555/LordClawIf the database is unreachable
After a machine restart, Docker Desktop may not auto-start:
# Start Docker Desktop (macOS)
open -a Docker
# Wait ~15 seconds for the daemon, then:
docker start LordClaw-dbYou may also need to restart the dev server, as Prisma caches failed connections.
Database Migration Rules
Never run prisma migrate reset — this drops all data. Only with explicit approval.
- Always use
npx prisma migrate dev --name <name> --create-onlyfirst, inspect the SQL, then apply - Never use
prisma db push(causes schema drift) - New columns must be nullable or have defaults
- No destructive operations (
DROP TABLE,DROP COLUMN) without approval
Running Tests
npm test # single run
npm run test:watch # watch modeTests use Vitest and cover slash command parsing, format utilities, pricing calculations, and channel health logic.
Building for Production
npm run buildTypeScript is in strict mode with no any allowed. The build must pass without errors.