Skip to content

A minimal boilerplate for building RESTful APIs in Rust, featuring Axum, Tokio Async, SQLx, and a ready-to-use Docker Compose environment.

License

Notifications You must be signed in to change notification settings

tomdkt/rust-kickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Kickstart

Minimal REST API with Axum, PostgreSQL and modular architecture.

Features

  • Modular Architecture: Clean layers (Domain → Repository → Service → Controller)
  • Type Safety: Compile-time architecture enforcement
  • PostgreSQL: SQLx with migrations and query validation
  • OpenAPI: Auto-generated documentation
  • Testing: Isolated test schemas

📖 Architecture details: ARCHITECTURE.md

Quick Start

    make db    # Setup database
    make dev   # Start server with hot reload

Server: http://127.0.0.1:3000 | Docs: /swagger-ui

Commands

  • make dev - Development server
  • make db - Database setup (idempotent)
  • make test - Run tests
  • make check - Format, lint, test

Database

SQLx with compile-time checking. Always commit .sqlx/ directory.

    sqlx migrate add new_table  # Create migration
    make db                     # Apply migrations + update cache

API Endpoints

User Management

  • POST /users - Create user
  • GET /users - List users
  • GET /users/{id} - Get user
  • PUT /users/{id} - Update user
  • DELETE /users/{id} - Delete user

Health Monitoring

  • GET /health - Complete health check (application + database)
  • GET /ready - Readiness probe (Kubernetes-compatible)
  • GET /live - Liveness probe (application only)

Requirements

  • Rust
  • Docker
  • SQLx CLI: cargo install sqlx-cli --no-default-features --features postgres
  • cargo-watch: cargo install cargo-watch (for development server)

License

MIT

About

A minimal boilerplate for building RESTful APIs in Rust, featuring Axum, Tokio Async, SQLx, and a ready-to-use Docker Compose environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published