
diesel
A safe, extensible ORM and Query Builder for Rust
The Lens
Diesel is a type-safe ORM and query builder for Rust. You write database queries as Rust code, and the compiler catches a whole class of mistakes (wrong column, wrong type, malformed join) before your program ever runs. It supports PostgreSQL, MySQL, and SQLite, is dual-licensed Apache-2.0 and MIT, and is free.
That compile-time safety is the whole pitch, and it has a cost. Diesel leans hard on Rust's type system and macros, which means a real learning curve, slower build times, and friction when you need very dynamic queries that are not known at compile time. It is also not async-first, which matters in a Rust web stack built around async runtimes. The trade is fewer runtime database bugs for more work up front.
For Rust developers who want their database layer checked by the compiler and are mostly writing known, static queries, Diesel is a leading choice. Solo or team, it is free with no tiers. If you need async from the ground up or you write a lot of runtime-dynamic SQL, look at sqlx (raw queries, async, compile-time-checked) or SeaORM (async, more dynamic) instead.
The catch is rigidity. The same type system that catches your bugs fights you when your queries need to bend at runtime. Diesel is excellent when your schema and queries are well-defined, and a wrestling match when they are not.
Free vs Self-Hosted vs Paid
fully freeFree tier: Fully free and open source, dual-licensed Apache-2.0 and MIT.
Self-hosted: It is a library compiled into your Rust app; there is no service to host.
Paid: None. Funded through GitHub Sponsors and public grants.
Completely free and open source. Dual-licensed Apache-2.0 and MIT.
Get tools like this every Wednesday
One featured tool, three on the radar. No fluff.
License: Apache License 2.0
Use freely. Patent grant included.
Commercial use: ✓ Yes
About
- Owner
- Diesel (Organization)
- Stars
- 14,091
- Forks
- 1,215