A high-performance API template built with Axum, designed for rapid development of secure and maintainable web services.
- 🚀 Production-Ready Fast and minimalistic web framework
- 🔐 JWT Authentication Secure token-based authentication system
- ⏰ Cron Scheduler
Built-in task scheduling with
tokio-cron-scheduler
- 📦 ORM Integration Database operations via SeaORM with PostgreSQL
- 📡 Observability Integrated tracing and structured logging
- 🛡️ Security CORS middleware and secure headers
- 🐳 Minimal docker image 12.9MB Docker image with Alpine base
Core Components:
- Axum 0.6 (Web Framework)
- SeaORM 1.x (PostgreSQL ORM)
- JSON Web Tokens (JWT)
- Tokio 1.x (Async Runtime)
Infrastructure:
- Dockerized deployment
- Multi-stage build optimization
- Alpine Linux base image
-
Environment Setup
cp .env.sample .env # Update variables in .env file
-
Database Setup
Ensure PostgreSQL is running with credentials matching your .env configuration.
Initialize the database and table: sys_tables
-
Run with Docker
docker-compose up --build -d
curl -X POST http://localhost:6000/api/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"your_password"}'
curl -X GET http://localhost:6000/api/claims \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
CRONTAB_EXAMPLE="*/5 * * * * *" # Every 5 seconds
Task implementations are in [schedule::example](./src/schedule/mod.rs)
.
Build optimized binary:
cargo build --release
Run tests (ensure test database is configured):
cargo test -- --test-threads=1
License: MIT