Logo Lanfrica

Copay-Africa/copay-server

Domain:

socioeconomicdigital infrastructure

Record type:

software
Creator:
Cop
Host:
A multi-channel digital payment platform for cooperatives to collect, track, and manage rent-related payments β€” all integrated with local payment gateways and IremboPay. # Copay Backend Server A production-grade NestJS backend for the Cooperative Payment System (Copay) built with Domain-Driven Design (DDD) and Clean Architecture principles. ## πŸš€ Features - **Multi-tenancy**: Each cooperative operates as an isolated tenant - **Role-based Access Control**: Super Admin, Organization Admin, and Tenant roles - **JWT Authentication**: Secure phone number + 4-digit PIN authentication - **Fastify**: High-performance web framework - **MongoDB with Prisma**: Modern database ORM with type safety - **Swagger Documentation**: Auto-generated API documentation - **Rate Limiting**: Built-in throttling protection - **Caching**: Redis-based caching for improved performance - **Validation**: Comprehensive input validation with DTOs - **Clean Architecture**: DDD modules with separation of concerns ## πŸ—οΈ Architecture ``` src/ β”œβ”€β”€ config/ # Configuration files and validation β”œβ”€β”€ modules/ # Feature modules (DDD structure) β”‚ β”œβ”€β”€ auth/ # Authentication & JWT β”‚ β”œβ”€β”€ user/ # User management & RBAC β”‚ └── ... # Other business modules β”œβ”€β”€ shared/ # Shared utilities, guards, decorators β”œβ”€β”€ prisma/ # Database service and configuration └── main.ts # Application bootstrap with Fastify ``` ## πŸ“‹ Prerequisites - Node.js (v18+) - MongoDB database - Redis (optional, for caching) ## πŸ› οΈ Installation 1. **Clone the repository** ```bash git clone cd copay-backend-server ``` 2. **Install dependencies** ```bash npm install ``` 3. **Setup environment variables** ```bash cp .env.example .env ``` Update the `.env` file with your database URL and configuration: ```env DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net" JWT_SECRET="your-super-secret-jwt-key" # ... other configuration ``` 4. **Generate Prisma client** ```bash npm run prisma:generate ``` 5. **Seed the database** (optional) ```bash npm run prisma:seed ``` ## πŸš€ Running the Application ```bash # D …