Skip to content

saadakhtr29/NBFC-django-APIs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NBFC Django Project

A comprehensive Django-based Non-Banking Financial Company (NBFC) management system that handles employee management, loan processing, attendance tracking, salary management, and more.

πŸš€ Quick Deployment Script

The fastest way to deploy on a new VM:

Use the automated deployment script that handles everything for you:

./deploy.sh <NEW_IP_ADDRESS>

Example:

./deploy.sh 40.90.224.166

What the deployment script does:

  • βœ… Backs up existing configuration
  • βœ… Creates new .env from template
  • βœ… Updates HOST_IP automatically
  • βœ… Stops old containers
  • βœ… Builds and starts new containers
  • βœ… Waits for services to initialize
  • βœ… Provides access URLs and next steps

Script Features:

  • Automatic Backup: Creates timestamped backup of existing .env
  • Zero Configuration: Just provide the IP address
  • Health Checks: Verifies deployment success
  • User Guidance: Shows next steps and access URLs
  • Error Handling: Graceful failure with helpful logs

🎯 Manual IP Configuration

For manual deployments, you only need to update ONE value:

  1. Copy .env.example to .env
  2. Update the HOST_IP value in .env:
    HOST_IP=YOUR_NEW_VM_IP_HERE
  3. Everything else (Django settings, Docker, nginx, API endpoints) automatically syncs!

Features

Core Modules

  • Employee Management

    • Employee profiles and details
    • Organization-based employee segregation
    • Bulk employee creation
    • Employee statistics and analytics
  • Loan Management

    • Loan application and processing
    • Multiple loan types support
    • Interest rate management
    • Loan status tracking
    • Bulk loan creation
    • Loan statistics and analytics
  • Attendance System

    • Daily attendance tracking
    • Multiple attendance statuses (present, absent, late, half-day, leave)
    • Attendance verification
    • Attendance statistics
  • Salary Management

    • Salary calculation and processing
    • Basic salary, allowances, and deductions
    • Salary approval workflow
    • Salary statistics and analytics

Additional Features

  • Organization-based multi-tenancy
  • Role-based access control
  • Document management
  • Transaction logging
  • Dashboard analytics
  • Bulk data upload capabilities
  • API-first architecture

Technical Stack

  • Backend: Django & Django REST Framework
  • Database: SQLite (Development) / PostgreSQL (Production)
  • Authentication: JWT-based authentication
  • API Documentation: Swagger/OpenAPI
  • Frontend: (To be implemented)

Project Structure

nbfc-django/
β”œβ”€β”€ nbfc_accounts/         # Account management
β”œβ”€β”€ nbfc_attendance/       # Attendance tracking
β”œβ”€β”€ nbfc_auth/            # Authentication and authorization
β”œβ”€β”€ nbfc_bulk_upload/     # Bulk data upload functionality
β”œβ”€β”€ nbfc_dashboard/       # Dashboard and analytics
β”œβ”€β”€ nbfc_documents/       # Document management
β”œβ”€β”€ nbfc_employees/       # Employee management
β”œβ”€β”€ nbfc_loan_deficit/    # Loan deficit tracking
β”œβ”€β”€ nbfc_loans/           # Loan management
β”œβ”€β”€ nbfc_organizations/   # Organization management
β”œβ”€β”€ nbfc_repayments/      # Loan repayment tracking
β”œβ”€β”€ nbfc_salaries/        # Salary management
β”œβ”€β”€ nbfc_settings/        # System settings
β”œβ”€β”€ nbfc_transaction_logs/# Transaction logging
└── nbfc_django/          # Core project settings

Setup and Installation

πŸš€ Automated Deployment (Recommended)

For new VM deployment using the deployment script:

  1. Clone the repository:
git clone <repository-url>
cd nbfc-django
  1. Make script executable:
chmod +x deploy.sh
  1. Deploy with one command:
./deploy.sh YOUR_VM_IP_ADDRESS
  1. Create superuser (after deployment):
docker compose exec web python manage.py createsuperuser
  1. Test the deployment:
curl http://YOUR_VM_IP:8000/api/

🎯 Manual VM Deployment

  1. Clone and configure:
git clone <repository-url>
cd nbfc-django
cp .env.example .env
  1. Update ONLY the IP address in .env:
# Edit .env file
HOST_IP=40.90.224.166  # Replace with your VM IP
  1. Deploy with Docker:
docker-compose up -d

That's it! Everything else automatically syncs from the HOST_IP value.

πŸ› οΈ Local Development

  1. Clone the repository:
git clone <repository-url>
cd nbfc-django
  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Note: If you plan to use PostgreSQL, install the PostgreSQL adapter:

pip install psycopg2-binary

For development, SQLite is used by default and requires no additional setup.

  1. Configure environment variables:
cp .env.example .env
# Edit .env with HOST_IP=127.0.0.1 for local development
  1. Run migrations:
python manage.py migrate
  1. Create superuser:
python manage.py createsuperuser
  1. Run development server:
python manage.py runserver

🌐 Dynamic Configuration Features

  • Single Point Configuration: Update only HOST_IP in .env
  • Auto-generated Settings: Django settings automatically adapt
  • Flexible nginx: Works with any IP or domain
  • Docker Integration: Compose file uses environment variables
  • API Compatibility: All endpoints work with any host configuration
  • Deployment Script: One-command deployment with automatic configuration

Deployment Commands Reference

Using Deployment Script

# Deploy to new IP
./deploy.sh 40.90.224.166

# Check deployment status
docker compose ps

# View logs
docker compose logs

# Create superuser
docker compose exec web python manage.py createsuperuser

Manual Docker Commands

# Stop services
docker compose down

# Build and start
docker compose up -d --build

# View logs
docker compose logs -f

# Access container shell
docker compose exec web bash

API Documentation

The API documentation is available at /api/docs/ when running the development server. The project includes a Postman collection (nbfc_api_collection.json) for API testing.

Development Guidelines

  1. Code Style

    • Follow PEP 8 guidelines
    • Use meaningful variable and function names
    • Add docstrings for functions and classes
  2. Git Workflow

    • Create feature branches for new features
    • Write meaningful commit messages
    • Keep commits atomic and focused
  3. Testing

    • Write unit tests for new features
    • Run tests before committing changes
    • Maintain test coverage

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

About

A comprehensive Django-based APIs for Non-Banking Financial Company (NBFC) management system.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors