TideORM
A developer-friendly ORM for Rust with clean, expressive syntax.
TideORM CLI & Studio
NEW! TideORM now includes a powerful CLI with a beautiful web-based interface!
# Install the CLI
# Initialize a project
# Generate models with a single command
# Launch TideORM Studio (Web UI)
TideORM Studio provides a visual interface for:
- 🏗️ Model generation with all options
- 📦 Migration management
- 🌱 Database seeding
- ⚡ Interactive SQL query playground
See the TideORM CLI README for full documentation.
Features
- Clean Model Definitions - Simple
#[tideorm::model]attribute macro - SeaORM-Style Relations - Define relations as struct fields
- Async-First - Built for modern async/await workflows
- Auto Schema Sync - Automatic table management during development
- Type Safe - Full Rust type safety with zero compromises
- Multi-Database - PostgreSQL, MySQL, and SQLite support
- Batteries Included:
- Fluent Query Builder with Window Functions & CTEs
- Database Migrations & Seeding
- Model Validation System
- Record Tokenization (secure ID encryption)
- Translations (i18n) for multilingual content
- File Attachments with metadata
- Full-Text Search with highlighting
- Soft Deletes & Callbacks
- Transaction Support
Quick Start
use *;
async
Model Relations
TideORM supports SeaORM-style relations defined as struct fields:
// Loading relations
let user = find.await?.unwrap;
let posts = user.posts.load.await?; // Vec<Post>
let profile = user.profile.load.await?; // Option<Profile>
let post = find.await?.unwrap;
let author = post.author.load.await?; // Option<User>
// Check if relation exists
let has_posts = user.posts.exists.await?; // bool
let post_count = user.posts.count.await?; // u64
// Load with constraints
let recent_posts = user.posts.load_with.await?;
Installation
[]
# PostgreSQL (default)
= { = "0.7.2", = ["postgres"] }
# MySQL
= { = "0.7.2", = ["mysql"] }
# SQLite
= { = "0.7.2", = ["sqlite"] }
Feature Flags
| Feature | Description |
|---|---|
postgres |
PostgreSQL support (default) |
mysql |
MySQL/MariaDB support |
sqlite |
SQLite support |
runtime-tokio |
Tokio runtime (default) |
runtime-async-std |
async-std runtime |
Relation Types
| Type | Description | Example |
|---|---|---|
HasOne<T> |
One-to-one relationship | User has one Profile |
HasMany<T> |
One-to-many relationship | User has many Posts |
BelongsTo<T> |
Inverse of HasOne/HasMany | Post belongs to User |
HasManyThrough<T, P> |
Many-to-many via pivot | User has many Roles through UserRoles |
MorphOne<T> |
Polymorphic one-to-one | Post/Video has one Image |
MorphMany<T> |
Polymorphic one-to-many | Post/Video has many Comments |
Documentation
For detailed documentation on all features, see DOCUMENTATION.md.
Key sections:
- Configuration - Database connections and pool settings
- Model Definition - Defining your models
- Query Builder - Building complex queries
- OR Conditions - Fluent OR API with begin_or/end_or
- CRUD Operations - Create, Read, Update, Delete
- Soft Deletes - Soft delete support
- Transactions - Transaction handling
- Callbacks - Lifecycle hooks
- File Attachments - Manage file relationships
- Translations (i18n) - Multilingual content
- Validation - Data validation rules
- Full-Text Search - Search with highlighting
- Multi-Database - Cross-database compatibility
TideORM CLI
For the command-line interface and TideORM Studio, see the TideORM CLI README.
CLI features:
- Model Generator - Create models with fields, relations, attachments, translations
- Migration System - Create, run, rollback database migrations
- Seeders & Factories - Database seeding and test data generation
- TideORM Studio - Web-based UI for all CLI operations
Examples
For comprehensive examples demonstrating TideORM features, see the tideorm-examples repository.
# Clone the examples repository
# Run a basic example
# Run with different databases
Available Examples
| Example | Description |
|---|---|
basic |
Core CRUD operations |
query_builder |
Advanced querying (WHERE, ORDER BY, LIMIT) |
where_and_or_demo |
Comprehensive WHERE & OR conditions |
upsert_demo |
Insert-or-update with conflict handling |
postgres_complete |
Complete PostgreSQL feature showcase |
migrations |
Database schema migrations |
validation_demo |
Model validation system |
fulltext_demo |
Full-text search with highlighting |
tokenization_demo |
Secure record ID tokenization |
See the tideorm-examples README for the complete list.
Testing
Run tests:
See DOCUMENTATION.md for more.
Rusty Rails Project
TideORM is part of the larger Rusty Rails project, which aims to bridge the gap between Rust and Ruby/Ruby on Rails ecosystems. We're actively working on recreating Ruby libraries in Rust to make working with Rust more easy and fun for new developers.
Related Projects
- TideORM CLI - Command-line interface with TideORM Studio web UI
- TideORM Examples - Comprehensive examples
- More Rust libraries coming soon!
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with love by the Rusty Rails team