Engineering
rust avatar

rust

Implement robust Rust backend services using Axum, SQLx, and thiserror with production-grade patterns.

Introduction

This skill provides a standardized framework for developing high-performance, type-safe backend services in Rust. It is designed for engineers building scalable APIs who need reliable patterns for request handling, database interactions, and error management. By leveraging the Axum web framework, the skill ensures that route handlers are both ergonomic and performant, utilizing Tokio for asynchronous task execution. It enforces consistent project structures, including domain-driven separation of repositories, services, and models, which simplifies maintenance for growing codebases.

The skill specifically focuses on integrating production-standard libraries like SQLx for compile-time verified SQL queries and thiserror for expressive, structured error hierarchies. It automates common backend requirements such as configuration management, JWT authentication foundations, CORS setup, and graceful shutdown sequences. Developers can use this skill to rapidly bootstrap new services or refactor existing ones to follow current industry best practices for Rust web development.

  • Implements high-performance HTTP services using Axum and Tower middleware.

  • Provides robust data access patterns with SQLx, including connection pooling and schema migrations.

  • Facilitates clean error propagation through the thiserror crate and custom IntoResponse implementations.

  • Standardizes project architecture with dedicated modules for domain models, data repositories, and business logic.

  • Simplifies configuration handling via environment variables with strong typing using serde.

  • Supports validation-heavy DTOs with the validator crate for secure input handling.

  • Always ensure environment variables are configured before initializing the application via Config::from_env.

  • Use the provided error.rs pattern to map domain-specific errors to appropriate HTTP status codes.

  • Integrate database migrations in main.rs to ensure the schema is current at startup.

  • Keep business logic in services/ and data persistence in repositories/ to maintain testability.

  • Leverage #[derive(FromRow)] and #[derive(Validate)] to reduce boilerplate code when processing user input and database records.

Repository Stats

Stars
255
Forks
31
Open Issues
7
Language
TypeScript
Default Branch
main
Sync Status
Idle
Last Synced
Apr 29, 2026, 02:13 PM
View on GitHub