A comprehensive RESTful API for microfinance/lending management built with Node.js and MySQL.
API Endpoint: https://loan-management-backend-h2d1.onrender.com
Note: Demo deployment uses free-tier hosting. Production deployment will be handled by the client with proper infrastructure.
Enterprise-grade loan management system backend designed for microfinance institutions. Handles borrower management, loan processing, EMI calculations, payment tracking, and analytics.
- Secure JWT-based authentication with refresh tokens
- Automated EMI calculation and installment scheduling
- Role-based access control (Admin/Super Admin)
- RESTful API architecture
- Payment collection and late fee management
- Real-time dashboard analytics
- SMS notification integration
- Runtime: Node.js + Express.js
- Database: MySQL
- Authentication: JWT (jsonwebtoken)
- Security: bcrypt password hashing, helmet, cors
- Validation: express-validator
- Environment: dotenv
backend/
βββ config/ # Database and app configuration
βββ controllers/ # Business logic handlers
βββ middleware/ # Authentication & validation
βββ routes/ # API route definitions
βββ utils/ # Helper functions (JWT, calculations)
βββ server.js # Application entry point
βββ package.json # Dependencies
NODE_ENV=production
PORT=5000
API_VERSION=v1
# Database Configuration
DATABASE_URL=mysql://user:password@host:port/database
# JWT Configuration
JWT_SECRET=your_secret_key_here
JWT_REFRESH_SECRET=your_refresh_secret_here
JWT_EXPIRES_IN=24h
JWT_REFRESH_EXPIRES_IN=7d
# Security
BCRYPT_ROUNDS=10
CORS_ORIGIN=https://yourdomain.com
β οΈ Security Note: Never commit.envfiles. Use environment variable management in production.
- Node.js (v14 or higher)
- MySQL (v8.0 or higher)
- npm or yarn
# Clone the repository
git clone https://github.com/seshathri044/loan-management-backend.git
cd loan-management-backend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Run database migrations (if applicable)
npm run migrate
# Start development server
npm run devPOST /api/v1/auth/register - Admin registration
POST /api/v1/auth/login - Admin login
POST /api/v1/auth/refresh - Refresh access token
PUT /api/v1/auth/profile - Update profile
PUT /api/v1/auth/password - Change password
GET /api/v1/borrowers - List all borrowers
POST /api/v1/borrowers - Create borrower
GET /api/v1/borrowers/:id - Get borrower details
PUT /api/v1/borrowers/:id - Update borrower
DELETE /api/v1/borrowers/:id - Delete borrower
GET /api/v1/loans - List all loans
POST /api/v1/loans - Create loan
GET /api/v1/loans/:id - Get loan details
PUT /api/v1/loans/:id - Update loan
GET /api/v1/loans/:id/schedule - Get installment schedule
POST /api/v1/payments - Record payment
GET /api/v1/payments/loan/:id - Get payment history
GET /api/v1/dashboard/stats - Get dashboard statistics
GET /api/v1/dashboard/analytics?period=daily - Period-wise analytics
- JWT access & refresh token mechanism
- Bcrypt password hashing (configurable rounds)
- CORS protection
- Helmet security headers
- Input validation and sanitization
- SQL injection prevention
- Rate limiting (recommended for production)
Client (Flutter App)
β
Express.js API Server (Render)
β
MySQL Database (Railway)
Key tables:
admins- Admin user managementborrowers- Borrower informationloans- Loan details and statusinstallments- EMI schedulepayments- Payment transactions
# Build command
npm install
# Start command
npm start- Set NODE_ENV=production
- Configure production database
- Set strong JWT secrets
- Configure CORS for specific domain
- Enable SSL/TLS
- Set up monitoring and logging
- Configure backup strategy
- Implement rate limiting
- Set up CDN (if needed)
# Run tests (when implemented)
npm test
# Run linting
npm run lint{
"express": "^4.18.x",
"mysql2": "^3.x.x",
"jsonwebtoken": "^9.x.x",
"bcrypt": "^5.x.x",
"dotenv": "^16.x.x",
"cors": "^2.x.x",
"helmet": "^7.x.x",
"express-validator": "^7.x.x"
}This backend is designed to work with:
- Frontend: Flutter mobile application
- Platform: Android & iOS
- Frontend Repository: (Link if public)
- Free-tier hosting may experience cold starts (10-30s initial response)
- Production deployment will use dedicated infrastructure
- API versioning implemented for future compatibility
- Modular architecture for easy feature additions
- Status: Production-ready
- Client: Vyugam Solutions
- Purpose: Portfolio demonstration & client handoff
- License: Proprietary
- Live API: https://loan-management-backend-h2d1.onrender.com
- Company: Vyugam Solutions
- APK Release: Download v1.0.0
For inquiries regarding this project, please contact through Vyugam Solutions.