Skip to content

LiteORM for modern Go

A typed query builder and a declarative ORM over one CGo-free core. LiteORM is lite because it's modern — built from a clean Go baseline, not a decade-old codebase patched a thousand times — so it ships more, not less.

One library, two front-ends over one core: an explicit, generics-first query builder and a declarative, convention-driven orm — same backends, same transaction, same normalized errors. Use orm for CRUD and drop to query for a hot path on the same connection. SQLite is CGo-free; Postgres, MySQL, and SQL Server are first-class too.

🧩 Two paradigms, one core

The typed query builder and the declarative orm share one Session, one dialect, one scanner, one set of errors. A row fetched via orm feeds query on the same transaction — no library lock-in, no camp to pick.

⚡ Modern baseline, lean core

Generics-first, no hot-path reflection. The core pulls in zero drivers — each backend is its own module. SQLite is pure Go: cross-compile with plain go build, ship static binaries, no C toolchain — and open it encrypted at rest, still pure Go, no CGo sqlcipher.

🤖 Built for agents

An embedded studio with AI built in turns plain English into SQL, and shipped Agent Skills + AGENTS.md mean your coding assistant writes correct LiteORM the first time. AI for the people using and building your database.

🎯 Safe by default

No implicit lazy loading — eager Load is N+1-safe by construction. Soft-delete is an explicit tri-state scope. Constraint and not-found errors normalize to the same sentinels on every backend.

The first Go ORM with an embedded database studio — browse, filter, edit, follow foreign keys, and run SQL right in the browser, mounted as a stdlib http.Handler behind your own auth. And AI is built in: describe a filter or a whole query in plain English and get SQL back, with result sets charted automatically.

LiteORM Studio screenshot 1 LiteORM Studio screenshot 1
LiteORM Studio screenshot 2 LiteORM Studio screenshot 2
LiteORM Studio screenshot 3 LiteORM Studio screenshot 3
LiteORM Studio screenshot 4 LiteORM Studio screenshot 4

Two front-ends are the floor. Stacked on top, in the same library:

import (
"liteorm.org/dialect/sqlite"
"liteorm.org/orm"
"liteorm.org/query"
)
db, _ := sqlite.Open("app.db")
defer db.Close()
// Declarative: tag a model, migrate, CRUD.
type Author struct {
ID int64
Name string
Email string `orm:"email,unique"`
}
func (Author) TableName() string { return "authors" }
_ = orm.AutoMigrate[Author](ctx, db)
authors := orm.NewRepo[Author](db)
_ = authors.Create(ctx, &Author{Name: "Ada", Email: "ada@example.com"})
// Explicit: typed predicates on the same DB.
hits, _ := query.Select[Author](db).
Filter(query.Col[string]("email").Like("%@example.com")).
OrderBy("name").All(ctx)

Add the core plus the backend you want — the core pulls in zero drivers. Full setup in Getting started.

LiteORM is the only Go library that puts a typed query builder and a declarative ORM over one core — so every win below holds across both front-ends, not just one.

Capability LiteORMgormbunsqlcent
Query builder and declarative ORM in one library
Generics-first runtime, no hot-path reflection
CGo-free SQLite (pure Go, no C toolchain)
At-rest encrypted SQLite, pure Go (no CGo sqlcipher)
Embedded database studio (admin GUI) in-tree
Studio with built-in AI (NL→SQL, charts)
Ships AI Agent Skills + task-oriented docs
Typed joins, set ops, subqueries, CTEs, windows
Associations + N+1-safe eager load
Normalized errors across all backends
Migrations: additive auto + reviewable destructive
Codegen: typed columns / models / SQL→Go
SQLite vector + FTS5 + hybrid search, changesets
first-class partial not available

Read the full comparison in the README →