s-m-r-t
Define Once, Generate Everything
Building AI-powered applications typically means writing the same logic three times: once
for your business logic, again for your API endpoints, and yet again for AI function
calling. SMRT eliminates this redundancy with a simple decorator: @smrt().
import { SmrtObject, SmrtCollection, smrt } from '@happyvertical/smrt-core';
// Custom collection with custom methods
class Todos extends SmrtCollection<Todo> {
async listIncomplete() {
return this.list({ where: { done: false } });
}
}
@smrt({
api: { include: ['list', 'get', 'create', 'update', 'delete'] },
mcp: true,
cli: true,
collection: Todos
})
class Todo extends SmrtObject {
title: string = '';
done: boolean = false;
dueDate?: Date;
async markComplete(): Promise<void> {
this.done = true;
await this.save();
}
}Programmatic Usage:
import { ObjectRegistry } from '@happyvertical/smrt-core';
// Get collection (returns Todos custom collection)
const todos = await ObjectRegistry.getCollection('Todo', {
db: { type: 'sqlite', url: 'data.db' },
ai: { provider: 'openai', apiKey: process.env.OPENAI_API_KEY }
});
// Create and save
const todo = await todos.create({ title: 'Review PRs' });
await todo.save();
// Use custom collection method
const incomplete = await todos.listIncomplete();
// Call custom instance method
await todo.markComplete();AI-Powered Methods:
Every object automatically gets AI-powered methods. The do() method can
call your custom methods via function calling:
// AI-powered methods on every object:
// do() - AI can call your custom methods automatically
await todo.do('Mark this task as complete');
// → AI sees markComplete() and calls it via function calling
// is() - AI evaluates conditions
const isUrgent = await todo.is('This is urgent or high priority');
// → Returns true/false
// describe() - AI generates descriptions
const summary = await todo.describe();
// → Returns human-readable descriptionWhat You Get Automatically:
- REST API - Full CRUD endpoints generated automatically
- MCP Server - AI function calling (Claude, code editors, etc.)
- CLI Commands - Development and operations tools
- Database Schema - Inferred from your TypeScript types
- AI Methods - do(), is(), describe() on every instance
Scale Without Refactoring:
Start with SQLite on your laptop. Scale to PostgreSQL on Kubernetes. Same codebase, just change the config:
// smrt.config.ts - Development (SQLite)
export default {
database: {
adapter: 'sqlite',
path: './data.db'
}
};
// smrt.config.ts - Production (PostgreSQL)
export default {
database: {
adapter: 'postgres',
connection: {
host: process.env.DB_HOST,
pool: { min: 5, max: 20 },
ssl: { rejectUnauthorized: true }
}
}
};Happy Vertical SDK
Flexible, Open-Source Foundation
The AI landscape changes rapidly—new models, new providers, new best practices emerge constantly. Building production applications on this shifting foundation requires careful architecture. The Happy Vertical SDK solves this with a simple principle: adapter-based abstractions that provide stability without sacrificing flexibility.
import { createAI } from '@happyvertical/ai';
import { createDatabase } from '@happyvertical/sql';
import { createFiles } from '@happyvertical/files';
// Development: Local everything
const ai = createAI({ provider: 'openai', apiKey: process.env.OPENAI_KEY });
const db = createDatabase({ adapter: 'sqlite', path: './app.db' });
const files = createFiles({ adapter: 'local', basePath: './uploads' });
// Production: Scale without refactoring
const ai = createAI({ provider: 'anthropic', apiKey: process.env.ANTHROPIC_KEY });
const db = createDatabase({
adapter: 'postgres',
host: 'postgres-primary.cluster.local',
pool: { min: 10, max: 50 }
});
const files = createFiles({
adapter: 's3',
bucket: 'my-app-uploads',
region: 'us-east-1'
});Featured Packages:
@happyvertical/ai
Standardized AI interface supporting OpenAI, Anthropic, Google Gemini, AWS Bedrock, and Hugging Face with unified API
@happyvertical/sql
Database interface with support for SQLite, PostgreSQL, and DuckDB
@happyvertical/cache
Standardized caching interface supporting Memory, File, and Redis backends
@happyvertical/spider
Lightweight web scraping and HTML content extraction using cheerio, happy-dom, and undici for high-performance server-side operations
Get in Touch
Email: will@happyvertical.com
GitHub: @happyvertical