SeaQL /sea-orm

🐚 A powerful relational ORM for Rust

★ 9,970⑂ 749👁 38⑃ 1,206● 1,094▤ 106
RustApache-2.0Created 2021-02-09www.sea-ql.org/SeaORM/
Download: 2.0.42.0.4 ↓2.0.42026-09-27
+2
Daily
9,970
stars
749
forks
38
watchers
1,206
prs
1,094
issues
106
releases

README

SeaORM is a powerful ORM for building web services in Rust

  
  
  
  Support us with a ⭐ !



 🐚 SeaORM

中文文档

 Advanced Relations

Model complex relationships 1-1, 1-N, M-N, and even self-referential in a high-level, conceptual way.

 Familiar Concepts

Inspired by popular ORMs in the Ruby, Python, and Node.js ecosystem, SeaORM offers a developer experience that feels instantly recognizable.

 Feature Rich

SeaORM is a batteries-included ORM with filters, pagination, and nested queries to accelerate building REST, GraphQL, and gRPC APIs.

 Production Ready

With 250k+ weekly downloads, SeaORM is production-ready, trusted by startups and enterprises worldwide.

 TLS configuration

SeaORM's default features do not enable TLS. To select a TLS backend for SQLx, you need to add a SQLx dependency with the desired TLS feature.

For example, to use sqlx-postgres with tokio and AWS-LC:

toml
[dependencies]
sea-orm = { version = "2", features = ["sqlx-postgres", "runtime-tokio"] }
sqlx = { version = "0.9", features = ["tls-rustls-aws-lc-rs"] }


When using sea-orm-cli as a dependency, its defaults enable runtime-tokio-native-tls. To select another TLS backend, you need to disable the default features:

toml
[dependencies]
sea-orm-cli = { version = "2", default-features = false, features = [
    "codegen",
    "sqlx-postgres",
    "runtime-tokio",
] }
sqlx = { version = "0.9", features = ["tls-rustls-aws-lc-rs"] }


 Getting Started


Join our Discord server to chat with others!

+ Documentation

Integration examples:

+ Actix Example
+ Axum Example
+ GraphQL Example
+ jsonrpsee Example
+ Loco Example / Loco REST Starter
+ Poem Example
+ Rocket Example / Rocket OpenAPI Example
+ Salvo Example
+ Tonic Example
+ Seaography Example (Bakery) / Seaography Example (Sakila)

If you want a simple, clean example that fits in a single file that demonstrates the best of SeaORM, you can try:
+ Quickstart

Let's have a quick walk through of the unique features of SeaORM.

 Expressive Entity format
You don't have to write this by hand! Entity files can be generated from an existing database using sea-orm-cli,
following is generated with --entity-format dense (new in 2.0).
rust
mod user {
    use sea_orm::entity::prelude::;

    [sea_orm::model]
    [derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
    [sea_orm(table_name = "user")]
    pub struct Model {
        [sea_orm(primary_key)]
        pub id: i32,
        pub name: String,
        [sea_orm(unique)]
        pub email: String,
        [sea_orm(has_one)]
        pub profile: HasOne,
        [sea_orm(has_many)]
        pub posts: HasMany,
    }
}
mod post {
    use sea_orm::entity::prelude::;

    [sea_orm::model]
    [derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
    [sea_orm(table_name = "post")]
    pub struct Model {
        [sea_orm(primary_key)]
        pub id: i32,
        pub user_id: i32,
        pub title: String,
        [sea_orm(belongs_to, from = "user_id", to = "id")]
        pub aut

Top issues

Discussions

Latest release

2.0.4 2.0.4 2026-09-27
SeaORM 2.0.4

(since 2.0.3)

 Enhancements

 Add select_except to select all columns except the given ones https://github.com/SeaQL/sea-orm/pull/3211

  select_except provides the inverse of select_only / column——selecting all columns except the specified ones.

  These methods replace the current selection, so the last one called takes effect.

  rust
  [derive(DerivePartialModel)]
  [sea_orm(entity = "post::Entity")]
  struct PostPreview {
      id: i32,
      title: String,
  }

  let posts = post::Entity::find()
      .select_except([post::Column::Body])
      .into_model::()
      .all(db

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON