Skip to content

Saipramodh033/LocalKonnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LocalKonnect - Trusted Local Contractor Network

A robust, lean Django-based web platform connecting customers with reliable local contractors through a geospatial search and an automated trust scoring system.

🎯 Project Overview

LocalKonnect helps customers find trustworthy local contractors while providing contractors a platform to showcase their services and build their reputation through customer feedback and trust scores. The platform was recently refactored to focus on a highly stable, synchronous core flow: Customer -> Search -> Contractor Detail -> Submit Feedback -> Trust Score Updates -> Reflected in Search.

✨ Core Features

User Management

  • βœ… Custom user model with role-based access (Customer / Contractor)
  • βœ… Standard session-based authentication
  • βœ… Google OAuth integration with smart user-type auto-detection
  • βœ… User profile management with exact geographical coordinates (PostGIS Point field)
  • βœ… Built-in password reset functionality (utilizing Django's secure token system and console email backend)

Contractor Features

  • βœ… Auto-created contractor profiles via Django signals
  • βœ… Office location tracking with PostGIS Point field and GIST indexes
  • βœ… Service radius configuration
  • βœ… Verification status tracking

Service Management

  • βœ… Service categories and subcategories
  • βœ… Contractor service management
  • βœ… Per-service trust scores calculated automatically based on customer feedback

Trust & Feedback System

  • βœ… Synchronous Feedback model ensuring absolute data integrity
  • βœ… 1-5 star rating system with verified feedback bonuses
  • βœ… Dynamic trust score algorithm combining rating, verified status, and contractor experience
  • βœ… Trust score instantly updates and reflects in search rankings upon feedback submission
  • βœ… Public contractor profiles display aggregated, filterable, and paginated review histories
  • βœ… Hyper-local review filtering: Utilizes PostGIS DWithin to automatically badge and filter reviews from customers located within a 25km radius of the viewing user.

Geospatial Search

  • βœ… PostGIS-powered distance-based search
  • βœ… Filter contractors by category and location
  • βœ… Radius search to match customers with nearby contractors
  • βœ… Results deterministically ordered by trust score and distance

Infrastructure

  • βœ… Docker Compose local setup
  • βœ… PostgreSQL 15 with PostGIS 3.3
  • βœ… Native Django management commands for nightly maintenance tasks (e.g., python manage.py recompute_trust_scores)
  • βœ… Lean, server-rendered frontend using Django Templates, Tailwind CSS (CDN), and Alpine.js

πŸ› οΈ Tech Stack

Backend

  • Django 4.2.8 - Core web framework
  • PostgreSQL 15 + PostGIS 3.3 - Primary database with robust geospatial support

Frontend (Server-Rendered)

  • Django Templates - Template engine
  • Tailwind CSS (CDN) - Utility-first styling
  • Alpine.js - Lightweight reactive components
  • Vanilla JavaScript - Map integration (Leaflet.js) and UI logic

DevOps

  • Docker & Docker Compose - Containerization
  • Gunicorn - WSGI server (production-ready)
  • WhiteNoise - Static file serving

πŸš€ Quick Start

Prerequisites

  • Docker Desktop installed
  • Git

Setup Instructions

  1. Clone the repository:
git clone https://github.com/yourusername/LocalKonnect.git
cd LocalKonnect
  1. Start the application:
docker compose up -d --build
  1. Run database migrations:
docker compose exec backend python manage.py migrate
  1. Seed realistic demo data:
# Create categories first
docker compose exec backend python manage.py create_categories

# Seed 10 contractors, 10 customers, services, and feedback
docker compose exec backend python manage.py seed_realistic_demo_data
  1. Create a superuser (optional):
docker compose exec backend python manage.py shell -c "
from apps.users.models import User
User.objects.create_superuser('admin', 'admin@localkonnect.com', 'Admin1234!', user_type='contractor')
"
  1. Access the application:

Demo Logins:

  • Customer: customer1@seed.localkonnect.test / SeedPass123!
  • Contractor: contractor1@seed.localkonnect.test / SeedPass123!

Stopping the Application

docker compose down

Viewing Logs

docker compose logs backend -f

πŸ“ Project Structure

LocalKonnect/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/                    # Django project settings and root routing
β”‚   β”œβ”€β”€ apps/
β”‚   β”‚   β”œβ”€β”€ users/                # User authentication & profiles
β”‚   β”‚   β”œβ”€β”€ contractors/          # Contractor profiles and signals
β”‚   β”‚   β”œβ”€β”€ services/             # Service categories and ContractorService models
β”‚   β”‚   β”œβ”€β”€ trust/                # Feedback models, trust score utilities, and submission logic
β”‚   β”‚   β”œβ”€β”€ search/               # Geospatial search views and Contractor detail views
β”‚   β”‚   └── customer/             # Minimal customer dashboards
β”‚   β”œβ”€β”€ templates/                # Django templates (Base, Auth, Contractor, Customer, Search, Trust)
β”‚   β”œβ”€β”€ static/                   # Static assets (CSS, JS, Images)
β”‚   β”œβ”€β”€ requirements.txt          # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile                # Backend container configuration
β”‚   └── manage.py                 # Django CLI
β”œβ”€β”€ docker-compose.yml            # Multi-container orchestration (DB and Backend)
└── README.md                     # This file

πŸ—„οΈ Database Schema (Core Models)

User

  • Custom authentication model extending AbstractUser
  • Handles user_type (Customer/Contractor) and PostGIS location.

ContractorProfile

  • One-to-one with User.
  • Stores office_location (PostGIS Point), service_radius_km, and business details.

ServiceCategory & ServiceSubcategory

  • Hierarchical taxonomy for the services offered on the platform.

ContractorService

  • The core offering linking a Contractor to a ServiceCategory.
  • Stores the calculated trust_score which is deterministically updated when feedback is given.

Feedback

  • Links a Customer to a ContractorService.
  • Stores rating (1-5), optional text, and is_verified status.
  • Triggers synchronous trust score recalculation on save.

πŸ“š Key Features Explained

The Trust Score Algorithm

When a customer leaves feedback for a service, the system immediately recalculates the ContractorService trust score. The algorithm factors in:

  1. Raw Rating: The 1-5 star value.
  2. Verification Bonus: Feedback marked as is_verified (e.g. proof of work provided) is weighted significantly heavier.
  3. Reviewer Weight: Feedback from trusted customers contributes more to the score.
  4. Experience Bonus: Contractors receive a slight bump based on their years_of_experience.
  5. Bayesian Smoothing: Prevents new services with a single 5-star review from instantly outranking established services with hundreds of solid 4.8-star reviews.

Geospatial Discovery

LocalKonnect utilizes PostgreSQL's PostGIS extension to handle all location data. When a customer searches:

  • It calculates the exact distance between the customer's coordinate and the contractor's office coordinate.
  • It filters out contractors if the customer falls outside their configured service_radius_km.
  • Search queries utilize GIST indexes for highly optimized geographical sorting.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Version: 1.0.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors