The FusePay Backend powers a smart peer-to-peer utility marketplace that allows users to buy, sell, and manage digital utilities such as airtime, mobile data, and bill payments.
This service handles authentication, wallet management, marketplace operations, transaction processing, and integrations with external providers.
The backend is responsible for:
- User authentication and authorization
- Wallet balance and escrow management
- Marketplace listings (P2P trading)
- Trade execution and transaction tracking
- Airtime resale processing
- Utility bill payments (electricity, water, TV)
- Integration with payment and telecom APIs
- Node.js
- NestJS (recommended) or Express
- PostgreSQL (database)
- Redis (caching, queues)
- REST API
src/ ├── modules/ │ ├── auth/ # Authentication (JWT, login, register) │ ├── users/ # User profile management │ ├── wallet/ # Wallet logic (balance, escrow) │ ├── marketplace/ # Listings (create, fetch, expire) │ ├── trades/ # Trade execution engine │ ├── airtime/ # Airtime resale flow │ ├── bills/ # Utility bill payments │ └── notifications/ # Alerts (email, push, SMS) │ ├── integrations/ │ ├── payments/ # Payment gateways (Paystack, etc.) │ └── utilities/ # Airtime/data APIs │ ├── database/ │ ├── entities/ # ORM models (User, Wallet, Listing, etc.) │ ├── migrations/ # DB migrations │ └── seeds/ # Seed data │ ├── common/ │ ├── guards/ # Auth guards │ ├── filters/ # Error handling │ ├── interceptors/ # Logging, response formatting │ └── utils/ # Helper functions │ ├── config/ # Environment config ├── jobs/ # Cron jobs (expiry, retries) └── main.ts # App entry point
Handles user registration, login, and JWT authentication.
Endpoints:
- POST /auth/register
- POST /auth/login
- GET /auth/me
Manages user balances and escrow.
Features:
- Fund wallet
- View balance
- Lock/unlock funds for trades
Handles P2P listings.
Features:
- Create listing
- Fetch listings
- Expiry logic (auto-expire based on time)
Handles the full transaction lifecycle:
Flow:
-
Buyer initiates purchase
-
System checks balance
-
Funds are locked (escrow)
-
Utility API is called
-
If successful:
- Seller is credited
-
If failed:
- Buyer is refunded
Handles airtime-to-cash conversion.
Flow:
- User submits airtime request
- System provides recipient number
- User sends airtime
- Transaction is verified
- Wallet is credited
Handles utility payments:
- Electricity
- Water
- TV subscriptions
Flow: User enters details → backend calls provider API → returns success/token
users wallets listings trades transactions airtime_sales bill_payments
- Payment Gateway: Paystack (wallet funding)
- Telecom APIs: Reloadly or similar providers
Located in /jobs/
Includes:
- Expire listings after deadline
- Retry failed transactions
- Send notifications
npm installnpm run start:devCreate a .env file:
DATABASE_URL=
JWT_SECRET=
PAYSTACK_SECRET_KEY=
UTILITY_API_KEY=
REDIS_URL=- Ensure transaction reliability
- Maintain data integrity
- Provide secure APIs
- Handle integrations with external services
- Manage escrow and trade execution
This backend supports the MVP features:
- User authentication
- Wallet funding and balance
- Data/airtime purchase
- Marketplace listings
- Trade execution (escrow logic)
- Airtime resale
- Bill payments
- Blockchain escrow integration (Stellar Soroban)
- AI-based price recommendations
- Advanced fraud detection
- Real-time notifications (WebSockets)
Please follow the CONTRIBUTING.md guidelines when contributing to this project.