ObjectStack

July 17, 2026 · View on GitHub

License: Apache 2.0 TypeScript Tests

AI writes the app. ObjectStack is what it writes.

The open target format and runtime for AI-written business apps. Your coding agent writes models, UI, workflows, and permissions as compact typed metadata — a complete CRM is under 2,000 lines, so the whole app fits in the agent's context — and strict TypeScript, Zod schemas, and a validation gate catch its mistakes at authoring time. The runtime derives the database, REST API, UI, and MCP server, and enforces permissions and audit on every call.

Fits in an agent's context · Typed, validated, governed · Self-host anywhere · Apache-2.0

ObjectStack architecture: author typed Zod metadata (objects, flows, views, policies); the microkernel compiles it into a versioned JSON artifact and loads plugins, drivers, and services; it generates a REST API, client SDK, Console and Studio UI, and MCP tools used by developers and AI agents, governed by Auth, RBAC, RLS, FLS, and audit, over PostgreSQL, MySQL, SQLite, or MongoDB
One typed definition → database · REST API · client SDK · UI · MCP tools.

The loop

1 · Create a project. The scaffolder installs the AI skills bundle and writes an AGENTS.md, so your agent starts with the protocol's rules already loaded — not with generic "write me some TypeScript" priors.

npm create objectstack@latest my-app && cd my-app

2 · Describe the requirement. Open the project in Claude Code (or Cursor, Copilot, …) and say what the business needs:

Build a support desk. Add a ticket object with subject, description, a priority select and a status select. Add a Resolve action that only shows on tickets that aren't already resolved. Add an "Open tickets" list view and a Support nav group. Run npm run validate when you're done.

The agent writes typed metadata — not a codebase. The gate rejects what would fail silently at runtime, and the agent fixes it before you ever see it.

3 · Preview in the browser.

npx os dev --ui   # → http://localhost:3000/_console/

The Console renders the real app — records, boards, dashboards. Something wrong? Say what to change. Requirement changes run the same loop, on a diff you can actually read.

Studio object designer showing the Opportunity object's typed fields, lookups, and layout sections Studio flow designer showing a visual DAG that enrolls leads into a campaign

Prefer clicking? Studio authors the same metadata visually — same artifacts, same gate.

What can it actually build?

Point an agent at an empty repo and you get a one-off codebase: every screen hand-invented, every mistake yours to find at runtime. ObjectStack gives the agent a vocabulary instead — typed, validated primitives for what enterprise software is actually made of. The agent composes the definition; the runtime already knows how to run it.

Capability
Objects & fieldsTyped schemas with relations, validation, formulas, files
PermissionsRBAC plus row- and field-level security, enforced by the runtime
AutomationDAG flows, record triggers, scheduled jobs, webhooks
ApprovalsMulti-step chains with queues and a full audit trail
ViewsLists, kanban, calendars, gantt, galleries — declared, not coded
Dashboards & reportsCharts, aggregations, KPIs bound to live data
ActionsPermission-checked buttons and server operations
APIs & SDKGenerated REST + realtime endpoints, typed client SDK
AI toolsEvery object and exposed action doubles as a governed MCP tool
TranslationsLabels and UI text as metadata, per locale
Seed dataFixtures and demo datasets that ship with the app
DatasourcesPostgreSQL, MySQL, SQLite, MongoDB, or in-memory

Here's the shape of it — one object, and the database table, REST API, UI views, and MCP tools all follow:

import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Ticket = ObjectSchema.create({
  name: 'support_desk_ticket',
  label: 'Ticket',
  sharingModel: 'private',            // org-wide default — the security gate requires it
  fields: {
    subject: Field.text({ label: 'Subject', required: true, searchable: true }),
    status: Field.select({
      label: 'Status',
      required: true,
      options: [
        { label: 'Open', value: 'open', color: '#3B82F6', default: true },
        { label: 'Resolved', value: 'resolved', color: '#10B981' },
      ],
    }),
    due_date: Field.date({ label: 'Due Date' }),
  },
});

Why the mistakes don't ship

"AI writes it" is only useful if AI's mistakes don't reach production. Four gates stand between the agent and your users:

GateCatches
TypedStrict TypeScript + Zod — shape errors die in the editor, seconds after the agent writes them
Validatedos validate rejects metadata that type-checks but would fail silently at runtime: dangling bindings, bad CEL predicates, missing security posture
ReviewedYou approve a small readable diff in the Console — not fifty thousand lines of glue
GovernedThe runtime enforces permissions and audit on every call, so even a wrong app stays inside the fence

The reason this works is the same reason TypeScript was the right host language: an agent's errors become located, corrective text it can read and fix itself, in seconds — instead of a silent runtime failure nobody traces back.

The other half is size. The CRM in this repo — examples/app-crm: six objects, views, a dashboard, a lead-conversion flow, permission sets, actions, translations — is 31 files, 1,792 lines, roughly 16k tokens. That's the whole business system, in about 8% of a 200k-token context window. Count it yourself:

