A Rust-based payment processing system built with Axum web framework, featuring async/await throughout and PostgreSQL for data persistence.
- RESTful API for payment processing
- Paystack payment gateway integration
- PostgreSQL database with connection pooling
- Async/await implementation with Tokio runtime
- Modular gateway architecture for easy payment provider additions
- Rust (latest stable version)
- PostgreSQL database
- Environment variables configured (see Configuration section)
-
Clone and setup
git clone https://github.com/BiliqisO/payment-processing-system.git cd payment-processing-system -
Configure environment Create a
.envfile with:DATABASE_URL=postgresql://username:password@localhost/dbname PAYSTACK_SECRET_KEY=your_paystack_secret_key -
Build and run
cargo build cargo run
The server will start on localhost:3000.
cargo build # Build the project
cargo run # Run the application
cargo check # Check code without building
cargo run --release # Run with optimizationscargo fmt # Format code
cargo clippy # Run linter
cargo test # Run testsPOST /pay- Initialize payment transaction{ "user_id": "uuid", "email": "string", "amount": number }
- API Layer (
src/api/): Axum HTTP handlers and routing - Database Layer (
src/db/): SQLx models and schema definitions - Services Layer (
src/services/): Business logic and payment gateway integrations - Configuration (
src/config.rs): Environment-based app configuration
- User: UUID, email, timestamps
- Wallet: User balance and currency tracking
- Transaction: Payment records with gateway references
- Paystack: Fully implemented with amount conversion (Naira to Kobo)
- Modular design allows easy addition of new payment providers
Required environment variables:
DATABASE_URL: PostgreSQL connection stringPAYSTACK_SECRET_KEY: Paystack API secret key
When adding new features:
- Follow existing async patterns
- Use SQLx for database operations
- Implement proper error handling
- Add new payment gateways in
src/services/gateways/