Database & Models > Work with databases in Velocity using its hand-rolled ctx-first ORM, migrations, query builder, and model relationships.
Database integration with Velocity’s hand-rolled, ctx-first ORM: a generics-aware query builder, schema migrations, model relationships, and query building. It is not built on GORM and shares no struct-tag namespace with it.
in this section Getting Started
Connect to PostgreSQL, MySQL, or SQLite and define models with Velocity's hand-rolled, ctx-first ORM. Query Builder
Build complex database queries with Velocity's fluent query builder for filtering, sorting, and pagination. Relationships
Define hasOne, hasMany, belongsTo, manyToMany, and polymorphic relationships with eager loading in Velocity ORM. Global Query Scopes
Register named scopes that apply to every query for a model, with per-query opt-out for admin and cross-tenant work. CRUD Operations
Create, read, update, and delete database records with Velocity ORM's ctx-first API. Transactions
ctx-bound transactions, savepoints, and post-commit callbacks for the Velocity ORM. Migrations
Version control your database schema with Velocity migrations for creating tables and modifying columns. Vector Search
Run pgvector similarity search through Velocity's ORM, and use the velocity-ai document store for a batteries-included embed-and-search pipeline. Transactional Outbox
Atomically commit side effects (queue jobs, events) alongside database writes using the outbox pattern, with a built-in relay for delivery, retries, and DLQ.