find examples/app-crm/src -name '*.ts' -not -name '*.test.ts' | xargs cat | wc -l

Because it fits in an agent's context window, the agent can load it end-to-end, reason about every dependency, and refactor across data, API, UI, and permissions in one change — it can answer "what breaks if I change this?" instead of grepping and hoping. That's the difference between AI as autocomplete and AI as a co-maintainer.

Your objects, permissions, and flows are your business ontology — and the definition layer of the AI era should be an open protocol you own. Read why.

Your app is AI-operable, for free

Because the app is typed metadata, the runtime serves it as an MCP server at /api/v1/mcp — on by default. Point any MCP client at it and an agent can inspect and operate the app you just built, under the same permissions and RLS as a human:

claude mcp add --transport http my-app http://localhost:3000/api/v1/mcp

Objects are exposed automatically; actions opt in with ai: { exposed: true }. See Connect an MCP Client.

This repo

The framework: the protocol (@objectstack/spec), kernel, SDK, CLI, and the production runtime. os start or the official Docker image ghcr.io/objectstack-ai/objectstack ships your compiled app — Console and governance included — entirely on open source. Try a live app in ~30s on StackBlitz (no install).

Three layers sit on a microkernel: ObjectQL (data), Kernel (control), ObjectUI (view). Everything starts as a Zod schema — 1,600+ of them — and TypeScript types, JSON Schemas, REST routes, UI metadata, and agent tools are all derived from that one source. See ARCHITECTURE.md.

Want it governed and hosted, with Build & Ask AI built in? ObjectOS is the commercial runtime for these definitions.

Ship it

The scaffolded project is container-ready:

docker build -t my-app . && docker compose up -d   # app + Postgres on the official runtime image

See Self-Hosted Deployment for bare Node, Kubernetes, and the secrets you must pin — and Build with Claude Code to run the whole loop end-to-end.

Working on the framework itself

git clone https://github.com/objectstack-ai/framework.git
cd framework
pnpm install     # Node 18+, pnpm 8+ (corepack enable)
pnpm build       # build all packages
pnpm dev         # run the showcase example (REST + Console on :3000)

Monorepo Scripts

ScriptDescription
pnpm buildBuild all packages (excludes docs)
pnpm devRun the showcase kitchen-sink example (@objectstack/example-showcase) — REST + Studio; exercises every metadata type, view, automation, AI & security chain
pnpm dev:showcaseSame as pnpm dev (explicit alias)
pnpm dev:crmRun the minimal CRM example (@objectstack/example-crm)
pnpm dev:todoRun the Todo example (@objectstack/example-todo)
pnpm objectui:refreshPull the sibling ../objectui build into packages/console/
pnpm testRun all tests (Turborepo)
pnpm setupInstall dependencies and build the spec package
pnpm docs:devStart the documentation site locally
pnpm docs:buildBuild documentation for production

CLI Commands

The CLI binary ships as both os and objectstack.

os init [name]    # Scaffold a new project
os create         # Interactive project / object scaffolder
os dev            # Start dev server with hot-reload (REST + console)
os start          # Start the production server
os serve          # Serve a compiled artifact
os compile        # Build a deployable JSON Environment Artifact
os validate       # Validate metadata against the protocol
os lint           # Lint metadata for best-practice violations
os info           # Display project metadata summary
os generate       # Scaffold objects, views, flows, agents, migrations
os doctor         # Check environment health
os explain        # Explain protocol concepts on the command line

Cloud, package registry, and environment management subcommands (os package publish, os package install, os login, os whoami, os environments, os cloud …) are available when targeting an ObjectStack Cloud control plane.

Use the generated API

Every object ships a REST API automatically — no controllers to write:

# CRUD endpoints for the `todo_task` object you defined above
curl http://localhost:3000/api/v1/data/todo_task

For the browser, the typed client SDK and React hooks (useQuery / useMutation / usePagination) live in @objectstack/client-react. Need a new capability? Write a plugin, driver, or service against the same kernel APIs — every built-in is one (see below).

Package Directory

72 published packages across core, engine, drivers, client, plugins, services, adapters, tools, and examples — click to expand.

Core

PackageDescription
@objectstack/specProtocol definitions — Zod schemas, TypeScript types, JSON Schemas, constants
@objectstack/coreMicrokernel runtime — Plugin system, DI container, EventBus, Logger
@objectstack/typesShared TypeScript type utilities
@objectstack/formulaCanonical expression engine — CEL (cel-js) + ObjectStack stdlib for formula fields, predicates, conditions, dynamic defaults
@objectstack/platform-objectsBuilt-in platform object schemas — identity, security, audit, notification, package, and environment

Engine

PackageDescription
@objectstack/objectqlObjectQL query engine and schema registry
@objectstack/runtimeRuntime bootstrap — DriverPlugin, AppPlugin
@objectstack/metadataMetadata loading and persistence
@objectstack/restAuto-generated REST API layer

