Alternatives to this-rs
Honest comparison: When to use this-rs vs other solutions
This document provides an honest comparison of this-rs with alternative approaches. We believe in helping you choose the right tool for your specific use case, even if that means recommending something else.
π― Quick Decision Tree
How many entities in your API?
ββ 1-3 entities
β ββ Few/no relationships β β
Use Axum + utoipa directly
β
ββ 3-5 entities
β ββ Few relationships β β οΈ Probably use Axum directly
β ββ Many relationships β π€ Consider this-rs
β
ββ 5+ entities
ββ Few relationships β β οΈ Consider this-rs (marginal benefit)
ββ Many relationships β β
β
this-rs is a great fit
π Alternative Solutions
1. Pure Axum (Recommended for simple APIs)
Best for: Simple CRUD APIs with < 5 entities, learning Rust web development
// Pure Axum example
use axum::{Router, routing::{get, post}};
let app = Router::new()
.route("/users", get(list_users).post(create_user))
.route("/users/:id", get(get_user).put(update_user))
.with_state(state);
Pros:
- β
Explicit and easy to understand
- β
Full control over every handler
- β
Minimal abstractions
- β
Excellent documentation and ecosystem
- β
Easy debugging (see exactly where errors occur)
Cons:
- β Repetitive for many entities
- β Manual route registration
- β Manual relationship management
- β No automatic link enrichment
When to choose: < 5 entities, simple relationships, or learning Rust/Axum
2. Axum + utoipa (Recommended for REST APIs)
Best for: REST APIs with OpenAPI documentation needs
use utoipa::OpenApi;
use utoipa_axum::{router::OpenApiRouter, routes};
#[derive(OpenApi)]
#[openapi(paths(list_users, create_user))]
struct ApiDoc;
let (router, api) = OpenApiRouter::with_openapi(ApiDoc::openapi())
.routes(routes!(list_users))
.routes(routes!(create_user))
.split_for_parts();
Pros:
- β
Auto-generated OpenAPI/Swagger documentation
- β
Type-safe route handlers
- β
Easy to understand
- β
Good ecosystem integration
Cons:
- β Still need to write route registration
- β No automatic relationship management
- β No GraphQL support
When to choose: REST-only API, need OpenAPI docs, < 10 entities
3. async-graphql (Recommended for GraphQL-only)
Best for: GraphQL-first APIs with known types at compile-time
use async_graphql::{Object, Schema};
struct QueryRoot;
#[Object]
impl QueryRoot {
async fn user(&self, id: ID) -> User {
// Implementation
}
}
let schema = Schema::new(QueryRoot, MutationRoot, SubscriptionRoot);
Pros:
- β
Native GraphQL support
- β
Excellent type inference
- β
Subscriptions support
- β
Good performance
Cons:
- β No REST API
- β Compile-time types only (no dynamic schema)
- β More boilerplate for relationships
When to choose: GraphQL-only, types known at compile-time
vs this-rs: this-rs generates GraphQL schema dynamically from entity definitions, allowing runtime schema changes. Use async-graphql if you prefer compile-time types and donβt need REST.
4. Poem + poem-openapi (Alternative to Axum)
Best for: OpenAPI-first development with automatic route generation
use poem_openapi::{OpenApi, payload::Json};
struct Api;
#[OpenApi]
impl Api {
#[oai(path = "/users", method = "get")]
async fn list_users(&self) -> Json<Vec<User>> {
// Implementation
}
}
Pros:
- β
OpenAPI-first approach
- β
Automatic route generation from annotations
- β
Less boilerplate than pure Axum
Cons:
- β Smaller ecosystem than Axum
- β No automatic relationship management
- β No GraphQL support
When to choose: OpenAPI-first development, REST-only
5. SeaORM / Diesel (Database-focused)
Best for: Database-centric applications with complex queries
use sea_orm::*;
let users = Users::find()
.find_with_related(Cars)
.all(&db)
.await?;
Pros:
- β
Native database relationships (joins, eager loading)
- β
Type-safe queries
- β
Migrations
- β
Excellent for complex DB operations
Cons:
- β No API layer (just ORM)
- β Tightly coupled to database schema
- β No automatic REST/GraphQL generation
When to choose: Database-heavy application, complex SQL queries
vs this-rs: this-rs focuses on API layer (routing, links, multi-protocol). You can combine SeaORM with this-rs: use SeaORM for data access, this-rs for API exposure.
π Feature Comparison Matrix
| Feature |
this-rs |
Pure Axum |
Axum + utoipa |
async-graphql |
Poem-openapi |
SeaORM |
| REST API |
β
Auto |
βοΈ Manual |
βοΈ Manual |
β |
β
Auto |
β |
| GraphQL API |
β
Auto |
β |
β |
β
Manual |
β |
β |
| Multi-protocol |
β
|
β |
β |
β |
β |
β |
| Auto-routing |
β
|
β |
β οΈ Partial |
β οΈ Partial |
β
|
β |
| Link management |
β
|
β |
β |
β |
β |
β
(DB) |
| Link enrichment |
β
|
β |
β |
β |
β |
β οΈ Eager load |
| Bidirectional nav |
β
|
β |
β |
β |
β |
β οΈ Relations |
| Dynamic schema |
β
|
β |
β οΈ OpenAPI |
β |
β οΈ OpenAPI |
β |
| OpenAPI docs |
β οΈ Possible |
β οΈ Manual |
β
Auto |
β |
β
Auto |
β |
| Learning curve |
Medium |
Low |
Low-Med |
Medium |
Medium |
Medium-High |
| Ecosystem size |
Small |
Large |
Large |
Medium |
Small |
Large |
| Explicitness |
Medium |
High |
High |
Medium |
Medium |
High |
| Best for entities |
5+ |
Any |
Any |
Any |
Any |
Any |
Legend:
- β
Full support
- β οΈ Partial support
- βοΈ Manual implementation required
- β Not supported
π― When to Use this-rs
β
this-rs is the Best Choice
- Many entities with complex relationships
- 10+ entities with many-to-many relationships
- Need bidirectional navigation
- Example: CMS, ERP, e-commerce platform
- Multi-protocol requirements
- Need both REST and GraphQL
- Same entities exposed via both protocols
- Example: Public API (REST) + admin dashboard (GraphQL)
- Rapidly evolving domain
- Adding entities frequently
- Need consistency across entities
- Example: Startup with changing requirements
- Microservices with shared patterns
- Multiple microservices with similar structure
- Want consistent routing across services
- Example: Microservices architecture with entity-based services
β οΈ this-rs Might Be Overkill
- Simple CRUD API
- 1-5 entities with basic operations
- Few/no relationships
- Use Axum or Axum + utoipa
- GraphQL-only with static types
- Donβt need REST
- Types known at compile-time
- Use async-graphql
- Database-centric with complex queries
- Heavy SQL/query logic
- Less focus on API routing
- Use SeaORM/Diesel + minimal Axum
- Learning Rust web development
- First Rust web project
- Want to understand fundamentals
- Start with pure Axum, add this-rs later if needed
π° Cost-Benefit Analysis
| Approach |
Lines of Code |
Dev Time |
Maintenance |
Learning |
| Pure Axum |
~300 lines |
2-3 hours |
Easy |
Low |
| this-rs |
~350 lines |
4-5 hours |
Medium |
Medium |
Verdict: Pure Axum wins for small APIs
For a 10-Entity API with 15 Relationships
| Approach |
Lines of Code |
Dev Time |
Maintenance |
Learning |
| Pure Axum |
~2000 lines |
20 hours |
Hard (repetitive) |
Low |
| this-rs |
~400 lines |
10 hours |
Easy (consistent) |
Medium |
Verdict: this-rs provides significant value
For a 20-Entity Microservices Architecture
| Approach |
Lines of Code |
Dev Time |
Maintenance |
Learning |
| Pure Axum |
~5000 lines |
50+ hours |
Very hard |
Low |
| this-rs |
~800 lines |
20 hours |
Easy |
Medium |
Verdict: this-rs is highly recommended
π Migration Paths
Starting Simple β Scaling Later
Recommended approach:
- Start with pure Axum (1-3 entities)
- Learn Rust web fundamentals
- Understand your domain
- Add helpers as needed (3-5 entities)
- Create your own macros for repetitive code
- Add utoipa for OpenAPI docs
- Consider this-rs (5+ entities)
- When relationships become complex
- When boilerplate becomes painful
- When you need multi-protocol support
Migrating TO this-rs
this-rs is designed to complement existing code:
- β
Keep your existing handlers
- β
Keep your entity definitions (wrap with macros)
- β
Gradually migrate routes to auto-registration
- β
Add GraphQL incrementally
You donβt need to rewrite everything!
Migrating FROM this-rs
If this-rs isnβt working for you:
- β
Handlers are standard Axum handlers (reusable)
- β
Entity types are standard Rust structs (portable)
- β
Just remove the framework, keep the business logic
- β οΈ Youβll need to manually implement routing
π Real-World Recommendations
Scenario 1: Simple Blog API
- Entities: User, Post, Comment (3 entities)
- Relationships: Few, simple
- Recommendation: Pure Axum or Axum + utoipa
- Reasoning: this-rs adds unnecessary complexity
- Entities: Product, Category, Order, OrderItem, User, Address, Payment, Review, Cart, Wishlist (10+ entities)
- Relationships: Many, complex (many-to-many)
- Recommendation: this-rs
- Reasoning: Significant routing boilerplate, many relationships
Scenario 3: Social Network
- Entities: User, Post, Comment, Like, Follow, Message, Group, Event (8+ entities)
- Relationships: Complex, bidirectional
- Recommendation: this-rs
- Reasoning: Bidirectional navigation, link enrichment valuable
Scenario 4: GraphQL-only Admin Dashboard
- Entities: Known at compile-time
- Relationships: Simple
- Recommendation: async-graphql
- Reasoning: No REST needed, compile-time types preferred
Scenario 5: Reporting/Analytics API
- Entities: Few, complex queries
- Relationships: Mainly database-level
- Recommendation: SeaORM + Axum
- Reasoning: Focus on DB queries, not API routing
π Final Recommendations
Use this-rs if:
- β
5+ entities with CRUD
- β
Many relationships (especially many-to-many)
- β
Need bidirectional navigation
- β
Want both REST and GraphQL
- β
Microservices with similar patterns
Use Pure Axum if:
- β
< 5 entities
- β
Few/simple relationships
- β
Learning Rust web development
- β
Need maximum control
- β
Performance is critical
Use Axum + utoipa if:
- β
REST-only
- β
Need OpenAPI documentation
- β
Want explicit routing
Use async-graphql if:
- β
GraphQL-only
- β
Types known at compile-time
- β
Need subscriptions
Use SeaORM if:
- β
Database-centric
- β
Complex SQL queries
- β
Focus on data layer
π¬ Questions to Ask Yourself
Before choosing this-rs, ask:
- How many entities will I have?
- < 5 β Consider alternatives
- 5-10 β this-rs could help
- 10+ β this-rs highly recommended
- How many relationships?
- Few/simple β Consider alternatives
- Many/complex β this-rs helps a lot
- Do I need both REST and GraphQL?
- Yes β this-rs is great
- No β Consider specialized tools
- Am I learning Rust?
- Yes β Start with Axum
- No β this-rs is fine
- Is my domain rapidly changing?
- Yes β this-rs consistency helps
- No β Less critical
π Still Not Sure?
Weβre happy to help you choose the right tool, even if itβs not this-rs! π―
Made with β€οΈ and honesty by the this-rs community