Introduction
A fully type-safe TypeScript ORM with zero code generation
VibORM
VibORM is a modern TypeScript ORM that provides full type safety without code generation. Define your schema once and get perfectly typed queries, mutations, and results.
Why VibORM?
| Feature | VibORM | Prisma | Drizzle |
|---|---|---|---|
| Type Safety | Full inference | Code generation | Partial |
| Schema Definition | TypeScript | Schema file | TypeScript |
| Code Generation | None | Required | None |
| Query API | Prisma-like | Prisma | SQL-like |
| Runtime Validation | ArkType | None | None |
Key Features
- Zero Code Generation — Types are inferred from your schema at compile time
- Prisma-like API — Familiar patterns if you're coming from Prisma
- Full Type Safety — Every query, filter, and result is fully typed
- Runtime Validation — Built-in ArkType schemas validate data at runtime
- Chainable API — Fluent, composable schema definitions
- Database Agnostic — Supports PostgreSQL, MySQL, and SQLite
Quick Example
import { s, createClient } from "viborm";
// Define your schema with full type inference
const user = s
.model({
id: s.string().id().ulid(),
email: s.string().unique(),
name: s.string().nullable(),
role: s.enum(["USER", "ADMIN"]).default("USER"),
posts: s.relation.oneToMany(() => post),
})
.map("users");
const post = s
.model({
id: s.string().id().ulid(),
title: s.string(),
published: s.boolean().default(false),
authorId: s.string(),
author: s.relation
.fields("authorId")
.references("id")
.manyToOne(() => user),
})
.map("posts");
// Create a fully typed client
const client = createClient({
schema: { user, post },
adapter: new PostgresAdapter({ connectionString: "..." }),
});
// Query with full type safety
const users = await client.user.findMany({
where: { role: "ADMIN" },
include: { posts: { where: { published: true } } },
});
// Type: { id: string; email: string; name: string | null; role: "USER" | "ADMIN"; posts: Post[] }[]Installation
npm install viborm