Fabrique
SQL-first, type-safe, ergonomic database toolkit for Rust.
Fabrique provides a fluent API for defining models, querying data, and generating test fixtures — built on SQL semantics rather than hiding them.
Core Features
Models
Define database models using the #[derive(Model)] macro. Models
automatically map to database tables and provide methods for CRUD
operations, soft deletes, and more. See the [model] module for detailed
documentation.
Query Builder
Build type-safe database queries with a fluent API. The query builder
provides methods for filtering, ordering, limiting results, and more. See
the [query_builder] module for details.
Factories
Generate test data easily with the #[derive(Factory)] macro. Factories
help you create model instances for testing without manually specifying
every field. See the [factory] module for more information.
Quick Example
use *;
// Define a model
# async
Getting Started
To use Fabrique in your project, add it to your Cargo.toml:
[]
= { = "0.2", = ["sqlite"] }
Then define your models and start querying. See the [model] module for a
comprehensive guide on model conventions and usage