Define an interface. Initialize the ORM. Call migrate(). Your database is ready.
import ORMManager from 'slintorm';
interface User {
// @auto;primaryKey
id: number;
// @unique
email: string;
name: string;
}
const orm = new ORMManager({ driver: 'sqlite', databaseUrl: './dev.db' });
await orm.migrate();
const User = orm.defineModel<User>('users', 'User');
const user = await User.insert({ email: 'joe@example.com', name: 'Joe' });
console.log(user.id); // 1No schema files. No codegen. No config sprawl.
Write TypeScript interfaces. Run orm.migrate(). Columns appear, alter-table handled non-destructively.
Fluent chainable API: where, join, orderBy, paginate, groupBy, window functions, EXISTS subqueries.
preload("relation") batch-fetches related records. Nested preloads, cycle detection, exclude() built in.
@softDelete on deletedAt. Queries auto-filter. withTrashed(), onlyTrashed(), restore() built in.
Pre-generate schema JSON. Import at runtime, no filesystem reads. Works in Cloudflare Workers, Deno, Next.js Edge.
All drivers (pg, mysql2, better-sqlite3, mongodb) are optional peerDependencies. Ship nothing you don't use.
SlintORM ships with more out of the box than any comparable library.