@dreamtree-org/ai-builder
v0.5.0
Published
AI-native scaffolder + skill/MCP installer for full-stack multi-tenant apps wired to @dreamtree-org/korm-js (data) + @dreamtree-org/twreact-ui (UI), with module-driven RBAC and CSS-variable theming. SPA, no SEO.
Maintainers
Readme
@dreamtree-org/ai-builder
Scaffold a complete, working full-stack multi-tenant SPA in one command — Express API + Vite/React client, pre-wired to
@dreamtree-org/korm-js(data) and@dreamtree-org/twreact-ui(UI), with module-driven RBAC, row-level grants, and CSS-variable theming.
ai-builder is an AI-native CLI with these jobs:
ai-builder <app-name>— scaffold a complete app on disk, then get out of the way.ai-builder init --ai <provider>— install an app-building skill pack + MCP into any project.ai-builder update— check for a newer version and re-sync the installed skill pack + MCP to it.ai-builder mcp— run a zero-dependency MCP server that serves the build rules, data contract, module catalog, and scaffold plan.
It is not a runtime framework and does not own your app after generation. Targets apps that don't need SEO (client-rendered SPA, no SSR).
Aim: vibe coding with minimal tokens, world-class consistent output, proper SDLC — an assistant fetches the contract/catalog/rules live instead of re-reading files. Motto: One module registry, one data contract, one component library — zero hand-rolled CRUD, zero duplicated UI.
About the Company
@dreamtree-org/ai-builder is built and maintained under Dreamtree Global — a team crafting thoughtful, developer-first software for the modern web. We believe great products start with a great foundation, and that's exactly what this builder aims to be: a fast, consistent, AI-native way to ship full-stack multi-tenant apps.
🌐 Website: dreamtreeglobal.com
Author & Maintainer
Partha Preetham Krishna M L 📧 [email protected]
Have an idea, a bug, or just want to say hi? Reach out anytime — feedback from developers like you is what keeps this project growing.
💚 Sponsor & Support
@dreamtree-org/ai-builder is free and open source, built in the open and powered entirely by passion and late nights. Every app it scaffolds — every wired-up RBAC gate, module registry, KORM data contract, and MCP tool — represents hours of careful craft so that your team can ship faster and build consistently.
If this builder has saved you time, sparked an idea, or made your stack a little saner, please consider supporting its continued development. Your sponsorship keeps the updates coming, the bugs squashed, and the docs sharp — for the whole community. Even the smallest contribution is a huge encouragement. 🙏
☕ Make a one-tap donation via UPI
📷 Scan the QR with any UPI app (Google Pay, PhonePe, Paytm, BHIM, …) to pay instantly:
UPI ID:
dhrugantha.llp@kotak• Payee: Dreamtree Global📱 On mobile, you can also tap the button below — it opens your UPI app directly. On desktop, scan the QR above or copy the UPI ID into your payment app.
🤝 Become a Sponsor
Want to back the project long-term or as a company? You can sponsor the package directly:
- 📦 npm:
@dreamtree-org/ai-builder— star, share, and sponsor the package - ✉️ Corporate sponsorships & partnerships: [email protected]
Every star ⭐, share, and contribution helps more than you know. Thank you for being part of the journey!
Quick start
npx @dreamtree-org/ai-builder my-appThen follow the printed next steps:
cd my-app
cp .env.example .env # fill DB + JWT_SECRET
npm install
npm run db:sync # create tables from schema/sync.json
npm run seed:rbac # seed permissions from modules.config.js
npm run dev # Express API + Vite clientTeach your AI assistant how to build + the data contract + UI catalog (recommended):
npx @dreamtree-org/ai-builder init --ai claude # app-building skill pack + ai-builder MCP
npx @dreamtree-org/korm-js init --ai claude
npx @dreamtree-org/twreact-ui init --ai claude
# swap "claude" for cursor | copilot | gemini | openai as neededinit — install the skill pack + MCP
Run inside any project to give your AI assistant the rules and live tools to build a dreamtree app:
npx @dreamtree-org/ai-builder init --ai <provider> # claude | cursor | copilot | gemini | openai | allIt writes the app-building skill to the provider's conventional location and merges
the ai-builder MCP server into the provider's MCP config:
| provider | skill file | MCP config |
| --- | --- | --- |
| claude | .claude/skills/dreamtree-app-builder/SKILL.md | .mcp.json |
| cursor | .cursor/rules/dreamtree-app-builder.mdc | .cursor/mcp.json |
| copilot | .github/copilot-instructions.md | .vscode/mcp.json |
| gemini | GEMINI.md | .gemini/settings.json |
| openai | AGENTS.md | (Codex global ~/.codex/config.toml, printed) |
Flags: --no-mcp (skill only), --force (overwrite existing), --dry-run.
Existing files and MCP servers are preserved unless --force.
update — stay on the latest version
The skill pack init writes is a snapshot — a newer ai-builder may have shipped
since. Run update (alias upgrade) inside the project to check and re-sync:
npx @dreamtree-org/ai-builder@latest update # report version + re-sync skill/MCP to it
npx @dreamtree-org/ai-builder@latest update --check # report only, write nothingIt reports the running-vs-latest version (a zero-dep, cached registry check),
prints the command to upgrade the package itself, and re-syncs the installed,
version-stamped skill pack + MCP wiring to the running version for every provider
already set up here (or just --ai <provider>). It never runs npm install for you.
It also refreshes the korm-js + twreact-ui layer skills by running each
package's own init --ai <provider> (best-effort — a layer failure warns and
prints the manual command). Skip with --no-layers.
scaffold and init also print a one-line nudge when you're behind. Set
AI_BUILDER_NO_UPDATE_CHECK=1 to disable all version checks (air-gapped/CI). Your AI
assistant can self-check via the check_version MCP tool and offer to run update.
mcp — the ai-builder MCP server
A zero-dependency stdio MCP server (raw JSON-RPC 2.0 — no SDK). init wires it
in automatically; you can also register it manually:
{ "mcpServers": { "ai-builder": { "command": "npx", "args": ["-y", "@dreamtree-org/ai-builder", "mcp"] } } }Tools (compact, read-only — fetch facts instead of re-reading files):
| Tool | Returns |
| --- | --- |
| build_rules | the binding hard rules + RBAC model + add-a-feature path |
| data_contract | the KORM processRequest contract + schema column format |
| list_modules | the starter module catalog |
| describe_module | one module's registry + table columns |
| get_schema / get_registry | the generated schema/sync.json / modules.config.js |
| scaffold_plan | the exact files a scaffold would emit (dry run) |
| check_version | running-vs-latest version + the update command (stay current) |
Usage
npx @dreamtree-org/ai-builder <app-name> [options]| Option | Description |
| --- | --- |
| --db <mysql\|pg\|sqlite> | Database client (default: sqlite for local dev) |
| --modules <a,b,c> | Starter module keys (default: core) |
| --yes, -y | Accept defaults, skip prompts |
| --dry-run | Show the file plan, write nothing |
| --force | Overwrite a non-empty target directory |
| --help, -h | Show help |
Starter modules
core is always generated (RBAC, settings, per-tenant API tokens). The rest are
opt-in examples you can keep, replace, or delete:
| Key | Models | Demonstrates |
| --- | --- | --- |
| core | User, Role, Permission, ApiToken, Setting | RBAC engine + external API tokens |
| billing | Bill, Passbook | row-level grants (default-deny per-Passbook access) |
| inventory | Product, Category | plain CRUD with a foreign key |
| crm | Lead, Customer | CRUD + export action |
npx @dreamtree-org/ai-builder my-app --db pg --modules billing,inventoryHow it works
A zero-runtime-dependency CLI generates the app from a module registry.
argv ─▶ src/index.js ─┬─▶ src/prompts.js (appName, db, modules, brand)
├─▶ src/moduleCatalog.js
│ buildRegistry(modules) ─▶ modules.config.js
│ buildSchema(modules) ─▶ schema/sync.json (KORM format)
└─▶ src/generate.js
walk templates/app/** ─▶ token-substitute ─▶ target dirToken substitution is the only "templating engine" — no Handlebars/EJS. The
templates under templates/app/** are real, lint-clean files; dynamic pieces
(modules.config.js, schema/sync.json, the DB driver dependency, the
.env.example DB block) are computed from the chosen modules and injected as
__TOKEN__ substitutions.
Generated app architecture
Express API ──processRequest──▶ korm-js ──▶ DB (mysql/pg/sqlite)
▲
/api/crud/:Model
│
Vite/React SPA ── composes ──▶ twreact-uiThe single source of truth in a generated app is modules.config.js — it
derives permissions, navigation, routes, and the model→module map. RBAC is
enforced uniformly as (module, action, scope), with BaseTenantModel adding
branch scoping and instance-grant WHERE … IN injection for row-level access.
Multi-tenant by default: a platform DB (tenants, modules, superadmin) and a
per-tenant DB resolved per request by middleware/tenantResolver.js.
Repository layout
| Area | Path |
| --- | --- |
| CLI entry | bin/cli.js |
| Orchestrator / subcommand dispatch | src/index.js |
| Interactive prompts | src/prompts.js |
| Module catalog → registry + schema | src/moduleCatalog.js |
| Generator (copy + token substitution) | src/generate.js |
| init --ai (skill pack + MCP wiring) | src/init.js |
| update (version check + skill/MCP re-sync) | src/update.js |
| Version check (zero-dep, cached registry fetch) | src/version.js |
| MCP server (zero-dep stdio JSON-RPC) | src/mcp/server.js |
| Compact build knowledge (MCP + skill) | src/knowledge.js |
| Terminal UI helpers | src/ui.js |
| Generated-app templates | templates/app/** |
| App-building skill body (installed by init) | templates/skills/app-builder.md |
| Design SSOT (decisions + rationale) | SOP-ai-app-builder.md |
| Architecture SSOT (HLD/LLD) | tracking/big-picture.md |
| Bug / quality / vision backlog | tracking/backlog.md |
Development
The scaffolder uses Node built-ins only (no runtime dependencies); requires Node >= 18.
git clone [email protected]:DreamtreeTech/ai-builder.git
cd ai-builder
npm run test:smoke # scaffolds + syntax-checks an app, parses schema/registry (no network)Run the CLI locally without publishing:
node bin/cli.js my-app --dry-runContributing rules (must-read)
CLAUDE.md is the single source of truth for any contributor (human
or AI). The non-negotiables:
- The SOP is binding — changing a locked decision means updating
SOP-ai-app-builder.mdin the same change. - Compose
twreact-ui; never duplicate UI. A gap is a GitHub issue against the twreact-ui repo, not an inline copy. - All data access goes through KORM — no raw SQL, no scattered
axios. - One module registry drives permissions, nav, routes, and the model→module map.
- Schema is generated, not hand-authored.
- The scaffolder stays zero-runtime-dependency.
License
MIT © Dreamtree Global
