Skip to content

The complete SQLite stack for Go

CGo-free. AI-ready. One module — driver, gorm dialector, vector & full-text search, rank fusion, encryption, compression, a writable custom VFS, and a catalog of pure-Go extensions.

A pure-Go, drop-in replacement for mattn/go-sqlite3, modernc.org/sqlite, and the glebarez/sqlite gorm dialector — with first-class typed APIs for everything you’d otherwise stitch together from four separate modules.

🤖 AI / LLM-ready

Ships Agent Skills + task-oriented docs, so your coding agent reaches for the real API instead of hallucinating one. The fastest way to build on SQLite with an AI pair-programmer.

📦 Comprehensive

Driver + typed vec + FTS5 + rank fusion + checksums + custom VFSes + page cache + the ext/ catalog ship and version together under one import; encryption, a compressed-and-encrypted container, blob storage, and the gorm dialector are opt-in companion modules on the same release cadence.

🔀 One-line migration

Swap the import; keep your sql.Open("sqlite3", …) calls and _* DSN flags (translated transparently). Drop the C toolchain — cross-compile with plain GOOS=… go build and ship static distroless/alpine binaries.

⚡ Advanced, typed, first-class

Vector + full-text search, encryption at rest, a writable custom VFS, sessions/changesets, custom Go FTS5 tokenizers — and declarative ORM search via LiteORM. Typed here, DIY everywhere else.

The CGo-free, mattn-API + glebarez-gorm drop-in driver is just the floor. Stacked on top of that:

import sqlite "gosqlite.org"
// One-line presets, no DSN string:
db, _ := sqlite.OpenWAL("app.db") // production: WAL + busy_timeout + foreign_keys
mem, _ := sqlite.OpenInMemory() // tests / scratch
// Or the typed Config (pragmas, encryption, pool tuning in one value):
db2, _ := sqlite.Open(sqlite.Config{
Path: "myapp.db",
Pragmas: sqlite.RecommendedPragmas(),
MaxOpenConns: 8,
})

Plain database/sql works too: sql.Open("sqlite", "file:app.db"). Full setup in Configuration; start-to-finish in Getting started.

LiteORM — the modern ORM, search built in

Section titled “LiteORM — the modern ORM, search built in”

Reach for an ORM? LiteORM is the one built for this stack: a type-safe, CGo-free ORM — generics, declarative models, AutoMigrate — with what no other Go ORM ships, native vector, full-text, and hybrid (RRF) search running straight on this driver’s vec / fts / fusion packages. Search isn’t bolted on, it’s the same engine: declare the indexes on your model, the FTS5 + vec0 sidecars are provisioned and kept in sync on every write, and typed helpers return ranked results — no hand-written KNN SQL.

import (
"liteorm.org/dialect/sqlite" // the gosqlite-backed SQLite backend
"liteorm.org/dialect/sqlite/search"
"liteorm.org/orm"
)
type Article struct {
ID int64
Title string
Body string
Embedding []float32 `orm:"-"` // sidecar-only, not a base-table column
}
func (Article) SearchIndexes() []orm.SearchIndex {
return []orm.SearchIndex{
orm.FullText("Title", "Body"),
orm.Vector("Embedding", 5).WithMetric(orm.Cosine),
}
}
db, _ := sqlite.Open("app.db") // *liteorm.DB, gosqlite under the hood
orm.AutoMigrate[Article](ctx, db) // provisions the FTS5 + vec0 sidecars
// vector / full-text / hybrid — typed, ranked, no hand-written KNN SQL:
hits, _ := search.For[Article](db).Hybrid(ctx, queryVec, search.Term("space"), 4)

One ORM across SQLite, Postgres, MySQL, and SQL Server, in its own module (go get liteorm.org) — so the gosqlite core stays dependency-free. Already invested in gorm.io/gorm? The gosqlite.org/gorm dialector keeps it running as a CGo-free drop-in — but for new code, LiteORM is the one to reach for.

One module covers what otherwise takes four — a column of green where every other Go SQLite driver leaves gaps.

Capabilitygosqlitemattnmoderncncrucesglebarez
CGo-free — no C toolchain
database/sql driver
Registers as "sqlite" and "sqlite3"
CGo-free gorm dialector
Whole stack in one module
Typed vector search (sqlite-vec)
Typed FTS5 + custom Go tokenizers
ORM with native vec / FTS / hybrid search (LiteORM)
Hybrid-search rank fusion
Encryption-at-rest VFS
Compressed-at-rest database (live, in place)
User-implementable VFS (pure Go)
Bounded, observable page cache
Changesets / session sync
Loadable Go SQL extensions
AI Agent Skills + task-oriented docs
first-class partial not available

See the full comparison & performance notes →