Skip to main content
early access
Ratel
RATEL

Fearless, type-safe PostgreSQL ORM for Go. Compile-time checked queries. Zero reflection. Maximum performance.

$ go install github.com/yaroher/ratel/cmd/ratel@latest
store.go
// Type-safe queries — compiler catches typos users, err := Users.Query(ctx, db, Users.SelectAll(). Where(Users.Email.Eq("john@example.com")). OrderBy(Users.CreatedAt.Desc()). Limit(10), )
// Why Ratel
Type Safety

Column names and types checked at compile time. No magic strings. No runtime reflection.

🔗
Relations

HasMany, BelongsTo, ManyToMany with eager loading. Type-safe relation options per query.

📦
Code Generation

Generate from Protobuf or SQL schema. Full DDL, DML, scanners, and repositories.

🐘
PostgreSQL Native

Built on pgx. JSONB, arrays, partial indexes, schemas, RLS — first-class support.

🔄
Migrations

Atlas-powered schema diffing. Auto-generate migration files from model changes.

🛡️
Zero Overhead

Go generics, no interface{} boxing. Direct struct scanning without reflection.

// Raw SQL vs Ratel
Write less. Catch more.
Raw SQL + pgx
rows, err := db.Query(ctx, "SELECT id, email, name FROM users WHERE is_active = $1", true) // Manual scanning... // No compile-time checks // Typos found at runtime
Ratel
users, err := Users.Query(ctx, db, Users.SelectAll(). Where(Users.IsActive.Eq(true)), ) // Auto scanning // Compile-time column checks // Type-safe predicates

HONEY BADGER DON'T CARE

About your runtime errors. Because there won't be any.

Read the Docs