| name | portability |
| description | How to keep template code database-agnostic and hosting-agnostic. Use when defining schemas, writing raw SQL, creating server routes, or anything that could leak a SQLite-only, Postgres-only, or Node-only assumption. |
| scope | dev |
| metadata | {"internal":true} |
Portability
Rule
Never write code that only works on one database or one hosting platform. Templates must run on portable SQL backends (SQLite, Postgres, D1, Turso/libSQL, Supabase, Neon, managed platform SQL environments when available) and any Nitro deploy target (Node, Cloudflare, Netlify, Vercel, Deno, Lambda, Bun) without code changes.
Database Agnostic
Use the dialect-agnostic schema helpers from @agent-native/core/db/schema for schemas and Drizzle's query builder for reads/writes:
import {
table,
text,
integer,
real,
now,
sql,
} from "@agent-native/core/db/schema";
export const meals = table("meals", {
id: text("id").primaryKey(),
name: ().(),
: ().(),
: (),
: (, { : }).().(),
: ().().(()),
});