A programmable USSD application for receiving donations to communities within the AMANI J. Africa Foundation. This system enables donors to contribute to specific communities through an interactive USSD menu, supporting multiple donation purposes including Development, Education, Health, Water & Sanitation, Legal Aid, Disability, Chief's Gift, and Missions.
- Interactive USSD Menu Flow: Simple 3-step donation process via USSD
- Community-Based Donations: Donors can specify which community receives their donation using reference codes
- Multiple Donation Purposes: Support for 8 different donation categories
- Payment Integration: Seamless integration with Hubtel payment gateway
- Transaction Tracking: Complete audit trail of all donations and transactions
- SMS Notifications: Automatic SMS confirmations upon successful donations
- RESTful API: Full API for managing communities and viewing donations
- Secure Authentication: JWT-based authentication for admin endpoints
The donation process follows a simple 3-step flow:
AMANI J. Africa Foundation
Donate to which Community?
1. *Enter the community Reference code*...
Donation is for:
1. Development
2. Education
3. Health
4. Water & Sanitation
5. Legal Aid
6. Disability
7. Chief's Gift
8. Missions
Enter Amount: [User enters amount]
[Summary Display]
Community: [Community Name]
Purpose: [Selected Purpose]
Amount: GH [Amount]
1. Confirm
2. Cancel
You have successfully donated to your community. Thank you.
- Framework: NestJS (Node.js)
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Payment Gateway: Hubtel USSD API
- SMS Service: Integrated SMS provider
- Language: TypeScript
- Validation: class-validator, class-transformer
- Node.js >= 18.0.0
- MongoDB instance (local or cloud)
- Hubtel USSD account credentials
- SMS service credentials
-
Clone the repository
git clone <repository-url> cd ngo-ussd
-
Install dependencies
npm install
-
Configure environment variables Create a
.envfile in the root directory:# Database MONGODB_URI=mongodb://localhost:27017/ngo-ussd # JWT JWT_SECRETE=your-jwt-secret-key JWT_EXPIRY=500s # Hubtel HB_CALLBACK_URL=https://your-callback-url.com/api/v1/flow/ussd/callback HUB_ACCESS_TOKEN=your-hubtel-access-token # SMS Service SMS_URL=https://your-sms-provider-url SMS_CLIENT_ID=your-sms-client-id SMS_CLIENT_SECRET=your-sms-client-secret SMS_SENDER=your-sender-id
-
Build the project
npm run build
-
Run the application
# Development npm run start:dev # Production npm run start:prod
POST /api/v1/flow/ussd- Handle USSD requests (Hubtel callback)POST /api/v1/flow/ussd/callback- Handle payment completion callbacks
GET /api/v1/communities- List all communities (optional query:?isActive=true)GET /api/v1/communities/:referenceCode- Get community by reference codePOST /api/v1/communities- Create new community (Admin only)PATCH /api/v1/communities/:id- Update community (Admin only)POST /api/v1/communities/:id/delete- Delete community (Admin only)
GET /api/v1/donations- List all donations with optional filters (Admin only)- Query parameters:
status,communityReferenceCode,donorMobile,sessionId,hubtelOrderId
- Query parameters:
GET /api/v1/donations/:id- Get donation by ID (Admin only)
GET /api/v1/health- Application health status
name: Community namereferenceCode: Unique reference code (uppercase, indexed)description: Optional descriptionisActive: Active status flag
sessionId: USSD session identifiercommunity: Reference to Communitypurpose: Donation purpose (enum)amount: Donation amountdonorMobile: Donor's mobile numberdonorName: Donor's namestatus: Donation status (enum)transactionId: Related transaction ID
- Complete payment transaction details from Hubtel
- Includes payment status, amounts, dates, and customer information
The API uses JWT-based authentication. Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Public Endpoints (No authentication required):
- USSD endpoints
- Health check
- Community listing (read-only)
Protected Endpoints (Require authentication):
- Community management (create, update, delete)
- Donation management (admin only)
src/
βββ configs/ # Guards and authentication strategies
βββ controllers/ # API route handlers
βββ models/
β βββ dto/ # Data transfer objects
β βββ schemas/ # MongoDB schemas and enums
βββ services/ # Business logic
βββ utils/ # Utility functions and helpers
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covnpm run build- Build the projectnpm run start- Start the applicationnpm run start:dev- Start in development mode with watchnpm run start:debug- Start in debug modenpm run start:prod- Start in production modenpm run lint- Run ESLint
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the UNLICENSED License.
AMANI J. Africa Foundation is an NGO with 12 member executives in every subscribed community, dedicated to making a positive impact through various development initiatives including education, health, water & sanitation, legal aid, disability support, and missions.
For support and inquiries, please contact the development team.
Note: This system is designed specifically for the AMANI J. Africa Foundation's donation collection needs. Ensure all environment variables are properly configured before deployment.