
Domain Web
Covers the fundamental constraints of building web services in Rust: why handlers must be async, how to manage shared state with Arc, and when to use type-safe extractors for validation. The framework comparison (axum vs actix vs warp) is helpful if you're still choosing, but the real value is in the constraint-to-implementation traces. It shows you why blocking code kills latency and why Rc doesn't work in handler state. The error handling pattern with IntoResponse is solid boilerplate you'll actually use. Think of this as the bridge between "I need a REST API" and understanding why the borrow checker is yelling at you about Send bounds.
- skills.sh installs
- 648
- GitHub stars
- 1.3K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add zhanghandong/rust-skills --skill domain-web --agent claude-codeInstalls into .claude/skills of the current project.
Files
Web Domain
Layer 3: Domain Constraints
Domain Constraints → Design Implications
| Domain Rule | Design Constraint | Rust Implication |
|---|---|---|
| Stateless HTTP | No request-local globals | State in extractors |
| Concurrency | Handle many connections | Async, Send + Sync |
| Latency SLA | Fast response | Efficient ownership |
| Security | Input validation | Type-safe extractors |
| Observability | Request tracing | tracing + tower layers |
Critical Constraints
Async by Default
RULE: Web handlers must not block
WHY: Block one task = block many requests
RUST: async/await, spawn_blocking for CPU work
State Management
RULE: Shared state must be thread-safe
WHY: Handlers run on any thread
RUST: Arc<T>, Arc<RwLock<T>> for mutable
Request Lifecycle
RULE: Resources live only for request duration
WHY: Memory management, no leaks
RUST: Extractors, proper ownership
Trace Down ↓
From constraints to design (Layer 2):
"Need shared application state"
↓ m07-concurrency: Use Arc for thread-safe sharing
↓ m02-resource: Arc<RwLock<T>> for mutable state
Sponsors
Details
- Repository
- github.com/zhanghandong/rust-skills
- Category
- Rust
More from zhanghandong/rust-skills
All 34- Meta Cognition Parallel635
- Rust Daily635
- Domain Embedded625
- Domain Cloud Native596
- Domain Fintech581
- Domain Ml573
- Domain Iot568
- M15 Anti Pattern5.6K
- Coding Guidelines1.2K
- M10 Performance895
- M07 Concurrency844
- M06 Error Handling827
- Rust Refactor Helper821
- M01 Ownership809
- M04 Zero Cost789
- M05 Type Driven786
- M02 Resource783
- M03 Mutability773
- M12 Lifecycle764
- M14 Mental Model751
- M09 Domain750
- M11 Ecosystem747
- M13 Domain Error738
- Rust Trait Explorer731