Back to Selected Work
Backend MicroservicesRust (2024 Edition)Rust • Axum 0.8 • SQLx • OpenAPI 3.1

DeliveryKing E-Commerce Engine (Rust)

High-performance, modular asynchronous e-commerce backend built in Rust for resilient product catalogs, secure JWT authentication, and sub-millisecond queries.

Domain
Backend & Systems
My Role
Backend Systems Architect
Source Code
Primary Stack
Rust (2024), Axum 0.8
The Problem & Motivation

Why this was built

Traditional e-commerce backends built on heavy monolithic runtimes consume significant server memory, suffer from slow cold-starts, and incur runtime database query crashes due to weak type-safety guarantees.

Architecture & Execution

Technical Approach

Architected a lean, asynchronous backend in Rust (2024 Edition) using Axum and Tokio. Implemented compile-time verified SQL queries via SQLx against PostgreSQL, Argon2 password hashing, JWT authentication middleware, and auto-generated Swagger OpenAPI 3.1 documentation with Utoipa.

Technologies Used:
Rust (2024)Axum 0.8TokioSQLx 0.9PostgreSQLArgon2JWTDocker
DeliveryKing Axum Router & Type-Safe Database Query
Source Snapshot
// Asynchronous Axum route with type-safe SQLx query execution
pub async fn get_product_by_id(
    State(pool): State<PgPool>,
    Path(product_id): Path<Uuid>,
) -> Result<Json<ProductResponse>, (StatusCode, String)> {
    let product = sqlx::query_as!(
        ProductResponse,
        "SELECT id, title, price, stock, category_id, created_at FROM products WHERE id = $1",
        product_id
    )
    .fetch_optional(&pool)
    .await
    .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?
    .ok_or((StatusCode::NOT_FOUND, "Product not found".to_string()))?;

    Ok(Json(product))
}

Key Architectural Features & Outcomes

01

Built with Rust (2024 Edition) on Tokio multi-threaded asynchronous runtime

02

Compile-time verified SQL queries using SQLx and PostgreSQL

03

Interactive Swagger OpenAPI 3.1 live documentation via Utoipa

04

Argon2 secure password hashing and JWT token authentication middleware

05

Containerized deployment setup with Docker Compose