Skip to content

Getting started

This walks the golden path locally against the in‑memory engine + a mock OData server (no Postgres or API key needed). At deploy these swap for Postgres + a real LLM — same interfaces (see Deployment).

1. A minimal app.json

json
{
  "schemaVersion": 1,
  "meta": { "name": "Northwind Ops" },
  "odata": { "baseUrl": "https://services.odata.org/V4/Northwind/Northwind.svc" },
  "theme": "material-light",
  "pages": [
    {
      "id": "products",
      "path": "/products",
      "title": "Products",
      "sections": [
        {
          "id": "grid",
          "component": "DataTable",
          "entitySet": "Products",
          "dataKey": "ProductID",
          "columns": [
            { "field": "ProductName", "header": "Name", "sortable": true },
            { "field": "UnitPrice", "header": "Price", "format": "currency" }
          ],
          "query": { "orderBy": "ProductName asc", "top": 25 }
        }
      ]
    }
  ]
}

2. Validate it

ts
import { parseAppDefinition } from '@samabaasi/core';

const app = parseAppDefinition(json); // throws ZodError on anything invalid

@samabaasi/core is the single source of truth — the renderer, the engine's PUT, and the AI generator all validate against it.

3. Render it

tsx
import { DynamicRenderer } from '@samabaasi/renderer';

<DynamicRenderer app={app} path="/products" />;

That renders a live, paginated, sortable DataTable bound to the OData service — with the currency formatter applied — from JSON alone. See Dynamic renderer.

4. Serve it from the engine

bash
npx @samabaasi/engine app-json-server   # GET/PUT /api/app-json on :4000

The frontend fetches GET /api/app-json and renders it; editing the stored JSON changes the app with no rebuild. See Engine API.

5. Generate it from English (optional)

With an ANTHROPIC_API_KEY set, the engine exposes POST /api/config/natural:

bash
curl -XPOST localhost:4000/api/config/natural -d '{"prompt":"a products grid with a price column"}'
# → { app: <validated app.json>, diff: [...] }   (a dry run — review, then PUT to apply)

See AI & the governed agent.

Next

Released under the MIT License.