SkillAgentSearch skills...

Vehicle Insurance System

No description available

Install / Use

/learn @dkalal/Vehicle Insurance System
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

🚗 Vehicle Insurance Information System

License: MIT Django Python PostgreSQL Docker

A world-class, multi-tenant insurance information system built with Django, designed for real-world production use with enterprise-grade security, performance, and scalability.

� Key Features

  • 🏢 Multi-tenant architecture with strict data isolation
  • 🔒 Enterprise security following OWASP guidelines
  • ⚡ High performance with Redis caching and optimization
  • 🎨 Modern UI/UX with Tailwind CSS and accessibility compliance
  • 🔌 Complete REST API with auto-generated documentation
  • 📊 Comprehensive monitoring and health checks
  • 🐳 Production-ready Docker containerization
  • 🚀 CI/CD pipeline with automated testing and deployment

🚀 Quick Start

Prerequisites

  • Python 3.12+
  • PostgreSQL 14+
  • Redis 6+
  • Docker & Docker Compose (optional)

One-Click Deployment

git clone https://github.com/dkalal/vehicle-insurance-system.git
cd vehicle-insurance-system
chmod +x deploy.sh
./deploy.sh deploy

Manual Setup

# Clone repository
git clone https://github.com/dkalal/vehicle-insurance-system.git
cd vehicle-insurance-system

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Environment setup
cp .env.example .env
# Edit .env with your database and Redis settings

# Database setup
python manage.py migrate
python manage.py createsuperuser

# Run development server
python manage.py runserver 0.0.0.0:8000

📚 Documentation

🏗️ Architecture Overview

Multi-Tenant Architecture

  • Single Database, Tenant Isolation: Each insurance company (tenant) has complete data isolation
  • Tenant-Aware Models: All business models automatically scope to current tenant
  • Middleware-Based Context: Tenant context automatically set from authenticated user
  • Scalable Design: Supports thousands of tenants on single infrastructure

Security Features

  • Role-Based Access Control: Super Admin, Tenant Admin, Manager, Agent roles
  • Session Security: Secure session management with rotation and expiry
  • Rate Limiting: Login attempt limiting and API throttling
  • CSRF Protection: Comprehensive CSRF protection across all forms
  • Content Security Policy: Strict CSP headers for XSS prevention
  • Audit Logging: Complete audit trail of all data changes

Performance Optimizations

  • Redis Caching: Multi-level caching strategy for optimal performance
  • Database Optimization: Connection pooling, query optimization, indexes
  • Async Processing: Celery for background tasks and notifications
  • Static File Optimization: WhiteNoise with compression and caching
  • Query Optimization: Select/prefetch related, bulk operations

🚀 Quick Start

Prerequisites

  • Python 3.12+
  • PostgreSQL 14+
  • Redis 6+
  • Docker & Docker Compose (optional)

Local Development Setup

# Clone repository
git clone <repository-url>
cd Vehicle_Insurance

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Environment setup
cp .env.example .env
# Edit .env with your database and Redis settings

# Database setup
python manage.py migrate
python manage.py createsuperuser

# Create initial tenant (optional)
python manage.py shell
>>> from apps.tenants.models import Tenant
>>> tenant = Tenant.objects.create(name="Demo Insurance", slug="demo", contact_email="admin@demo.com")

# Run development server
python manage.py runserver 0.0.0.0:8000

Docker Development Setup

# Start all services
docker-compose up -d

# Run migrations
docker-compose exec web python manage.py migrate

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

# Access application at http://localhost

📊 System Features

Core Business Logic

  • Customer Management: Individual and corporate customer profiles
  • Vehicle Registration: Complete vehicle information with VIN tracking
  • Policy Management: Comprehensive policy lifecycle management
  • Payment Processing: Payment tracking with verification workflow
  • Claims Processing: (Extensible framework ready)

Business Rules Implementation

  • ✅ One active policy per vehicle at any time
  • ✅ Full payment required before policy activation
  • ✅ Immutable policy history (soft deletes only)
  • ✅ Automatic policy number generation per tenant
  • ✅ Expiry notifications and reminders

Reporting & Analytics

  • Policy Reports: Comprehensive policy analytics with export (CSV, XLSX, PDF)
  • Registration Reports: Vehicle registration tracking
  • Revenue Analytics: Premium collection and revenue tracking
  • Dashboard Metrics: Real-time business metrics
  • Audit Reports: Complete audit trail reporting

