A comprehensive fintech API built with TypeScript, Express, and MongoDB that provides secure financial services including multi-currency wallets, currency exchange, and virtual card management.
- Authentication & Authorization - JWT-based secure user authentication
- Multi-Currency Wallets - Support for USD, NGN, GHS, and KES currencies
- Currency Exchange - Real-time FX quotes with Redis caching
- Virtual Cards - VISA virtual card creation and management
- Payment Processing - Paystack integration for deposits and payments
- Webhook Handling - Secure webhook processing for external services
- Runtime: Node.js with TypeScript
- Framework: Express.js with routing-controllers
- Database: MongoDB with Mongoose ODM
- Caching: Redis for FX quotes and session management
- Authentication: JWT tokens
- Validation: class-validator with DTOs
- Testing: Jest with comprehensive unit tests
- Dependency Injection: TypeDI container
- Payment Gateway: Paystack
- Card Provider: Maplerad
The API follows a clean, modular architecture with:
- Domain-Driven Design - Organized by business domains (auth, wallets, cards, etc.)
- Dependency Injection - Loose coupling with TypeDI
- Service Layer Pattern - Business logic separated from controllers
- DTO Validation - Type-safe request/response handling
- Centralized Error Handling - Custom error classes with proper HTTP status codes
- Node.js (v14 or higher)
- MongoDB database
- Redis server
- Maplerad account for card services
- Paystack account for payments
- Clone the repository:
git clone https://github.com/jason-ezenwa/zen-api.git
cd zen-api- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env- Run database migrations:
npm run migrate-db- Start the development server:
npm run devThe API will be available at http://localhost:3000
npm run dev- Start development server with hot reloadnpm run build- Build TypeScript to JavaScriptnpm start- Start production servernpm test- Run test suitenpm run migrate-db- Run database migrationsnpm run create-db-migration- Create new migration
The project includes comprehensive unit tests with Jest:
npm testTests cover:
- Authentication service logic
- Wallet operations and funding
- Currency exchange functionality
- Virtual card management
- Error handling scenarios
The API is deployed and accessible at: https://zen-api-68zd.onrender.com
- Build the project:
npm run build-
Set production environment variables
-
Run migrations and start:
npm start- Input Validation - All endpoints use DTOs with class-validator
- Authentication - JWT-based with proper token verification
- Authorization - Route-level access control
- IP Whitelisting - Webhook endpoints verify source IP addresses
- Error Handling - Secure error responses without sensitive data exposure
- CORS - Configured for cross-origin requests
- USD - US Dollar
- NGN - Nigerian Naira
- GHS - Ghanaian Cedi
- KES - Kenyan Shilling
- VISA
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.
For questions or support, contact me via email @chukwuemelie.ezenwa@gmail.com