Skip to content

Commit bf45c45

Browse files
docs: Add comprehensive framework comparison documentation
1 parent 4253303 commit bf45c45

2 files changed

Lines changed: 389 additions & 0 deletions

File tree

docs/framework-comparison.md

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
# Core Web vs. Other Rust Web Frameworks
2+
3+
This document provides a detailed comparison between Core Web and other popular Rust web frameworks, highlighting the unique features and advantages of Core Web.
4+
5+
## Overview
6+
7+
Core Web is not just a web framework, but a complete, production-ready platform that includes multiple protocols, advanced security features, enterprise-grade observability, and multi-database integration. While frameworks like Axum and Rocket focus primarily on HTTP handling, Core Web provides a comprehensive solution for building scalable, secure web applications.
8+
9+
## Comparison with Axum
10+
11+
### Core Features
12+
13+
| Feature | Core Web | Axum |
14+
|---------|----------|------|
15+
| HTTP Framework | Built on Axum | Axum |
16+
| Multi-Protocol Support | REST, GraphQL, gRPC, WebSocket | HTTP only |
17+
| Authentication | JWT, OIDC, API Keys | Manual implementation |
18+
| Authorization | RBAC/ABAC with Casbin/Cedar | Manual implementation |
19+
| Caching | Moka (in-memory) + Redis (distributed) | Manual implementation |
20+
| Database Integration | MySQL, Redis, MongoDB, ClickHouse | Manual implementation |
21+
| Observability | OpenTelemetry (tracing, metrics, logs) | Manual implementation |
22+
| Resilience Patterns | Retry, Circuit Breaker, Bulkhead | Manual implementation |
23+
| Rate Limiting | Token bucket algorithm | Manual implementation |
24+
| Security Headers | HSTS, CSP, CORS/CSRF protection | Manual implementation |
25+
26+
### Architecture
27+
28+
**Axum**:
29+
- Lightweight, modular framework focused on HTTP request handling
30+
- Built on tokio and hyper
31+
- Emphasizes type safety and performance
32+
- Requires manual integration of additional components
33+
34+
**Core Web**:
35+
- Full-stack platform with integrated components
36+
- Built on Axum as the HTTP foundation
37+
- Includes enterprise-grade features out of the box
38+
- Provides opinionated architecture for production systems
39+
40+
### Use Cases
41+
42+
**Axum** is ideal for:
43+
- Simple APIs and microservices
44+
- Projects requiring maximum flexibility
45+
- Developers who prefer to build their own stack
46+
- Lightweight applications with minimal dependencies
47+
48+
**Core Web** is ideal for:
49+
- Enterprise applications requiring security and compliance
50+
- Projects needing multi-protocol support
51+
- Teams wanting to reduce development time with pre-built components
52+
- Applications requiring comprehensive observability
53+
- Projects with complex authorization requirements
54+
55+
## Comparison with Rocket
56+
57+
### Core Features
58+
59+
| Feature | Core Web | Rocket |
60+
|---------|----------|--------|
61+
| HTTP Framework | Axum-based | Rocket-specific |
62+
| Request Handling | Extractors | Guards |
63+
| Response Types | Type-safe | Type-safe |
64+
| Middleware | Tower-based | Fairings |
65+
| Routing | Macro-based | Attribute-based |
66+
| Testing | Built-in test utilities | Built-in test utilities |
67+
| Async Support | Full async/await | Async via tokio |
68+
| Compile-time Checks | Extensive | Moderate |
69+
70+
### Design Philosophy
71+
72+
**Rocket**:
73+
- Developer experience focused
74+
- Convention over configuration
75+
- Magic through code generation
76+
- Easy to get started with
77+
- Opinionated framework design
78+
79+
**Core Web**:
80+
- Production readiness focused
81+
- Explicit configuration over convention
82+
- No hidden magic
83+
- Comprehensive feature set
84+
- Modular architecture
85+
86+
### Performance
87+
88+
Both frameworks offer excellent performance, but with different trade-offs:
89+
90+
**Rocket**:
91+
- Slightly higher compile times due to code generation
92+
- Runtime overhead is minimal
93+
- Excellent for rapid prototyping
94+
95+
**Core Web**:
96+
- Optimized for production workloads
97+
- Lower runtime overhead due to explicit design
98+
- Better suited for high-throughput applications
99+
100+
## Comparison with Actix Web
101+
102+
### Core Features
103+
104+
| Feature | Core Web | Actix Web |
105+
|---------|----------|-----------|
106+
| HTTP Framework | Axum-based | Actix-based |
107+
| Actor Model | Not included | Built-in |
108+
| WebSockets | Full support | Full support |
109+
| HTTP/2 | Supported | Supported |
110+
| Performance | Excellent | Excellent |
111+
| Middleware | Tower-based | Actix-specific |
112+
| Testing | Comprehensive | Good |
113+
114+
### Architecture Differences
115+
116+
**Actix Web**:
117+
- Built on the actor model
118+
- High performance through async/await
119+
- Mature ecosystem
120+
- Steeper learning curve due to actor concepts
121+
122+
**Core Web**:
123+
- Built on modern async/await patterns
124+
- Modular component architecture
125+
- Easier learning curve for newcomers
126+
- More comprehensive feature set
127+
128+
## Unique Advantages of Core Web
129+
130+
### 1. Multi-Protocol Support
131+
Unlike other frameworks that focus solely on HTTP, Core Web provides:
132+
- **REST API** with full CRUD operations
133+
- **GraphQL** with schema and resolvers
134+
- **gRPC** with Protocol Buffer service contracts
135+
- **WebSocket/SSE** for real-time communication
136+
137+
### 2. Enterprise-Grade Security
138+
Core Web includes comprehensive security features:
139+
- **Authentication**: JWT, OIDC, and API key support
140+
- **Authorization**: RBAC and ABAC with Casbin/Cedar
141+
- **Security Headers**: HSTS, CSP, CORS/CSRF protection
142+
- **Compliance**: Data protection regulation compliance
143+
144+
### 3. Multi-Database Integration
145+
Core Web provides seamless integration with multiple database systems:
146+
- **MySQL** - Primary transactional database
147+
- **Redis** - Caching, session storage, and pub/sub messaging
148+
- **MongoDB** - Document storage for flexible schemas
149+
- **ClickHouse** - Analytics and time-series data warehouse
150+
151+
### 4. Advanced Observability
152+
Core Web implements comprehensive observability:
153+
- **Distributed Tracing** with OpenTelemetry
154+
- **Metrics Collection** and dashboarding
155+
- **Structured Logging** with multiple output formats
156+
- **Health Checks** with Kubernetes-ready endpoints
157+
158+
### 5. Resilience Patterns
159+
Core Web includes proven resilience patterns:
160+
- **Retry Mechanisms** with exponential backoff
161+
- **Circuit Breaker** for fault tolerance
162+
- **Bulkhead** for resource isolation
163+
- **Timeout** for preventing resource exhaustion
164+
165+
### 6. Performance Optimization
166+
Core Web is optimized for high performance:
167+
- **Caching Layers**: In-memory (Moka) and Redis distributed caching
168+
- **Connection Pooling**: Efficient database connection management
169+
- **Async/Await**: Non-blocking I/O for maximum throughput
170+
- **Resource Management**: Memory-efficient data structures
171+
172+
## When to Choose Core Web
173+
174+
### Choose Core Web when you need:
175+
1. **Enterprise Features**: Security, observability, and compliance
176+
2. **Multi-Protocol Support**: REST, GraphQL, gRPC, and WebSockets
177+
3. **Multi-Database Integration**: MySQL, Redis, MongoDB, ClickHouse
178+
4. **Rapid Development**: Pre-built components reduce development time
179+
5. **Production Readiness**: Battle-tested patterns and best practices
180+
6. **Scalability**: Designed for horizontal scaling and high concurrency
181+
182+
### Choose Axum when you need:
183+
1. **Maximum Flexibility**: Build your own stack from scratch
184+
2. **Lightweight Applications**: Minimal dependencies and overhead
185+
3. **Custom Architecture**: Full control over component selection
186+
4. **Learning Rust**: Simpler framework to understand fundamentals
187+
188+
### Choose Rocket when you need:
189+
1. **Developer Experience**: Convention over configuration
190+
2. **Rapid Prototyping**: Quick to get started with
191+
3. **Type Safety**: Excellent compile-time guarantees
192+
4. **Expressive Syntax**: Clean, readable code
193+
194+
### Choose Actix Web when you need:
195+
1. **Maximum Performance**: Highest throughput requirements
196+
2. **Actor Model**: Applications benefiting from actor patterns
197+
3. **Mature Ecosystem**: Established community and libraries
198+
4. **WebSockets**: Heavy WebSocket usage
199+
200+
## Migration from Other Frameworks
201+
202+
### From Axum
203+
Migration from Axum is straightforward since Core Web is built on Axum:
204+
1. Existing Axum handlers can often be used directly
205+
2. Middleware may need adaptation to Tower-based system
206+
3. Benefit from added security and observability features
207+
208+
### From Rocket
209+
Migration requires more changes due to different design philosophies:
210+
1. Replace Rocket guards with Axum extractors
211+
2. Adapt routing from attribute-based to macro-based
212+
3. Reimplement authentication/authorization systems
213+
214+
### From Actix Web
215+
Migration involves significant changes:
216+
1. Replace actor patterns with async/await
217+
2. Adapt middleware to Tower-based system
218+
3. Reimplement routing and request handling
219+
220+
## Performance Benchmarks
221+
222+
While specific benchmarks depend on implementation details, Core Web's performance characteristics include:
223+
224+
### HTTP Throughput
225+
- Comparable to Axum and Actix Web for HTTP requests
226+
- Slight overhead from additional middleware (security, observability)
227+
- Optimized for real-world production scenarios
228+
229+
### Memory Usage
230+
- Efficient memory management through Rust's ownership system
231+
- Configurable caching strategies
232+
- Resource pooling for database connections
233+
234+
### Concurrency
235+
- Excellent async/await support
236+
- Thread-safe operations
237+
- Scalable to thousands of concurrent connections
238+
239+
## Ecosystem and Community
240+
241+
### Core Web
242+
- Newer project with growing community
243+
- Comprehensive documentation and examples
244+
- Active development with regular updates
245+
- Enterprise-focused support
246+
247+
### Axum
248+
- Backed by the Tokio team
249+
- Large, active community
250+
- Excellent documentation
251+
- Part of the broader Rust async ecosystem
252+
253+
### Rocket
254+
- Mature project with stable API
255+
- Strong community and ecosystem
256+
- Excellent documentation and guides
257+
- Academic backing and research
258+
259+
### Actix Web
260+
- One of the most popular Rust web frameworks
261+
- Large community and extensive ecosystem
262+
- Proven in production environments
263+
- Active development and maintenance
264+
265+
## Conclusion
266+
267+
Core Web differentiates itself by providing a complete, production-ready platform rather than just a web framework. While Axum, Rocket, and Actix Web excel in their respective domains, Core Web offers:
268+
269+
1. **Comprehensive Feature Set**: Security, observability, multi-protocol support
270+
2. **Enterprise Readiness**: Compliance, monitoring, and resilience patterns
271+
3. **Reduced Development Time**: Pre-built components and integrations
272+
4. **Scalability**: Designed for high-concurrency, distributed systems
273+
5. **Maintainability**: Opinionated architecture and best practices
274+
275+
Choose Core Web when you need a complete solution for building secure, scalable web applications. Choose other frameworks when you need maximum flexibility or have specific requirements that don't align with Core Web's architecture.
276+
277+
For teams looking to reduce time-to-market while maintaining high quality and security standards, Core Web provides an excellent foundation for modern web applications.