API & Integration

  • RESTful API: Complete REST API with DRF
  • API Documentation: Auto-generated OpenAPI/Swagger docs
  • Authentication: Session-based and token authentication
  • Rate Limiting: Configurable API rate limiting
  • Filtering & Search: Advanced filtering and search capabilities

🔧 Technical Stack

Backend

  • Django 5.0: Modern Python web framework
  • Django REST Framework: API development
  • PostgreSQL: Primary database with advanced features
  • Redis: Caching and message broker
  • Celery: Asynchronous task processing

Frontend

  • Tailwind CSS: Modern utility-first CSS framework
  • Alpine.js: Lightweight JavaScript framework
  • Responsive Design: Mobile-first responsive design
  • Accessibility: WCAG 2.1 AA compliant

Infrastructure

  • Docker: Containerization for all services
  • Nginx: Reverse proxy and static file serving
  • Gunicorn: WSGI HTTP Server
  • WhiteNoise: Static file serving with compression

Monitoring & Observability

  • Health Checks: Comprehensive health monitoring endpoints
  • Metrics: Prometheus-compatible metrics
  • Logging: Structured logging with rotation
  • Performance Monitoring: Built-in performance tracking

🏢 Multi-Tenancy Details

Tenant Isolation

# All models automatically scope to tenant
customers = Customer.objects.all()  # Only current tenant's customers
policies = Policy.objects.for_tenant(tenant)  # Explicit tenant filtering

User Roles & Permissions

  • Super Admin: Platform management, tenant creation, system monitoring
  • Tenant Admin: Full access within tenant, user management
  • Manager: Read access, reporting, staff management
  • Agent: Customer/vehicle/policy creation, payment processing

Tenant-Specific Features

  • Custom domains per tenant (configurable)
  • Tenant-specific settings and configurations
  • Branded UI per tenant (extensible)
  • Separate audit logs per tenant

🔒 Security Implementation

Authentication & Authorization

# Automatic tenant context in views
@login_required
def customer_list(request):
    # request.tenant automatically available
    customers = Customer.objects.for_tenant(request.tenant)

Data Protection

  • All sensitive data encrypted at rest
  • PII data handling with privacy controls
  • GDPR compliance framework
  • Secure file upload handling

Security Headers

  • Content Security Policy (CSP)
  • HTTP Strict Transport Security (HSTS)
  • X-Frame-Options, X-Content-Type-Options
  • Referrer Policy controls

📈 Performance Features

Caching Strategy

# Multi-level caching
CACHES = {
    'default': {...},      # General application cache
    'sessions': {...},     # Session storage
    'tenant_data': {...},  # Tenant-specific data cache
}

Database Optimization

  • Connection pooling with pgbouncer compatibility
  • Query optimization with select_related/prefetch_related
  • Database indexes on all foreign keys and search fields
  • Bulk operations for large datasets

Background Processing

# Celery tasks for heavy operations
@shared_task
def send_expiry_reminders():
    # Process policy expiry notifications
    pass

@shared_task
def generate_monthly_reports():
    # Generate and email monthly reports
    pass

🧪 Testing Strategy

Test Coverage

  • Unit tests for all models and business logic
  • Integration tests for API endpoints
  • Tenant isolation tests
  • Performance tests for scalability
  • Security tests for vulnerabilities

Test Utilities

# Comprehensive test factories
from tests.factories import TenantFactory, UserFactory, PolicyFactory

def test_policy_activation():
    tenant = TenantFactory()
    policy = PolicyFactory(tenant=tenant)
    # Test policy activation logic

🚀 Deployment

Production Deployment

# Using Docker Compose
docker-compose -f docker-compose.prod.yml up -d

# Or traditional deployment
pip install -r requirements.txt
python manage.py collectstatic
python manage.py migrate
gunicorn config.wsgi:application

Environment Variables

# Required production settings
SECRET_KEY=your-secret-key
DEBUG=False
ALLOWED_HOSTS=yourdomain.com
DB_HOST=y
View on GitHub
GitHub Stars0
CategoryDevelopment
Updated1mo ago
Forks0

Languages

Python

Security Score

65/100

Audited on Feb 4, 2026

No findings