Full Stack Overview
Irion Pay utilizes a decentralized, monorepo architecture that combines high-performance blockchain logic with modern web technologies to provide a consumer-grade BNPL experience.
Technical Stack
| Layer | Technology |
|---|---|
| Blockchain | Algorand (AVM) |
| Smart Contracts | Python / PuyaTS |
| Frontend | Next.js 15, Tailwind CSS, Shadcn UI |
| Backend/API | Next.js API Routes (Serverless) |
| Database | MongoDB Atlas |
| SDK/Interactions | AlgoKit Utils, Algosdk |
System Diagram
graph TD
User([User]) <--> CoreApp[Irion Core Dashboard]
Shopper([Shopper]) <--> ShoppingApp[E-commerce Store]
Merchant([Merchant]) <--> MerchantApp[Merchant Portal]
ShoppingApp <--> APILayer[Next.js API Layer]
MerchantApp <--> APILayer
CoreApp <--> APILayer
APILayer <--> MongoDB[(MongoDB Atlas)]
APILayer <--> Algorand[Algorand Testnet/LocalNet]
subgraph Smart Contracts
Algorand <--> CreditScore[CreditScore Contract]
Algorand <--> LendingPool[LendingPool Contract]
Algorand <--> BNPL[BNPLCredit Contract]
Algorand <--> Escrow[MerchantEscrow Contract]
end
Core Architecture Components
1. Smart Contracts (The Engine)
The Algorand Virtual Machine (AVM) hosts the core logic. Transactions are processed in seconds with minimal fees, enabling the real-time checkout experience essential for BNPL.
2. Next.js API Layer (The Orchestrator)
The API layer acts as a bridge between the blockchain and the user-facing apps. It manages:
- Transaction Preparation: Building complex atomic groups for checkouts and repayments.
- Data Indexing: Syncing on-chain state to MongoDB for fast, searchable access.
- Merchant Verification: Authenticating cross-site checkout requests via CORS-enabled routes.
3. MongoDB Layer (The Memory)
While the blockchain is the source of truth for assets and debt, MongoDB stores auxiliary data like:
- Merchant profiles and product catalogs.
- High-frequency transaction history for the dashboard.
- Active user sessions and interaction logs.
Data Flows
The BNPL Checkout Flow
- Shopper: Selects "Pay with Irion" on the Shopping App.
- API: Checks the shopper's
CreditScoreand available limit on-chain. - Escrow: If approved, funds are moved from the
LendingPooltoMerchantEscrow. - Settlement: The Merchant receives USDC immediately, and a Loan entry is created for the Shopper.
The Repayment Flow
- User: Initiates repayment via Irion Core.
- Contract:
BNPLCreditcalculates the principal + interest due. - Distribution: Funds are transferred back to the
LendingPooland the loan is closed. - Credit Boost:
CreditScoreis updated automatically upon successful closure.