Skip to content
Draft
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
7e26cac
Bump sea-orm & sea-query
tyt2y3 Sep 4, 2025
468392d
Support SeaORM RBAC (#212)
tyt2y3 Aug 24, 2025
accee10
Convert schema meta to GraphQL schema
tyt2y3 Sep 2, 2025
9108196
Support #[seaography(ignore)] on Entity
tyt2y3 Sep 13, 2025
cca4479
Rebase on 1.1.x
tyt2y3 Sep 20, 2025
6b1ff0a
Remove guards
tyt2y3 Sep 23, 2025
6ab59e4
enable combine_is_null_is_not_null by default
tyt2y3 Sep 23, 2025
1ce0aca
Stop patching
tyt2y3 Sep 24, 2025
e47a07a
Filter by related entity
tyt2y3 Sep 27, 2025
448f345
clippy
tyt2y3 Sep 27, 2025
67c94bf
Changelog
tyt2y3 Sep 27, 2025
a8ff6e6
Fix CI
tyt2y3 Sep 27, 2025
bafc7e7
comment
tyt2y3 Sep 27, 2025
8171d4f
update build script
tyt2y3 Sep 30, 2025
e09a78d
2.0.0-rc.2
tyt2y3 Sep 30, 2025
d5d8a1e
update examples
tyt2y3 Sep 30, 2025
0ea1f9f
publish seaography-macros
tyt2y3 Sep 30, 2025
738ec3e
Regenerate example projects with more likely web-framework choice
tyt2y3 Oct 1, 2025
bba9124
Readme
tyt2y3 Oct 2, 2025
77936b6
register entity without mutation
tyt2y3 Oct 4, 2025
0a2de44
Fix up
tyt2y3 Oct 6, 2025
c92cd55
Fixup
tyt2y3 Oct 6, 2025
e005314
Docs
tyt2y3 Oct 8, 2025
5da5449
Docs
tyt2y3 Oct 8, 2025
ceb0029
Readme
tyt2y3 Oct 10, 2025
d8a6257
Improve codegen
tyt2y3 Oct 19, 2025
7196ebb
Ignore fields with custom type
tyt2y3 Oct 19, 2025
46c0e02
update postgres example
tyt2y3 Oct 19, 2025
2e2d6ca
update sqlite example
tyt2y3 Oct 19, 2025
6c059a3
Update seaography-cli
tyt2y3 Oct 19, 2025
b670e60
Fix CI
tyt2y3 Oct 19, 2025
d0e9d89
Update CLI
tyt2y3 Oct 19, 2025
1ceb3cb
Update mysql example
tyt2y3 Oct 19, 2025
2374c97
Use tokio inplace of async std
tyt2y3 Oct 19, 2025
ac9efca
One more test case
tyt2y3 Oct 19, 2025
16d13d6
Make mutation tests repeatable
tyt2y3 Oct 21, 2025
a8b403b
2.0.0-rc.3
tyt2y3 Oct 22, 2025
221b15c
update examples
tyt2y3 Oct 22, 2025
453e791
rename scripts
tyt2y3 Oct 22, 2025
270bd8a
Update cargo template
tyt2y3 Oct 22, 2025
2dc14d7
Optimize EntityColumnId
tyt2y3 Oct 23, 2025
45cfa8b
Readme
tyt2y3 Oct 23, 2025
f78b970
Update Actix template
tyt2y3 Oct 23, 2025
0ba8989
Small tweak
tyt2y3 Oct 23, 2025
8269b70
README
tyt2y3 Oct 24, 2025
1b3ebcc
Refactor loader
tyt2y3 Oct 20, 2025
6869ee8
More test cases
tyt2y3 Oct 20, 2025
7ca8af0
New Loader
tyt2y3 Oct 20, 2025
3d0c545
Add one more staff
tyt2y3 Oct 24, 2025
ab3ba26
New Loader implementation that uses Data Loader for M-N relations as …
tyt2y3 Oct 24, 2025
38a0799
Update SQLite example to use dense entity
tyt2y3 Oct 25, 2025
73afda5
Optimize cursor encode / decode to not use vec
tyt2y3 Oct 25, 2025
4393300
Stop using smallint for FKs
tyt2y3 Oct 25, 2025
9706b0b
Deprecate async-std
tyt2y3 Oct 25, 2025
fc0d055
clippy
tyt2y3 Oct 26, 2025
c8e006e
Fix has_one relation
tyt2y3 Oct 26, 2025
b9d1726
Add test case for diamond relations
tyt2y3 Oct 26, 2025
d1c765a
Add 'not' operator to filters (#231)
peterkelly Oct 27, 2025
fe4dfe6
2.0.0-rc.4
tyt2y3 Oct 28, 2025
a1f1737
update examples
tyt2y3 Oct 28, 2025
85e9562
Update Entity with unique key
tyt2y3 Nov 1, 2025
ea83834
Readme
tyt2y3 Nov 4, 2025
feee59d
Bump sea-orm-cli
tyt2y3 Nov 7, 2025
2abb26a
Regenerate sqlite entities as i64
tyt2y3 Nov 7, 2025
fc41b20
Bump
tyt2y3 Nov 13, 2025
1b7bc80
sqlite: idempotent mutation test
tyt2y3 Nov 13, 2025
55c0fb6
Fix entity filter on update mutation
tyt2y3 Nov 13, 2025
71d6ee1
Fix CI
tyt2y3 Nov 13, 2025
6e881d7
Disable async-graphql default features
tyt2y3 Nov 14, 2025
96294a8
Bump sea-query
tyt2y3 Nov 24, 2025
000da68
Bump actix
tyt2y3 Nov 24, 2025
cb4b9bf
Added before_active_model_save lifecycle hook fixes #238
tyt2y3 Nov 24, 2025
9f073b9
Update sea-query & sea-orm
tyt2y3 Dec 28, 2025
d6524a6
2.0.0-rc.6
tyt2y3 Dec 28, 2025
dbb6b4d
update examples
tyt2y3 Dec 28, 2025
a1cb196
clippy
tyt2y3 Dec 29, 2025
99f886b
Restore value system
tyt2y3 Dec 29, 2025
1e7dea7
Fix
tyt2y3 Dec 29, 2025
0435d10
Fix and clippy
tyt2y3 Jan 7, 2026
9db261f
Fix sea-draw
tyt2y3 Jan 7, 2026
ee38095
Try fix CI
tyt2y3 Jan 7, 2026
c4ae981
Precise version
tyt2y3 Jan 10, 2026
f58771f
2.0.0-rc.8
tyt2y3 Jan 11, 2026
eff4897
update examples
tyt2y3 Jan 11, 2026
989723d
Trigger after_save after model update
tyt2y3 Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 37 additions & 38 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- run: cargo fmt --all -- --check
- working-directory: ./examples/sea-draw
Expand All @@ -52,16 +51,19 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v3
with:
crate: sea-orm-cli
version: 1.0.0
version: 2.0.0-rc.13
- name: Additional Integration tests
working-directory: ./examples/sqlite
run: |
cargo test --test custom_query_tests
cargo test --test custom_mutation_tests
cargo test --test query_tests --features=rbac
cargo test --test plural_query_tests --features=field-pluralize
cargo test --test entity_filter_tests --features=field-pluralize
rm tests/custom_mutation_tests.rs tests/custom_query_tests.rs tests/plural_query_tests.rs
Expand All @@ -78,9 +80,11 @@ jobs:
with:
command: run
args: >
--package seaography-cli -- ./examples/sqlite
./examples/sqlite/src/entities sqlite://sakila.db
seaography-sqlite-example -f actix
--package seaography-cli --
-o ./examples/sqlite
-e ./examples/sqlite/src/entities
-u sqlite://sakila.db
seaography-sqlite-example -f poem
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
Expand Down Expand Up @@ -112,11 +116,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v3
with:
crate: sea-orm-cli
version: 1.0.0
version: 2.0.0-rc.13
- name: Remove generated folder
run: rm -rf ./examples/mysql/src
- name: Create DB
Expand All @@ -140,15 +146,15 @@ jobs:
with:
command: run
args: >
--package seaography-cli -- ./examples/mysql
./examples/mysql/src/entities mysql://sea:sea@127.0.0.1/sakila
seaography-mysql-example -f axum
--package seaography-cli --
-o ./examples/mysql
-e ./examples/mysql/src/entities
-u mysql://sea:sea@127.0.0.1/sakila
seaography-mysql-example -f actix
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
./examples/mysql/Cargo.toml
- name: Fix Nullable not implemented for Vec<String> and tsvector
run: 'sed -i "24,28d" ./examples/mysql/src/entities/film.rs'
- name: Build example
working-directory: ./examples/mysql
run: cargo build
Expand All @@ -173,11 +179,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v3
with:
crate: sea-orm-cli
version: 1.0.0
version: 2.0.0-rc.13
- name: Create DB
run: >-
psql -q postgres://sea:sea@localhost/postgres -c 'CREATE DATABASE
Expand All @@ -195,7 +203,8 @@ jobs:
working-directory: ./examples/postgres
run: |
cargo test --test pg_query_tests
rm tests/pg_query_tests.rs
cargo test --test entity_metadata_tests
rm tests/pg_query_tests.rs tests/entity_metadata_tests.rs
- name: Remove generated folder
run: rm -rf ./examples/postgres/src
- name: Generate entities
Expand All @@ -207,36 +216,23 @@ jobs:
with:
command: run
args: >
--package seaography-cli -- ./examples/postgres
./examples/postgres/src/entities
postgres://sea:sea@127.0.0.1/sakila?currentSchema=public
seaography-postgres-example -f poem
--package seaography-cli --
-o ./examples/postgres
-e ./examples/postgres/src/entities
-u postgres://sea:sea@127.0.0.1/sakila?currentSchema=public
seaography-postgres-example -f axum
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
./examples/postgres/Cargo.toml
- name: Fix Nullable not implemented for Vec<String> and tsvector
run: 'sed -i "26,27d" ./examples/postgres/src/entities/film.rs'
run: |
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"' ./examples/postgres/Cargo.toml
sed -i '/^\[dev.dependencies\]$/a \serde = { version = "1", features = ["derive"] }' ./examples/postgres/Cargo.toml
- name: Build example
working-directory: ./examples/postgres
run: cargo build
- name: Integration tests
working-directory: ./examples/postgres
run: cargo test
integration-sqlite-sea-draw:
name: SQLite integration tests (sea-draw)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Build sea-draw
working-directory: ./examples/sea-draw
run: cargo build
- name: Run sea-draw integration tests
working-directory: ./examples/sea-draw
run: ./integration_test_sqlite.sh
integration-postgres-sea-draw:
name: Postgres integration tests (sea-draw)
integration-sea-draw:
name: sea-draw Integration tests
runs-on: ubuntu-latest
services:
postgres:
Expand All @@ -256,6 +252,9 @@ jobs:
- name: Build sea-draw
working-directory: ./examples/sea-draw
run: cargo build
- name: Run sea-draw integration tests
- name: Run SQLite integration tests
working-directory: ./examples/sea-draw
run: ./integration_test_sqlite.sh
- name: Run Postgres integration tests
working-directory: ./examples/sea-draw
run: ./integration_test_postgres.sh
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.0.0 - pending

### New Features

* Filter by related entity
```graphql
{
country(having: { city: { city: { eq: "London" } } }) {
nodes {
country
city {
nodes {
city
}
}
}
}
}
```

## 1.1.5 - pending

### New Features
Expand Down
20 changes: 13 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,44 @@ members = [".", "cli", "generator", "macros"]

[package]
name = "seaography"
version = "1.1.4"
version = "2.0.0-rc.4"
edition = "2021"
rust-version = "1.70"
authors = [
"Panagiotis Karatakis <panagiotiskaratakis@gmail.com>",
"Chris Tsang <chris.2y3@outlook.com>",
]
description = "🧭 A dynamic GraphQL framework for SeaORM"
description = "🧭 A GraphQL framework for SeaORM"
license = "MIT OR Apache-2.0"
homepage = "https://www.sea-ql.org/Seaography"
documentation = "https://docs.rs/seaography"
repository = "https://github.com/SeaQL/seaography"
keywords = ["async", "graphql", "mysql", "postgres", "sqlite"]
categories = ["database"]

[package.metadata.docs.rs]
features = ["default"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
sea-orm = { version = "1.1.15", default-features = false, features = ["seaography", "with-json"] }
seaography-macros = { version = "0.1.0", path = "macros", optional = true }
sea-orm = { version = "~2.0.0-rc", default-features = false, features = ["seaography", "with-json"] }
seaography-macros = { version = "~2.0.0-rc.4", path = "macros", optional = true }
itertools = { version = "0.12.0" }
heck = { version = "0.4.1" }
thiserror = { version = "1.0.44" }
fnv = { version = "1.0.7" }
lazy_static = { version = "1.5" }
serde = { version = "1.0", optional = true }
serde_json = { version = "1.0" }
pluralizer = { version = "0.5", optional = true }
time = { version = "0.3", features = ["formatting"], optional = true }

[features]
default = ["field-camel-case"]
default = ["field-camel-case", "schema-meta"]
macros = ["seaography-macros"]
schema-meta = ["macros", "serde/derive", "with-postgres-array"]
rbac = ["sea-orm/rbac"]
with-json = ["sea-orm/with-json"]
with-chrono = ["sea-orm/with-chrono", "async-graphql/chrono"]
with-time = ["sea-orm/with-time", "async-graphql/time", "time"]
Expand All @@ -49,5 +56,4 @@ field-pluralize = ["pluralizer"]
strict-custom-types = ["seaography-macros/strict-custom-types"]

# [patch.crates-io]
# sea-orm = { git = "https://github.com/SeaQL/sea-orm" }
# sea-orm-migration = { git = "https://github.com/SeaQL/sea-orm" }
# sea-orm = { git = "https://github.com/SeaQL/sea-orm", branch = "master" }
67 changes: 40 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<img src="https://raw.githubusercontent.com/SeaQL/seaography/main/docs/Seaography.png" width="280" alt="Seaography logo"/>

<p>
<strong>🧭 A dynamic GraphQL framework for SeaORM</strong>
</p>
<p><strong>🧭 A GraphQL framework for Rust</strong></p>
<p>Quick to start, type‑safe, powerful and extensible</p>

[![crate](https://img.shields.io/crates/v/seaography.svg)](https://crates.io/crates/seaography)
[![docs](https://docs.rs/seaography/badge.svg)](https://docs.rs/seaography)
Expand All @@ -14,16 +13,19 @@

# Seaography

Seaography is a GraphQL framework that bridges async-graphql and SeaORM, instantly turning your database into a fully functional GraphQL API in Rust.
It leverages async‑graphql's dynamic schema capabilities, resulting in minimal generated code and faster compile times compared to static schemas.
With extensive configuration options, you can easily tailor the generated GraphQL schema to your application's needs.
## Introduction

Seaography enables you to focus on your application logic instead of boilerplate.
With Seaography, you can:
Seaography is a **GraphQL framework for Rust** that bridges [SeaORM](https://www.sea-ql.org/SeaORM/) and [async-graphql](https://github.com/async-graphql/async-graphql),
turning your database schema into a fully-typed GraphQL API with minimal effort.
By leveraging async-graphql's dynamic schema engine, Seaography avoids the heavy code generation of static approaches, resulting in faster compile times.
The generated schema stays in sync with your SeaORM entities, while still giving you full control to extend and customize it.

+ Turn a set of SeaORM entities into a complete GraphQL schema
+ Use derive macros to craft custom input / output objects, queries and mutations, mix-and-match them with SeaORM models
+ Generate web servers with the included CLI - ready to compile and run
With Seaography you can focus on application logic instead of boilerplate. It enables you to:

+ Expose a complete GraphQL schema directly from your SeaORM entities, including filters, pagination, and nested relations
+ Use derive macros to define custom input/output objects, queries, and mutations, and seamlessly mix them with SeaORM models
+ Generate ready-to-run GraphQL servers via the included CLI, supporting different web frameworks out of the box
+ Use RBAC, guards, and lifecycle hooks to implement authorization and custom business logic

## Supported technologies

Expand All @@ -36,35 +38,45 @@ Seaography is built on top of SeaORM, so it supports:

### Web framework

It's easy to integrate Seaography with any web framework, but we ship with the following examples out-of-the-box:
It's easy to integrate Seaography with any web framework, and we ship with the following examples out-of-the-box:

+ [Actix](https://github.com/SeaQL/seaography/tree/1.1.x/examples/mysql), [Axum](https://github.com/SeaQL/seaography/tree/1.1.x/examples/postgres), [Poem](https://github.com/SeaQL/seaography/tree/1.1.x/examples/sqlite)
+ [Loco (SeaORM)](https://github.com/SeaQL/sea-orm/tree/master/examples/loco_seaography), [Loco (SeaORM Pro)](https://github.com/SeaQL/sea-orm-pro)

### SeaORM Version Compatibility

+ [Actix](https://github.com/SeaQL/seaography/tree/1.1.x/examples/sqlite), [Axum](https://github.com/SeaQL/seaography/tree/1.1.x/examples/mysql), [Poem](https://github.com/SeaQL/seaography/tree/1.1.x/examples/postgres)
+ [Loco (SeaORM Pro)](https://github.com/SeaQL/sea-orm-pro)
| Seaography | SeaORM |
|----------------------------------------------------------|-------------------------------------------------------|
| [2.0](https://crates.io/crates/seaography/2.0.0-rc) | [2.0](https://crates.io/crates/sea-orm/2.0.0-rc) |
| [1.1](https://crates.io/crates/seaography/1.1.4) | [1.1](https://crates.io/crates/sea-orm/1.1.13) |

## Features

* Rich types support (e.g. DateTime, Decimal)
* Relational query (1-to-1, 1-to-N, M-to-N)
* Pagination for queries and relations
* Offset-based and cursor-based pagination
* Filtering with operators (e.g. gt, lt, eq)
* Filter by related entities
* Order by any column
* Mutations (create, update, delete)
* Field guards on entity / column to restrict access
* Choose between camel or snake case, and singular or plural field names
* Guards and Filters on entity to restrict access
* Choose between camel or snake case field names

## SeaORM Version Compatibility
### Extensible

| Seaography | SeaORM |
|----------------------------------------------------------|-------------------------------------------------------|
| [1.1](https://crates.io/crates/seaography/1.1.4) | [1.1](https://crates.io/crates/sea-orm/1.1.13) |
Seaography is also completely extensible. It offers:

* Extensive configuration options in schema builder
* Lifecycle hooks for custom resolver logic
* Add custom queries & mutations with derive macros

## Quick start - ready to serve in 3 minutes!

### Install

```sh
cargo install sea-orm-cli@^1.1 # used to generate entities
cargo install seaography-cli@^1.1
cargo install sea-orm-cli@^2.0.0-rc # used to generate entities
cargo install seaography-cli@^2.0.0-rc
```

### MySQL
Expand All @@ -75,7 +87,7 @@ Then regenerate example project like below, or simply do `cargo run`.
```sh
cd examples/mysql
sea-orm-cli generate entity -o src/entities -u mysql://user:pw@127.0.0.1/sakila --seaography
seaography-cli ./ src/entities mysql://user:pw@127.0.0.1/sakila seaography-mysql-example
seaography-cli -o ./ -e src/entities -u mysql://user:pw@127.0.0.1/sakila seaography-mysql-example
cargo run
```

Expand All @@ -87,7 +99,7 @@ Then regenerate example project like below, or simply do `cargo run`.
```sh
cd examples/postgres
sea-orm-cli generate entity -o src/entities -u postgres://user:pw@localhost/sakila --seaography
seaography-cli ./ src/entities postgres://user:pw@localhost/sakila seaography-postgres-example
seaography-cli -o ./ -e src/entities -u postgres://user:pw@localhost/sakila seaography-postgres-example
cargo run
```

Expand All @@ -98,7 +110,7 @@ cargo run
```sh
cd examples/sqlite
sea-orm-cli generate entity -o src/entities -u sqlite://sakila.db --seaography
seaography-cli ./ src/entities sqlite://sakila.db seaography-sqlite-example
seaography-cli -o ./ -e src/entities -u sqlite://sakila.db seaography-sqlite-example
cargo run
```

Expand Down Expand Up @@ -234,7 +246,7 @@ Find all inactive customers, include their address, and their payments with amou
}
```

### Filter using enumeration
### Filter using MySQL / Postgres enum
```graphql
{
film(
Expand All @@ -243,6 +255,7 @@ Find all inactive customers, include their address, and their payments with amou
) {
nodes {
filmId
title
rating
}
}
Expand Down
Loading
Loading