A NestJS backend service for Zora onramp functionality with Telegram notifications, Flutterwave payment integration, and smart contract interactions.
src/
├── app.controller.ts # Root endpoint with server status
├── app.module.ts # Main application module
├── app.service.ts # Server status service
├── main.ts # Application bootstrap
├── config/
│ └── configuration.ts # Environment configuration
├── contracts/
│ ├── contracts.module.ts # Smart contract module
│ └── contracts.service.ts # Contract interaction service
├── flutterwave/
│ ├── flutterwave.module.ts # Payment provider module
│ └── flutterwave.service.ts # Payment processing service
├── health/
│ └── health.controller.ts # Health check endpoints
├── orders/
│ ├── dto/
│ │ └── create-order.dto.ts # Order creation DTO
│ ├── entities/
│ │ └── order.entity.ts # Order entity definition
│ ├── order-cleanup.service.ts # Automatic order expiration
│ ├── orders.controller.ts # Order management endpoints
│ ├── orders.module.ts # Order module
│ ├── orders.repository.ts # Order data repository
│ └── orders.service.ts # Order business logic
├── telegram/
│ ├── telegram.module.ts # Telegram notification module
│ └── telegram.service.ts # Telegram bot service
├── webhooks/
│ ├── webhook.module.ts # Webhook handling module
│ ├── webhooks.controller.ts # Webhook endpoints
│ └── webhooks.service.ts # Webhook processing service
└── zora/
├── zora.module.ts # Zora integration module
└── zora.service.ts # Zora blockchain service
GET /- Server status and information
GET /api/health- Detailed health checkGET /api/health/ping- Simple ping test
POST /api/orders/create- Create new orderGET /api/orders/:orderId- Get order detailsGET /api/orders- List all ordersPOST /api/orders/:orderId/verify-payment- Verify payment
POST /api/webhooks/flutterwave- Flutterwave payment webhookPOST /api/webhooks/test- Test webhook endpoint
- Real-time notifications for order activities
- Payment success/failure alerts
- Server event monitoring
- Beautifully formatted messages with emojis
- Flutterwave integration
- Virtual account creation
- Payment verification
- Webhook handling
- USDC calculations
- Order creation on blockchain
- USDC release functionality
- Contract balance monitoring
- Complete order lifecycle
- Status tracking (pending, confirmed, completed, failed, expired)
- Automatic order expiration (15 minutes)
- Error handling
- Data persistence
# Server
PORT=3002
# Flutterwave
FLUTTERWAVE_PUBLIC_KEY=your_public_key
FLUTTERWAVE_SECRET_KEY=your_secret_key
FLUTTERWAVE_ENCRYPTION_KEY=your_encryption_key
FLUTTERWAVE_SECRET_HASH=your_secret_hash
FLUTTERWAVE_BVN=your_bvn
# Blockchain
RPC_URL=https://mainnet.base.org
CONTRACT_ADDRESS=your_contract_address
OPERATOR_PRIVATE_KEY=your_private_key
USDC_ADDRESS=your_usdc_address
# Exchange
NGN_TO_USD_RATE=1650
# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id
# CORS
CORS_ORIGIN=http://localhost:3002# Install dependencies
npm install
# Build the application
npm run build
# Start the server
npm run start
# Development mode
npm run start:devThe Telegram bot sends notifications for:
- 🆕 Order Created: New order with payment amount
- ✅ Payment Success: Payment completed, USDC received
- ❌ Payment Failed: Payment failed with error details
- ⏰ Order Cancelled: Order expired due to timeout
- 🔔 Server Events: Security alerts and system events
- ✅ No redundant files or test scripts
- ✅ Clean module structure
- ✅ Proper error handling
- ✅ TypeScript compilation successful
- ✅ All endpoints working
- ✅ Telegram notifications functional
- ✅ No linting errors