A production-grade SACCO (Savings and Credit Cooperative) financial management system built with NestJS + React + Prisma 7 + Neon PostgreSQL. Implements complete accounting, loan management, settings configuration, and financial reporting capabilities.
Backend: src/settings/
GET/POST /settings/contribution-typesGET/POST /settings/expense-categoriesGET/POST /settings/income-categoriesGET/POST /settings/fine-categoriesGET/POST /settings/group-rolesGET/POST /settings/invoice-templatesFeatures:
Database Models:
ContributionType - Recurring contribution configurationExpenseCategory - Operational expense classificationIncomeCategory - Revenue stream trackingFineCategory - Penalty typesGroupRole - Access control rolesInvoiceTemplate - Bill templatesBackend: src/accounts/
GET /accounts - List all accountsGET /accounts/by-type/{type} - Filter by account typePOST /accounts - Create accountPATCH /accounts/:id - Update accountPATCH /accounts/:id/balance - Adjust balanceDELETE /accounts/:id - Delete accountFeatures:
Database Model Account:
type: AccountType enum (cash, pettyCash, mobileMoney, bank)name, description, balance, currencybankName, branch, accountName, accountNumberprovider, numberBackend: src/general-ledger/
GET /ledger/transactions - All journal entries with filteringGET /ledger/summary - Debit/credit totals, net balanceGET /ledger/account/:id - Account-specific ledgerPOST /ledger/entry - Record journal entryFeatures:
Database Model JournalEntry:
debitAccount/creditAmount + creditAccount/debitAmountdate, reference, description, narrationcategory, memo for classificationBackend: src/fines/
GET /fines - All fines with status filteringGET /fines/statistics - Summary counts by statusGET /fines/member/:memberId - Member-specific finesPOST /fines - Record new finePOST /fines/:id/payment - Record fine paymentPATCH /fines/:id - Update fineDELETE /fines/:id - Remove fineFeatures:
Database Model Fine:
type: FineType enumreason, amount, statuspaidAmount, paidDatemember (required), loan (optional)Backend: src/deposits/, src/withdrawals/
type: TransactionType enum (contribution, income, fine, loan-repayment, expense, dividend, refund, transfer)category: Categorization for reportingnarration: Full transaction descriptionaccount: Link to Account model for multi-account supportmethod: PaymentMethod enum (cash, bank, mpesa, check_off, bank_deposit, other)Features:
Backend: src/loans/
loanDirection: outward (to members) |
inward (from banks) |
schedule: JSON amortization scheduleloanType: Link to LoanType modelstatus: pending |
active | closed | defaulted |
New Models:
LoanType - Loan product templates with:
Database Model Loan:
member |
bankName (mutual exclusivity enforced) |
loanType with full configurationamount, balance, interestRate, periodMonthsstatus, loanDirectionschedule for amortizationrepayments[], fines[]Path: /settings
File: frontend/src/pages/SettingsPage.jsx
Features:
Tabs:
Path: /ledger
File: frontend/src/pages/GeneralLedgerPage.jsx
Features:
Displays:
enum TransactionType {
contribution, income, fine, loan_repayment,
expense, dividend, refund, transfer,
loan_disbursement
}
enum AccountType {
cash, pettyCash, mobileMoney, bank
}
enum LoanStatus {
pending, active, closed, defaulted
}
enum LoanDirection {
outward, inward
}
enum FineType {
late_payment, absenteeism, rule_violation, other
}
File: frontend/src/components/members/financeAPI.js
Features:
cd backend
npm install # if needed
npx prisma migrate dev # apply migrations
npm run start:dev
# Backend runs on http://localhost:3000
cd frontend
npm install # if needed
npm run dev
# Frontend runs on http://localhost:5173
Dashboard
├── Members
│ ├── View Members
│ └── Register Member
├── Deposits
│ └── Deposits Register
├── Withdrawals
│ └── Withdrawals Register
├── Loans
│ └── Loans Portfolio
├── Reports
│ └── Financial Reports
├── General Ledger
├── Configuration (Settings)
└── SACCO Settings
backend/
├── prisma/
│ ├── schema.prisma (updated with all models)
│ └── migrations/
│ └── 20260119230027_add_sacco_finance_complete/
├── src/
│ ├── settings/
│ │ ├── settings.module.ts
│ │ ├── settings.service.ts
│ │ └── settings.controller.ts
│ ├── accounts/
│ │ ├── accounts.module.ts
│ │ ├── accounts.service.ts
│ │ └── accounts.controller.ts
│ ├── general-ledger/
│ │ ├── general-ledger.module.ts
│ │ ├── general-ledger.service.ts
│ │ └── general-ledger.controller.ts
│ ├── fines/
│ │ ├── fines.module.ts
│ │ ├── fines.service.ts
│ │ └── fines.controller.ts
│ └── app.module.ts (updated with imports)
frontend/
├── src/
│ ├── pages/
│ │ ├── SettingsPage.jsx (new)
│ │ └── GeneralLedgerPage.jsx (new)
│ ├── styles/
│ │ ├── settings.css (new)
│ │ └── ledger.css (new)
│ ├── components/
│ │ └── Sidebar.jsx (updated)
│ └── App.jsx (updated with routes)
✅ Multi-Account Management
✅ Professional General Ledger
✅ Comprehensive Settings
✅ Fine Management System
✅ Enhanced Loan System
✅ Full Audit Trail
curl http://localhost:3000/settings/contribution-types
curl http://localhost:3000/settings/expense-categories
curl http://localhost:3000/settings/fine-categories
curl http://localhost:3000/settings/group-roles
curl http://localhost:3000/accounts
curl http://localhost:3000/accounts/by-type/bank
curl http://localhost:3000/ledger/summary
curl http://localhost:3000/ledger/transactions
curl http://localhost:3000/ledger/account/1
curl http://localhost:3000/fines
curl http://localhost:3000/fines/statistics
curl http://localhost:3000/fines/member/1
✅ Full TypeScript type safety ✅ Prisma migrations applied ✅ Database fully synchronized ✅ All endpoints tested ✅ Error handling implemented ✅ CORS configured ✅ Input validation on routes ✅ Proper module imports/exports ✅ Clean code structure ✅ Comprehensive comments
/api/docs when Swagger is configuredprisma/schema.prismaRemote: https://github.com/nylageneralsuppliesltd-lab/soyosoyo-reactapp
Branch: main
Latest Commit: c7e2956 (Premium SACCO Implementation)
Status: ✅ All changes pushed to GitHub
Status: 🟢 PRODUCTION READY
System Fully Operational: Both backend and frontend servers running without errors.
Last Updated: 20 January 2026 By: GitHub Copilot