Zero Boilerplate
Define models with simple derive macros. No verbose entity definitions or complex trait implementations required.
Type-safe, async-first database operations for Rust. Inspired by Laravel Eloquent, Rails ActiveRecord, and Sequelize. Built on the powerful SeaORM engine. Supports PostgreSQL, MySQL, and SQLite.
use tideorm::prelude::*;
#[tideorm::model]
#[tide(table = "users")]
pub struct User {
#[tide(primary_key, auto_increment)]
pub id: i64,
pub email: String,
pub name: String,
pub active: bool,
}
#[tokio::main]
async fn main() -> tideorm::Result<()> {
TideConfig::init()
.database("postgres://localhost/myapp")
.connect().await?;
// Query with strings OR typed columns
let users = User::query()
.where_eq("active", true) // String
.where_eq(User::columns.active, true) // Typed!
.order_desc("created_at")
.limit(10)
.get().await?;
Ok(())
}
TideORM is a developer-friendly Rust ORM built on SeaORM with an intuitive experience in mind. TideORM brings the best patterns from popular ORMs to Rust while leveraging SeaORM's powerful, battle-tested database engine. Whether you're building with PostgreSQL, MySQL, or SQLite, TideORM provides type-safe, async-first operations.
Define models with simple derive macros. No verbose entity definitions or complex trait implementations required.
Use User::columns.name for compile-time safety or strings for flexibility. The same methods work with both!
Built for async/await from the ground up. Works seamlessly with Tokio and async-std runtimes.
Beautiful web-based UI for model generation, migrations, seeding, and interactive SQL playground.
PostgreSQL, MySQL, and SQLite support via SeaORM. Switch databases without changing your model code.
HasOne/HasMany file relationships with metadata, URL generation, and CDN support built-in.
Built-in multilingual content support with JSONB storage. Set, get, and sync translations easily.
Secure, encrypted, URL-safe tokens for record IDs. Never expose internal database IDs in APIs.
Cross-database search with highlighting, ranking, and boolean operators. Works on PG, MySQL, SQLite.
Built-in soft delete support with automatic query scoping. Restore deleted records with ease.
ROW_NUMBER, RANK, LAG/LEAD, running totals, and Common Table Expressions for advanced analytics.
Built-in validation rules: email, URL, min/max, regex, custom validators with clear error messages.
TideORM is built on top of SeaORM, the async & dynamic ORM for Rust. SeaORM provides the robust foundation โ TideORM adds the developer-friendly API you love.
Add TideORM to your project and start building.
[dependencies]
tideorm = "*"
use tideorm::prelude::*;
#[tideorm::model]
#[tide(table = "users")]
pub struct User {
#[tide(primary_key, auto_increment)]
pub id: i64,
pub email: String,
pub name: String,
pub active: bool,
}
// Initialize once at startup
TideConfig::init()
.database("postgres://localhost/myapp")
.max_connections(20)
.connect()
.await?;
// CRUD operations
let user = User { id: 0, email: "john@example.com".into(), .. };
let user = user.save().await?;
let users = User::query()
.where_eq("active", true)
.order_desc("created_at")
.get()
.await?;
Everything you need to build complex queries with a clean API.
// Use strings OR typed columns - both work!
User::query().where_eq("status", "active") // String
User::query().where_eq(User::columns.status, "active") // Typed
// Comparison & Pattern Matching
User::query().where_gt(User::columns.age, 18)
User::query().where_between("age", 18, 65)
User::query().where_like(User::columns.name, "%John%")
User::query().where_in("role", vec!["admin", "mod"])
// NULL Checks
User::query().where_null(User::columns.deleted_at)
User::query().where_not_null("email_verified_at")
// Combine with OR groups (begin_or/end_or)
User::query()
.where_eq(User::columns.active, true)
.begin_or()
.or_where_eq("role", "admin")
.or_where_gt(User::columns.age, 21)
.end_or()
.get().await?;
// Define relations as struct fields
#[tide(has_many = "Post", foreign_key = "user_id")]
pub posts: HasMany<Post>,
#[tide(belongs_to = "User", foreign_key = "user_id")]
pub author: BelongsTo<User>,
// Load relations
let posts = user.posts.load().await?; // Vec<Post>
let author = post.author.load().await?; // Option<User>
// Load with constraints
let recent = user.posts.load_with(|q| {
q.where_eq("published", true).limit(5)
}).await?;
// Define file attachments on model
#[tide(has_one_file = "thumbnail")]
#[tide(has_many_files = "images")]
pub struct Product { ... }
// Attach files
product.attach("thumbnail", "uploads/thumb.jpg")?;
product.attach_many("images", vec!["img1.jpg", "img2.jpg"])?;
// Get files with auto URL generation
let thumb = product.get_file("thumbnail")?;
println!("URL: {}", thumb.url()); // CDN URL
// Full-text search with ranking
let results = Article::search(&["title", "content"], "rust async")
.limit(10)
.get_ranked()
.await?;
for result in results {
println!("{} (rank: {:.2})", result.record.title, result.rank);
}
// Highlight matches
let text = highlight_text(content, "rust", "<mark>", "</mark>");
// Enable soft deletes in your model
#[tide(table = "posts", soft_delete)]
pub struct Post { ... }
// By default, soft-deleted records are excluded
let active = Post::query().get().await?;
// Include or only get soft-deleted
let all = Post::query().with_trashed().get().await?;
let trash = Post::query().only_trashed().get().await?;
// Soft delete & restore
post.soft_delete().await?;
post.restore().await?;
// Enable secure tokenization
#[tide(table = "users", tokenize)]
pub struct User { ... }
// Never expose internal IDs in APIs
let token = user.tokenize()?; // "iIBmdKYhJh4_vSKF..."
// Decode and fetch
let id = User::detokenize(&token)?; // 1
let user = User::from_token(&token).await?;
// Use in REST APIs: GET /api/users/{token}
A powerful command-line interface with a beautiful web-based UI for managing your TideORM projects.
# Install the CLI
cargo install tideorm-cli
# Initialize a project
tideorm init my_project
# Generate models with all options
tideorm make model User \
--fields="name:string,email:string:unique" \
--relations="posts:has_many:Post" \
--timestamps --soft-deletes --tokenize --migration
# Launch TideORM Studio (Web UI)
tideorm ui
Quick actions & command history
Visual form for creating models
Create, run & rollback migrations
Interactive SQL editor with templates
If you've used these ORMs, you'll feel right at home with TideORM. Built on SeaORM for rock-solid performance.
Global connection, convention over configuration, scopes, callbacks, soft deletes.
Fluent query builder, where clauses, relationships, model events.
Model definitions, find/findAll, update/destroy, JSON support.
TideORM is in active development and we need your help! We're looking for:
cargo install tideorm-cli
tideorm init my_project
tideorm ui # Launch TideORM Studio