Drivers

PackageDescription
@objectstack/driver-memoryIn-memory driver (development and testing)
@objectstack/driver-sqlSQL driver — PostgreSQL, MySQL, SQLite (production)
@objectstack/driver-mongodbMongoDB driver (native document database)

Turso / libSQL driver (@objectstack/driver-turso) and the libSQL-backed vector knowledge plugin (@objectstack/knowledge-turso) live in the ObjectStack Cloud monorepo as of this release.

Client

PackageDescription
@objectstack/clientClient SDK — CRUD, batch API, error handling
@objectstack/client-reactReact hooks — useQuery, useMutation, usePagination

Plugins

PackageDescription
@objectstack/plugin-hono-serverHono-based HTTP server plugin
@objectstack/mcpModel Context Protocol server — exposes ObjectStack to AI agents
@objectstack/plugin-authAuthentication plugin (better-auth)
@objectstack/plugin-securityRBAC, Row-Level Security, Field-Level Security
@objectstack/plugin-sharingRecord-level sharing — sys_record_share + enforcement middleware
@objectstack/plugin-approvalsApproval as a flow node — approver resolution, record lock & status mirror over sys_approval_request + sys_approval_action
@objectstack/plugin-auditAudit logging plugin
@objectstack/plugin-emailPluggable outbound email transport
@objectstack/plugin-webhooksOutbound webhook delivery — fan-out data.record.* events
@objectstack/plugin-reportsSaved reports + scheduled email digests
@objectstack/plugin-devDeveloper mode — in-memory stubs for all services

Services

PackageDescription
@objectstack/service-analyticsAnalytics — aggregations, time series, funnels, dashboards
@objectstack/service-automationAutomation engine — flows, triggers, and workflow state machines
@objectstack/service-cacheCache — in-memory, Redis, multi-tier
@objectstack/service-feedActivity feed / chatter
@objectstack/service-i18nInternationalization service
@objectstack/service-jobCron & interval job scheduler
@objectstack/service-packagePackage registry — publish, version, retrieve metadata packages
@objectstack/service-queueBackground job queue (in-memory, BullMQ)
@objectstack/service-realtimeReal-time events and subscriptions
@objectstack/service-settingsSettings — manifest registry + K/V resolver (Env > Tenant > User)
@objectstack/service-storageFile storage (local, S3, R2, GCS)

Framework Adapters

PackageDescription
@objectstack/honoHono adapter (Node.js, Bun, Deno, Cloudflare Workers) — the supported HTTP adapter

Tools & Apps

Package / AppDescription
@objectstack/cliCLI binary (os / objectstack) — init, dev, start, serve, compile, publish, validate, generate, lint, doctor
create-objectstackProject scaffolder (npx create-objectstack)
objectstack-vscodeVS Code extension — autocomplete, validation, diagnostics
@object-ui/consoleFork-ready runtime console SPA (lives in objectstack-ai/objectui, served via @object-ui/console on npm)
@objectstack/accountAccount & identity portal — sign in, organizations, connected apps
@objectstack/docsDocumentation site (Fumadocs + Next.js)

Examples

ExampleDescriptionLevel
@objectstack/example-todoTask management app — objects, views, dashboards, flowsBeginner
@objectstack/example-crmMinimal CRM smoke-test workspace — validates the metadata loading pipelineIntermediate
HotCRMFull-featured enterprise CRM reference app (separate repo)Advanced

Architecture

ObjectStack uses a microkernel architecture where the kernel provides only the essential infrastructure (DI, EventBus, lifecycle), and all capabilities are delivered as plugins. The three layers sit above the microkernel:

ObjectStack layered architecture: the ObjectQL data layer, the kernel control layer, and the ObjectUI view layer sit on a microkernel (plugin lifecycle, service registry / DI, event bus); every capability — drivers, server, auth, security, automation, AI — is a plugin

See ARCHITECTURE.md for the complete design documentation including the plugin lifecycle state machine, dependency graph, and design decisions.

Roadmap

See ROADMAP.md for the current documentation and architecture cleanup priorities.

Contributing

We welcome contributions. Please read CONTRIBUTING.md for the development workflow, coding standards, testing requirements, and documentation guidelines.

Key standards:

  • Zod-first — all schemas start with Zod; TypeScript types are derived via z.infer<>
  • camelCase for configuration keys (e.g., maxLength, defaultValue)
  • snake_case for machine names / data values (e.g., project_task, first_name)

Documentation

Full documentation: https://objectstack.ai/docs

Upgrading from 10.x? See Upgrading to ObjectStack 11.

Run locally: pnpm docs:dev

Community

  • Star this repo if ObjectStack is useful — it helps others find it.
  • 🐛 Questions, bugs, or feature requests → open an issue.
  • 🤝 Want to contribute? See CONTRIBUTING.md.

License

Apache-2.0.