s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← Getting Started

Clone smrt-start

Start from the template itself.

smrt-start is the public, MIT-licensed template that smrt cookbook apply copies by default. Cloned on its own it is a small working application, not an empty folder.
More in Getting started

This is the only guide in this family.

1. Clone and run it

You need Node 26 or newer, git and pnpm 11.25, the version the template's packageManager pins. app:setup builds, creates the local database and issues a one-time owner invitation; app:open opens the page where your name and email make you the owner. pnpm app:doctor prints where the data lives and anything it finds wrong.

terminal
bash
git clone https://github.com/happyvertical/smrt-start.git my-app
cd my-app
pnpm install
cp .env.example .env        # ANTHROPIC_API_KEY, for the assistant only
pnpm app:setup
pnpm dev                    # http://127.0.0.1:5173
pnpm app:open               # in a second terminal: the one-time owner setup page

A clone keeps the template's own package pins, lockfile, git history and remote. smrt cookbook apply gives the same template with every s-m-r-t package pinned to the current release (0.57.40). A clone stays on the version the template last moved to until you bump it. The older @happyvertical/smrt-template-sveltekit package is still published; it is not the starting point.

2. Read the first model

src/lib/models/Note.ts is the application's data model. On every pnpm dev and pnpm build, the smrt() Vite plugin turns this one class into the schema and the REST routes under /api/notes. The same class supplies the WebMCP read tools, the assistant's tools and the remote MCP read tools. pnpm db:migrate applies schema changes.

src/lib/models/Note.ts
typescript
import { SmrtObject, smrt } from '@happyvertical/smrt-core';
import { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';

@smrt({
  api: { include: ['list', 'get', 'create'], writable: ['title', 'body'] },
  mcp: { include: ['list', 'get', 'create'] },
})
@TenantScoped({ mode: 'required' })
export class Note extends SmrtObject {
  @tenantId()
  tenantId: string = '';

  title: string = '';

  body: string = '';
}
  • writable is the allowlist for REST writes; include picks which generated operations exist at all.
  • @TenantScoped with mode: 'required' means every note belongs to one organization and is never read across them.
  • The generated files under .smrt/ and src/routes/api/ are gitignored. Edit the model, not them.

3. Continue through the foundations

  1. Objects and collectionsRename Note and add the first useful fields and relationships.
  2. TenantsDecide whether records are global, tenant-owned, or part of a tenant hierarchy.
  3. Users and profilesConnect your sign-in provider and keep product identity separate.
  4. Memberships and permissionsSeed roles and protect app-owned mutations.
  5. Pages and live dataLoad on the server, then hydrate browser collections only where needed.
  6. Generated interfacesChoose the REST, MCP, WebMCP, and CLI actions each model should expose.