This is a monorepo-based microfinance platform with three main components:
- Technology: Node.js + Express + TypeScript + Prisma
- Database: PostgreSQL (Supabase)
- Cache: Redis (Upstash)
- Features: Authentication, Customer Management, Loan Processing, EMI Scheduling, Repayments, Document Management, Reports
- Technology: React + Vite + TypeScript + Tailwind CSS
- State Management: Zustand + React Query
- Features: Customer Dashboard, Loan Applications, Admin Panel, Reports
- Technology: React Native + Expo Router + NativeWind
- Features: Mobile-optimized customer interface, Loan Applications, EMI Tracking
Before running the application, ensure you have:
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL database (Supabase recommended)
- Redis (Upstash recommended)
- Cloudinary account (for file uploads)
- Email service (Brevo SMTP recommended)
- Set up a PostgreSQL database (Supabase recommended)
- Get the database connection string
- Update
server/.envwith your database URL
- Cloudinary: Create account and get API credentials
- Redis: Set up Upstash Redis
- Email: Configure Brevo SMTP
Copy the example environment file and configure:
cp server/.env.example server/.envRequired configuration:
- Database connection
- JWT secrets (generate 32+ character secrets)
- Redis configuration
- Cloudinary credentials
- Email SMTP settings
- Admin credentials
npm install# Generate Prisma client
npm run db:generate -w server
# Push database schema (for development)
npm run db:push -w server
# Or run migrations (for production)
npm run db:migrate -w server# Start server in development mode
npm run dev:server
# Server will run on http://localhost:5000
# API base path: /api/v1# Start web app in development mode
npm run dev:web
# Web app will run on http://localhost:5173# Start mobile app
npm run start -w apps/mobile
# This will start Expo development server
# Use Expo Go app to test on mobile device- Base URL:
http://localhost:5000/api/v1 - Authentication:
/auth/* - Customers:
/customers/* - Loans:
/loans/* - EMI:
/emi/* - Repayments:
/repayments/* - Documents:
/documents/* - Reports:
/reports/*
- URL:
http://localhost:5173 - Customer Portal:
/customer/* - Admin Panel:
/admin/*
- Development: Expo QR code in terminal
- Features: Mobile-optimized customer interface
After setting up the environment, you can access the admin panel with:
- Phone:
9999999999(or your configured ADMIN_PHONE) - Password:
ChangeMe@123(or your configured ADMIN_DEFAULT_PASSWORD)
Important: Change the default admin password after first login.
-
Database Connection Errors
- Verify DATABASE_URL in
.env - Ensure PostgreSQL is running
- Check network connectivity
- Verify DATABASE_URL in
-
Prisma Client Not Generated
- Run
npm run db:generate -w server - Ensure Prisma is installed
- Run
-
Port Already in Use
- Change PORT in
.env(default: 5000) - Or kill process using the port
- Change PORT in
-
Environment Variables Missing
- Copy
.env.exampleto.env - Fill in all required variables
- Copy
-
Redis Connection Issues
- Verify Upstash Redis configuration
- Check Redis URL and token
- Backend Health:
GET http://localhost:5000/api/v1/health - Database: Check Prisma connection in server logs
- Redis: Verify Redis connection in server logs
- Backend changes: Server auto-restarts on file changes
- Web changes: Vite hot reloads the application
- Mobile changes: Expo hot reloads the mobile app
- Update
server/prisma/schema.prisma - Run
npm run db:push -w server(dev) or create migration - Regenerate Prisma client:
npm run db:generate -w server
- Backend: Add routes, services, and database models
- Frontend: Add components, pages, and API calls
- Test: Verify functionality across web and mobile
npm run build -w server
npm start -w servernpm run build -w apps/webnpm run build -w apps/mobile- Environment Variables: Never commit
.envfiles - JWT Secrets: Use strong, randomly generated secrets
- Database: Use strong passwords and SSL
- API Security: Implement rate limiting and authentication
- File Uploads: Validate file types and sizes
- Server Logs: Check console output for server logs
- Database: Monitor Prisma queries and performance
- API: Use browser dev tools for network requests
- Errors: Check console for error messages
For issues or questions:
- Check this guide
- Review environment configuration
- Check logs for error messages
- Verify all services are running