domain-web_skill

This skill helps you design and implement fast, secure web services in Rust using async, state management, and middleware patterns.
  • Shell

565

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill zhanghandong/rust-skills --skill domain-web

  • SKILL.md4.1 KB

Overview

This skill captures domain constraints and practical patterns for building HTTP web services in Rust. It distills rules about async handling, state management, request lifecycle, observability, and security into actionable design implications. Use it to align API code, middleware, and framework choices with production requirements.

How this skill works

The skill inspects domain rules (stateless HTTP, concurrency, latency SLA, security, observability) and maps them to Rust design constraints and idiomatic implementations. It guides choice of frameworks, crates, and patterns—extractors, shared state, middleware/tower layers, and error handling—so handlers remain async, thread-safe, and observable. Concrete code patterns show how to wire State, Json extractors, and IntoResponse error conversions.

When to use it

  • Designing a new REST or GraphQL API in Rust
  • Selecting a web framework (axum, actix-web, warp, rocket) for project needs
  • Implementing shared application state and request extractors
  • Building middleware for tracing, CORS, auth, or rate limiting
  • Hardening handlers for async performance and error responses

Best practices

  • Make all handlers async; offload CPU work with spawn_blocking
  • Keep shared state Send + Sync using Arc and locks (Arc<RwLock<T>> when mutable)
  • Use typed extractors (State, Json) for validation and ownership per request
  • Implement unified error types with IntoResponse for consistent HTTP replies
  • Compose middleware as tower layers for cross-cutting concerns and tracing

Example use cases

  • Axum-based REST API with Arc<DbPool> in State and Json payload extractors
  • Adding JWT authentication middleware and IntoResponse error mapping
  • Creating high-throughput services with actix-web and async handlers
  • Building composable filters in warp for small, expressive endpoints
  • Integrating tracing and rate limiting via tower layers in a gateway

FAQ

No—Rc is not Send + Sync. Use Arc (and Arc<RwLock<T>> for mutable state) so handlers can run on any thread.

How do I avoid blocking the runtime in handlers?

Keep handlers async and move blocking or CPU-heavy work into spawn_blocking or dedicated worker threads.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
domain-web skill by zhanghandong/rust-skills | VeilStrat