Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

like Lovable, embeddedinto your dashboard

Versioned React UI projects on a Cloudflare Worker. Agents edit files in a session, viewers see live drafts, each agent message becomes one git commit. TypeScript, JSX and Tailwind are bundled on the fly.
npm i @malleable/ui
import { Project } from '@malleable/ui' const project = new Project({ apiKey, id: 'u123' }) await project.init() const session = await project.openSession({ author: { kind: 'agent', id: 'ses_1' } }) await session.apply({ ops: [{ op: 'write', path: 'App.tsx', content: code }] }) const draft = await session.build() // draft: { ok, url } of the new module await session.commit({ message: 'Add chart' }) // one commit, sources + dist, returns its url await project.undo() // new commit with the previous sources
An agent loop in a Worker sends draft.url to the user in its own chat stream, next to the tokens. The client returns absolute urls, so the browser only runs import(url). See docs/projects.md.
Or follow every change of a project over a WebSocket:
project.watch({ onMessage: async (msg) => { if (msg.type !== 'update') return const mod = await import(msg.url) // draft or commit module setComponent(() => mod.default) }, })
The client talks to https://malleableui.dev by default. If you self-host the worker, pass its origin:
const project = new Project({ endpoint: 'https://ui.example.com', apiKey, id: 'u123' })
Users can also edit with plain git:
const { authenticatedUrl } = await project.createGitToken({ label: 'laptop' }) // revocable, no expiry
git clone "$AUTHENTICATED_URL" app git commit -am 'Tweak' && git push origin main # the worker builds dist/ on top

Embed in your app

Let users add screens to your dashboard with your own AI SDK agent loop. Each write or edit tool builds and returns a url; the browser imports it at once.
const edit = tool({ inputSchema: z.object({ path: z.string(), oldString: z.string(), newString: z.string() }), async execute(input) { await session.apply({ ops: [{ op: 'replace', ...input }] }) return session.build() // { ok: true, url } or { ok: false, errorText } for the model }, })
// browser: latest tool output url, React shared through an import map const { default: View } = use(import(url)) return <View api={dashboardApi} />
Full guide with the agent route, import map and error handling: docs/embedding.md. Live example: https://demo.malleableui.dev, code in dashboard-demo/.

Features

  • Sessions: atomic write / replace / delete ops
  • Parallel agents: many sessions per branch; commit three-way merges, overlapping edits come back as conflict markers plus a prompt for the agent
  • Drafts: build() publishes a module to viewers without touching git
  • History: every commit holds sources and dist/; undo, restore, branches, fast-forward merge
  • Git remote: clone and push with short-lived tokens
  • Bundling: Rollup (wasm) + sucrase, code splitting for dynamic imports and React.lazy
  • npm packages: bare imports become esm.sh urls at a version locked per project; React stays external by default
  • Tailwind CSS v4: generated from the classes in your code, imported CSS supports @apply
  • shadcn/ui theme and the Typography plugin included

Project config

malleable.json at the repo root. Missing keys use the defaults:
{ "entry": "App.tsx", "externalPackages": ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime"] }
The entry module default-exports the component. Every bare import not listed in externalPackages stays external as an esm.sh url with an exact version, for example https://esm.sh/date-fns@4.4.0?external=react,.... The first build that imports a package locks its latest version; project.updateDependencies({ names }) unlocks it.

CSS variables

The generated CSS includes the default shadcn/ui variables for light and dark mode:
  • --primary, --secondary, --destructive, --muted, --accent
  • --background, --foreground, --card, --popover
  • --border, --input, --ring, --radius
Set them on the host :root (as h s% l%) to theme every view. The generated CSS is scoped to the component: it sits in @scope ([data-malleable-root]), and the entry wraps the component in a display: contents element with that attribute. Utilities and the reset never touch host elements.
:root { --primary: 0 0% 9%; --border: 0 0% 92%; } /* host page */

Docs

Setup, every REST route, live messages and the git remote are in docs/projects.md.
The diff panel uses featherdiff, a tiny React diff viewer in this repo, published to npm.
Try it with an agent script, then open /view/<projectId>:
MALLEABLE_API_KEY=... pnpm tsx examples/agent.ts demo1 MALLEABLE_API_KEY=... pnpm tsx examples/dashboard-agent.ts dash1 MALLEABLE_API_KEY=... pnpm tsx examples/parallel-agents.ts par1 # two agents, one conflict

Development

The worker lives in website/: one Spiceflow app on Cloudflare Workers that serves the REST API, the module and git routes, and this docs site (Holocron).
website/src/app.tsx ──► /api/projects/* REST, Bearer MALLEABLE_API_KEY ──► /p/:id/* built modules, live socket ──► /git/:id.git/* git remote ──► /view/:id live viewer ──► /, /docs/* Holocron docs (website/src/pages)
pnpm install pnpm dev # vite dev in website/; put MALLEABLE_API_KEY in website/.dev.vars pnpm deployment # typecheck, vite build, wrangler deploy pnpm test # runs against the deployed worker, deploy first
TestCovers
src/bundle.test.tsTailwind output, CSS imports, relative and npm imports, code splitting, build errors
src/project.test.tssessions, drafts, commit, undo, branches, parallel sessions and conflicts, live messages, git clone and push
website/src/generate-tailwind.test.tsTailwind class scanner, local, no network (pnpm -C website test)
The worker tests need MALLEABLE_API_KEY (env or website/.dev.vars) and deno on the PATH.
The dashboard demo is a separate worker (spiceflow, D1, Workers AI). Build the root package first, it imports @malleable/ui from dist/:
pnpm build # root: emits dist/client.js cd dashboard-demo && pnpm run deploy:prod # D1 migrations, tsc, vite build, wrangler deploy

License

MIT