Expand description
§This-RS Framework
A generic entity and relationship management framework for building RESTful APIs in Rust.
§Features
- Entity/Data/Link Architecture: Clean hierarchy with macro-based implementation
- Flexible Relationships: Support multiple link types between entities
- Bidirectional Navigation: Query relationships from both directions
- Auto-Pluralization: Intelligent plural forms (company → companies)
- Configuration-Based: Define relationships via YAML configuration
- Type-Safe: Leverage Rust’s type system for compile-time guarantees
- Soft Delete Support: Built-in soft deletion with deleted_at
- Automatic Timestamps: created_at and updated_at managed automatically
§Quick Start
ⓘ
use this::prelude::*;
// Define a Data entity (extends Entity base)
impl_data_entity!(
User,
"user",
["name", "email"],
{
email: String,
password_hash: String,
}
);
// Define a Link entity (extends Entity base)
impl_link_entity!(
UserCompanyLink,
"user_company_link",
{
role: String,
start_date: DateTime<Utc>,
}
);
// Usage
let user = User::new(
"John Doe".to_string(),
"active".to_string(),
"john@example.com".to_string(),
"$argon2$...".to_string(),
);
user.soft_delete(); // Soft delete support
user.restore(); // Restore supportModules§
- config
- Configuration loading and management
- core
- Core module containing fundamental traits and types for the framework
- entities
- Entity-specific code and macros
- links
- Link management module
- prelude
- Re-exports of commonly used types and traits
- server
- Server module for building HTTP servers with auto-registered routes
- storage
- Storage implementations for different backends
Macros§
- add_
filters_ for_ field - Helper macro to add filters to a field
- add_
validators_ for_ field - Helper macro to add validators to a field
- data_
fields - Macro to inject Data fields into a struct (Entity fields + name)
- entity_
fields - Macro to inject Entity base fields into a struct
- impl_
data_ entity - Complete macro to create a Data entity with automatic trait implementations
- impl_
data_ entity_ validated - Extended macro to create a Data entity with validation and filtering
- impl_
entity_ multi_ tenant - Helper macro to enable multi-tenancy for an entity
- impl_
link_ entity - Complete macro to create a Link entity with automatic trait implementations
- link_
fields - Macro to inject Link fields into a struct (Entity fields + source_id + target_id + link_type)