A comprehensive Django REST API backend for the SACCO Nova financial management system.
- User Authentication & Authorization - JWT-based authentication with role-based access
- Account Management - Multiple account types (Savings, Current, Fixed Deposit)
- Loan Management - Loan applications, approvals, and payment tracking
- Transaction Processing - Deposits, withdrawals, and transfers
- Member Management - Member registration and profile management
- Admin Dashboard - Administrative oversight and reporting
- Framework: Django 4.2.7
- API: Django REST Framework
- Database: PostgreSQL
- Authentication: JWT (Simple JWT)
- Real-time: Django Channels + Redis
- File Storage: Django File Storage
- Python 3.8+
- PostgreSQL
- Redis (for WebSocket support)
-
Clone and navigate to the project
cd sacco-nova-backend
-
Run the setup script
python setup.py
-
Configure environment variables Update the
.env
file with your database credentials:DATABASE_NAME=saccodata DATABASE_USER=postgres DATABASE_PASSWORD=your-password DATABASE_HOST=localhost DATABASE_PORT=5432
-
Create a superuser
python manage.py createsuperuser
-
Start the development server
python manage.py runserver
POST /api/auth/login/
- User loginPOST /api/auth/register/
- User registrationGET /api/auth/profile/
- Get user profilePOST /api/auth/token/refresh/
- Refresh JWT token
GET /api/dashboard/
- Get dashboard summary
GET /api/accounts/
- List user accountsPOST /api/accounts/
- Create new accountGET /api/accounts/{id}/
- Get account detailsGET /api/accounts/summary/
- Get accounts summary
GET /api/loans/
- List user loansPOST /api/loans/apply/
- Apply for a loanGET /api/loans/{id}/
- Get loan detailsPOST /api/loans/{id}/approve/
- Approve loan (admin only)POST /api/loans/{id}/payment/
- Make loan payment
GET /api/transactions/
- List user transactionsPOST /api/transactions/deposit/
- Make a depositPOST /api/transactions/withdraw/
- Make a withdrawalPOST /api/transactions/transfer/
- Transfer funds
GET /api/members/
- List members (admin) or get own profilePOST /api/members/register/
- Register new memberGET /api/members/profile/
- Get member profilePOST /api/members/documents/
- Upload member documents
- Extended Django User with phone number, role, and verification status
- Member profile with personal and financial information
- Links to User model
- Bank accounts with different types and balances
- Links to User model
- Loan applications and management
- Payment tracking and status management
- All financial transactions (deposits, withdrawals, transfers)
- Complete audit trail
- JWT-based authentication
- Role-based access control (Member, Admin, Staff)
- CORS configuration for frontend integration
- Input validation and sanitization
- Secure file upload handling
sacco-nova-backend/
├── authentication/ # User authentication and management
├── accounts/ # Account management
├── loans/ # Loan processing
├── transactions/ # Transaction handling
├── members/ # Member management
├── config/ # Django configuration
├── requirements.txt # Python dependencies
├── .env # Environment variables
└── manage.py # Django management script
python manage.py test
python manage.py makemigrations
python manage.py migrate
For production deployment:
- Set
DEBUG=False
in environment variables - Configure proper database settings
- Set up Redis for WebSocket support
- Configure static file serving
- Set up proper logging
- Use a production WSGI server (e.g., Gunicorn)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License.