luhORM
A compile-time ORM that generates type-safe database code through build-time introspection. Supporting Sqlite and Postgresql out the box but extensible to another database
Features
- Compile-time code generation - Zero runtime reflection, all code generated at build time
- Type-safe queries - Builder pattern with compile-time checked columns
- Foreign key relationships - Automatic join methods and aggregation helpers
- Multiple databases - Built-in support for SQLite and PostgreSQL
- Migration system - Hash-verified migrations with automatic tracking
Quick Start
Prerequisites
- must have rand & chrono in Cargo.toml
- must have sqlx
- Add to
build.rs:
use Codegen;
use SqlitePoolOptions;
async
- Include generated code in
src/main.rs:
- Use it:
use crate;
let users = query
.name
.age_gt
.fetch_all
.await?;
let x = query
// could do this aswell
// .join(Entry::NAME, Users::ID.of(), Entry::USERID.of())
.join_entry
.fetch_with_entry
.await?
.one_to_many?;
// new feature might change
let new_user = new
.populate_fake_data
.build;
new_user.insert.await?;
Current Limitations
- Transaction support would be tricky or at least idk I'm still thinking about how I want to do it
- Composite keys are a myth
made with love - s.c 2026