Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust REST API Lite

A starter template for building a REST API with extreme performance and an extremely small memory footprint. Built using Axum, SQLx (PostgreSQL), and Utoipa. Optimized specifically for AI Vibe Coding, Zero Errors, and Alpine Linux Deployment.

Extreme Efficiency Philosophy

The Cargo.toml in this template has been stripped of all heavy default-features. We utilize Tokio's single-threaded runtime (new_current_thread) to guarantee the lowest possible memory footprint. The entire application, including database connection pooling, requires less than 5MB of RAM under heavy load.

Key Features

  • Alpine Static Binary: Natively compiles to x86_64-unknown-linux-musl for incredibly small, dependency-free deployments on Alpine Linux VPS.
  • SQL Compile-Time Checking: Using SQLx, your database queries are validated at compile time.
  • Centralized Error Handling: Handlers are extremely clean thanks to a centralized AppError in src/error.rs.
  • Feature-Based Architecture: The src/modules/* folder structure ensures rapid iteration.
  • Auto API Docs: Built-in Utoipa SwaggerUI at /swagger-ui.

AI Vibe Coding Guidelines

IMPORTANT: If you are using an AI Agent (Cursor, Windsurf, Antigravity, etc.), please instruct the AI to read AI_RULES.md before making any modifications.

  1. Create new features inside src/modules/<feature_name>/ (handlers.rs, models.rs).
  2. Use ? with AppError for all error propagation.
  3. Register routes in src/lib.rs and update the Utoipa ApiDoc struct.

How to Run

This project uses a standard Makefile for streamlined development.

  1. Setup Environment:
    cp .env.example .env
    # Adjust DATABASE_URL inside .env
  2. Development:
    make dev
  3. Production Build (Alpine Static):
    make build
  4. Stress Testing:
    make stress-test

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages