v0.29.34 a batteries-included framework for AI apps
Shape an object once. s-m-r-t does the rest.
Define a model once and it becomes your database schema, REST API, CLI, MCP tools, and typed UI β reachable by people and agents alike. Auth, tenants, payments, agents, vector search, and roughly ninety UI components are included, with no vendor lock-in. It runs the same from a closet to a cluster.
The whole idea
Write the class. Get the rest for free.
One decorated class is the single source of truth. From it, s-m-r-t generates the surfaces your app and your agents actually use.
import { smrt, field, SmrtObject, SmrtCollection } from '@happyvertical/smrt-core';
@smrt({ api: true, cli: true, mcp: true })
export class Product extends SmrtObject {
name: string = '';
price: number = 0.0;
quantity: number = 0;
// Per-field @field() decorators shape the column and its generated API:
@field({ sensitive: true }) // never returned by the API; not filterable
wholesalePrice: number = 0.0;
@field({ unique: true }) // unique constraint in the generated schema
sku: string = '';
@field({ readonly: true }) // server-set only; stripped from write bodies
externalId: string = '';
// A custom async method is exposed on every surface too.
async research(query: string) {
return this.do(`Research the product and answer: ${query}`);
}
}
class ProductCollection extends SmrtCollection<Product> {
static readonly _itemClass = Product;
}
// Work with instances β ORM + AI methods are built in:
const products = await ProductCollection.create({ db: 'shop.db' });
const widget = await products.create({ name: 'Smart Widget', price: 29.99 });
const onSale = await widget.is('a clearance item'); // β boolean
const blurb = await widget.do('write a launch tweet'); // β string
const summary = await widget.describe(); // β string
const json = widget.toPublicJSON(); // β object, minus wholesalePrice
await widget.save();
- Endpoints are fail-closed by default
- Embeddings + vector search built in
- Swap AI providers by one field
- ~49 packages, released in lockstep
One model, many doors
Reach it however you work β or however your agent works
The same Product is one object. People hit it over HTTP or the CLI; agents call it as an MCP tool; your app drops in a component. No glue code in between.
const res = await fetch('/api/products');
const products = await res.json();$ smrt product:list
$ smrt product:create --name "Widget"// agent calls a generated tool
{ "tool": "product_list" }<DataTable collection={products} />The ecosystem
Batteries included β one ecosystem, not forty dependencies
Roughly 49 packages, designed together and released in lockstep. Compose the ones you need; they already know how to work with each other.
Auth & access
Users, sign-in, roles, and permissions.
- smrt-users
- smrt-profiles
Multi-tenancy
Workspaces and per-tenant data scoping.
- smrt-tenancy
Agents & jobs
Durable dispatch and background work.
- smrt-agents
- smrt-jobs
Vector & memory
Embeddings, semantic search, and recall.
- smrt-core
- smrt-facts
Commerce
Products, carts, and double-entry ledgers.
- smrt-commerce
- smrt-ledgers
- smrt-products
Content & media
Documents, images, video, and voice.
- smrt-content
- smrt-images
- smrt-video
- smrt-voice
Messaging & chat
Threads, chat, and social graphs.
- smrt-messages
- smrt-chat
- smrt-social
Secrets & flags
Managed secrets and feature flags.
- smrt-secrets
- smrt-features
UI components
A typed Svelte component library.
- smrt-smrt-svelte
One coherent ecosystem, versioned in lockstep β browse every module β
UI
A component library you donβt have to build
smrt-svelte ships a typed, themeable component library β forms, badges, cards, tables, and more β so your generated data has a face from day one.
Real, themeable Svelte components β see the full library β
AI
AI is built in
Vector & memory
Generate embeddings and run semantic search as ordinary SQL methods on your collections. Give any object a memory with remember() and recall() it later.
Agents & browser AI
Run agents on a durable dispatch bus with scheduled background jobs. In the browser, do speech-to-text, text-to-speech, and LLM inference on-device, with a warm model cache.
Portability
Runs anywhere. No lock-in.
getAI()
Pick a provider with one config field and keep the same code. Bedrock alone reaches dozens of underlying models.
getDatabase()
The same models persist to whichever engine you point them at β from a local file to a managed cluster.
The open-source stack or the big vendors β your call, same code either way.
Start here
Get started
Start from the SaaS starter
A working multi-tenant app β auth, billing, agents, and UI already wired up. Clone it and start shipping features instead of plumbing.
happyvertical/smrt-saas-starterAdd to an existing app
Already have a SvelteKit project? Scaffold SMRT into it and start decorating models.
$ npx smrt initJust the library
Want only the core object + AI + database layer? Install the one package and import what you need.
$ pnpm add @happyvertical/smrt-core