A Backend-only e-commerce system built with Rust and Actix Web, designed with a Modular Monolith architecture for selling custom mechanical keyboards and accessories.
- Rust 1.70+
- PostgreSQL 12+
Configure Environment.
cp .env.example .env
# Edit .env with your database credentialsCreate database.
createdb prototype_actix_web
# Run migrations (automatically handled on startup)Run the Application.
cargo runThe server will start on http://localhost:8080
Visit http://localhost:8080/swagger-ui/ for interactive API documentation.
# Modular Structure
src/
├── main.rs # Application entry point
├── lib.rs # Library exports
├── core/ # Shared functionality
│ ├── config.rs # Configuration management
│ ├── database.rs # Database connection
│ ├── error.rs # Error handling
│ └── middleware/ # Custom middleware
├── catalog/ # Product catalog module
├── orders/ # Order processing module
├── users/ # User management module
├── payments/ # Payment processing module
└── shipping/ # Shipping calculations moduleEach module contains:
models.rs- Data structures and DTOsroutes.rs- HTTP route handlersservices.rs- Business logicdb.rs- Database operations
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- User login
GET /api/v1/products- List products (filterable by category)POST /api/v1/products- Create productGET /api/v1/products/{id}- Get product details
POST /api/v1/orders- Create orderGET /api/v1/orders- Get user ordersGET /api/v1/orders/{id}- Get order details
POST /api/v1/payments/intents- Create payment intentGET /api/v1/payments/intents/{id}- Get payment statusPOST /api/v1/payments/intents/{id}/confirm- Confirm payment
POST /api/v1/shipping/calculate- Calculate shipping rates
This project is under the MIT License.
Enjoy! 🎉