How this demo was built
Two parts, each with its own job.
1. The backend: Keelson
One open-source program, deployed here as a Cloudflare Worker. The app's data, rules and workflow live in one contract. AI can propose changes to it, a person approves them, and Keelson enforces them on every screen, API call and AI client.
2. The front-end: written by Claude Code
Claude Code wrote this Next.js app from a short brief like the one below, reading the backend's live contract:
Build a Next.js sales app on the Keelson backend at KEELSON_URL. Read the live contract from /api/v1/meta. Show a pipeline board with one column per lifecycle state, buttons only for the moves the contract allows, a form to add a deal, and pages for companies and contacts. Put no business rules in the front-end: when Keelson refuses something, show its message.
Because the rules live in Keelson, the front-end never re-implements them. These are read from the backend right now:
Stages: Lead → Qualified → Proposal → Won → Lost
Allowed moves: Lead → Qualified, Qualified → Proposal, Proposal → Won, Lead/Qualified/Proposal → Lost
Rules: amount >= 0 (Deal amount cannot be negative)
probability >= 0 && probability <= 100 (Probability must be between 0 and 100)
Lost needs: Give a lost reason before marking a deal LostTry it
- On the pipeline, mark a deal lost without a reason: Keelson refuses, and its message shows on the card.
- Add a deal with a negative amount: refused by the contract's rule, not by this page.
- Only the moves the contract allows have buttons: a Lead can be qualified or lost, never won directly.
Run your own: keelson.ossmalaysia.com, or the source of this demo on GitHub.