docs/quick-comparison.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Core Web Quick Comparison
2+
3+
A quick side-by-side comparison of Core Web with other popular Rust web frameworks.
4+
5+
## Feature Comparison Matrix
6+
7+
| Feature | Core Web | Axum | Rocket | Actix Web |
8+
|---------|----------|------|--------|-----------|
9+
| **Foundation** | Axum-based | Axum | Rocket | Actix |
10+
| **Multi-Protocol** | ✅ REST, GraphQL, gRPC, WebSocket | ❌ HTTP only | ❌ HTTP only | ❌ HTTP only |
11+
| **Authentication** | ✅ JWT, OIDC, API Keys | ❌ Manual | ❌ Manual | ❌ Manual |
12+
| **Authorization** | ✅ RBAC/ABAC | ❌ Manual | ❌ Manual | ❌ Manual |
13+
| **Caching** | ✅ Moka + Redis | ❌ Manual | ❌ Manual | ❌ Manual |
14+
| **Multi-Database** | ✅ MySQL, Redis, MongoDB, ClickHouse | ❌ Manual | ❌ Manual | ❌ Manual |
15+
| **Observability** | ✅ OpenTelemetry (Tracing, Metrics, Logs) | ❌ Manual | ❌ Manual | ❌ Manual |
16+
| **Resilience Patterns** | ✅ Retry, Circuit Breaker, Bulkhead | ❌ Manual | ❌ Manual | ❌ Manual |
17+
| **Rate Limiting** | ✅ Token Bucket | ❌ Manual | ❌ Manual | ❌ Manual |
18+
| **Security Headers** | ✅ HSTS, CSP, CORS/CSRF | ❌ Manual | ❌ Manual | ❌ Manual |
19+
| **Health Checks** | ✅ Kubernetes-ready | ❌ Manual | ❌ Manual | ❌ Manual |
20+
| **Testing Utilities** | ✅ Comprehensive | ✅ Good | ✅ Good | ✅ Good |
21+
| **Async/Await** | ✅ Full support | ✅ Full support | ✅ Full support | ✅ Full support |
22+
| **Production Ready** | ✅ Enterprise-grade | ⚠️ Requires setup | ⚠️ Requires setup | ⚠️ Requires setup |
23+
24+
## Key Differentiators
25+
26+
### What Makes Core Web Unique?
27+
28+
1. **Complete Platform**: Not just a framework, but a full web platform
29+
2. **Multi-Protocol Support**: One codebase for REST, GraphQL, gRPC, and WebSocket
30+
3. **Enterprise Security**: Built-in authentication, authorization, and compliance
31+
4. **Observability First**: Comprehensive monitoring and tracing out of the box
32+
5. **Multi-Database Integration**: Seamless support for multiple database systems
33+
6. **Resilience Patterns**: Production-tested patterns for fault tolerance
34+
7. **Kubernetes Ready**: Built for containerized, cloud-native deployments
35+
36+
## When to Choose Each
37+
38+
### Choose Core Web for:
39+
- ✅ Enterprise applications
40+
- ✅ Multi-protocol requirements
41+
- ✅ Security and compliance needs
42+
- ✅ Rapid development with pre-built components
43+
- ✅ Observability and monitoring requirements
44+
- ✅ Multi-database applications
45+
46+
### Choose Axum for:
47+
- ✅ Maximum flexibility
48+
- ✅ Lightweight applications
49+
- ✅ Custom architecture requirements
50+
- ✅ Learning Rust web development fundamentals
51+
52+
### Choose Rocket for:
53+
- ✅ Developer experience focus
54+
- ✅ Rapid prototyping
55+
- ✅ Convention over configuration
56+
- ✅ Expressive, readable code
57+
58+
### Choose Actix Web for:
59+
- ✅ Maximum performance
60+
- ✅ Actor model applications
61+
- ✅ Mature ecosystem requirements
62+
- ✅ Heavy WebSocket usage
63+
64+
## Getting Started Time
65+
66+
| Framework | Time to Production API |
67+
|-----------|------------------------|
68+
| **Core Web** | Minutes (pre-built components) |
69+
| **Axum** | Hours/Days (manual setup) |
70+
| **Rocket** | Hours (convention-based) |
71+
| **Actix Web** | Hours/Days (manual setup) |
72+
73+
## Learning Curve
74+
75+
| Framework | Complexity |
76+
|-----------|------------|
77+
| **Core Web** | Moderate (comprehensive but well-documented) |
78+
| **Axum** | Low-Moderate (minimal but requires additional setup) |
79+
| **Rocket** | Low (convention-based, intuitive) |
80+
| **Actix Web** | Moderate-High (actor model concepts) |
81+
82+
## Performance
83+
84+
All frameworks offer excellent performance for most use cases. Specific requirements should be benchmarked for your particular use case.
85+
86+
| Framework | Performance | Notes |
87+
|-----------|-------------|-------|
88+
| **Core Web** | Excellent | Slight overhead from enterprise features |
89+
| **Axum** | Excellent | Minimal overhead |
90+
| **Rocket** | Excellent | Compile-time overhead from macros |
91+
| **Actix Web** | Excellent | Optimized for high throughput |
92+
93+
## Ecosystem Maturity
94+
95+
| Framework | Maturity | Community Size |
96+
|-----------|----------|----------------|
97+
| **Core Web** | Growing | Emerging |
98+
| **Axum** | Mature | Large |
99+
| **Rocket** | Mature | Large |
100+
| **Actix Web** | Mature | Very Large |
101+
102+
## Summary
103+
104+
**Core Web** stands out by providing a complete, production-ready platform that includes what other frameworks require you to build yourself. While other frameworks excel in specific areas, Core Web offers a balanced approach for teams that want to focus on business logic rather than infrastructure concerns.
105+
106+
Choose Core Web when you want to:
107+
- Reduce time-to-market
108+
- Ensure enterprise-grade security
109+
- Get comprehensive observability
110+
- Support multiple protocols
111+
- Integrate with multiple databases
112+
- Deploy to Kubernetes

0 commit comments

Comments
 (0)