Sandbox / runnable examples
Try forge-orm without installing anything — every example is one click away on StackBlitz:
| Browser-runnable | One-liner |
|---|---|
| SQLite browser todo | OPFS-persisted todo app, no server |
| Offline-first with sync outbox | Optimistic writes + drain loop |
| Node CLI (smallest) | Smallest possible forge-orm program |
| Hono + PGlite REST API | Backend API, zero external DB |
| Next.js + PGlite full-stack | App Router + Server Actions |
| IndexedDB zero-install | Full CRUD + geo + vector + FTS, no wasm |
| Auto-runs on CodeSandbox | Why |
|---|---|
| DuckDB analytics | @duckdb/node-api is a native addon |
| Bun + SQLite blog | Bun's SQLite is native |
| Feature deep-dives | Pattern |
|---|---|
| Geo search | geoPoint + nearTo (PostGIS / Mongo / wasm fallback) |
| Vector RAG | f.vector(N) + cosine similarity |
| Recipe / BOM | Recursive sub-recipe rollup |
| Multi-tenant scoping | Soft RLS via app-layer wrapper |
| Audit log | db.$on("query", …) filtering mutating ops |
| Full-text search | .search() index across dialects |
| Transactions | Atomic batch + nested savepoints |
| Migrations + drift | db.$migrate() + db.$diff() |
| Real DB (point at your own) | Setup |
|---|---|
| MongoDB Atlas blog | Free Atlas tier, paste URI into .env |
| MSSQL ERP / MERGE | Docker SQL Server, .env |
| Postgres + RLS auth | Hard multi-tenant via current_setting |
All 18 examples live at examples/. Clone any folder:
sh
npx degit johnsonfash/forge-orm/examples/01-sqlite-browser-todo my-app