Skip to content

Latest commit

ย 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

LocalConnect

LocalConnect Logo

Need โ†’ Match โ†’ Connect

An AI-powered hyperlocal service discovery and transparent matching platform connecting people with verified local service providers.

License: ISC Status: Production Ready Tests: 153 Passing Frontend: React 19 + TypeScript Backend: Express AI: Gemini + Deterministic Telegram Bot

Explore the Docs ยป
Getting Started ยท AI Matching Architecture ยท Telegram Bot ยท API Reference ยท Testing Strategy


๐Ÿ“Œ Table of Contents


๐ŸŒ Project Overview

LocalConnect is an AI-first, hyperlocal service discovery platform designed to connect consumers with vetted, high-trust local service professionals (tutors, electricians, plumbers, home chefs, mechanics, fitness trainers, and technicians) based on their actual needs, exact location proximity, real-time availability, budget, and multi-pillar trust signals.

Unlike traditional static directory listings that rely on keyword spam and pay-to-win ads, LocalConnect treats local discovery as an intent-driven matching problem. Users describe their requirements naturally (e.g., "Need a Class 12 Maths tutor in Dharampeth under โ‚น500/hr for weekend boards prep"), and LocalConnect's intelligence layer extracts semantic parameters, computes a 7-factor explainable match score, and surfaces the best-fit local providers with verified trust audits.

LocalConnect delivers a dual-interface experience:

  1. Modern Responsive Web Application: 12 interactive screens with conversational search refinement, algorithm weight customization, provider comparison modals, trust audits, and provider dashboards.
  2. Telegram AI Chatbot (@LocalConnect001bot): Complete conversational natural language search, match cards, profile inspection, 4-pillar trust scorecards, and review intelligence directly inside Telegram.

โ— Problem Statement

The Consumer Dilemma

Finding a trustworthy local service provider today is fragmented across WhatsApp groups, word-of-mouth, Instagram accounts, and ad-heavy search engines. Consumers face:

  • Zero Transparency: Fake reviews, hidden prices, and unverified credentials.
  • Manual Overhead: Calling multiple numbers to inquire about rates and weekend availability.
  • Location Inefficiency: Getting recommendations for providers located too far across town.
  • Low Trust: Uncertainty over who is entering the household or teaching a family member.

The Local Provider Dilemma

Skilled independent workers and local micro-businesses face severe digital hurdles:

  • Lack of marketing budgets to compete with sponsored ad listings on legacy portals.
  • Inability to showcase verified proof of work, verified government credentials, or verified response rates.
  • Inbound inquiries with poor fit (mismatched budgets, incompatible timings, or unrealistic distances).

The Gap

There is a critical need for an intelligent, intent-based matchmaking engine that understands natural language needs, guarantees factual trust transparency, and connects local demand with local talent.


๐Ÿ’ก Our Solution

LocalConnect replaces static search listings with an Explainable 7-Factor Semantic Match Engine and a 4-Pillar Verified Trust Audit:

flowchart LR
    A[Natural Language Need] --> B[AI Need Parser]
    B --> C[7-Factor Weighted Matching]
    C --> D[Ranked Local Providers]
    D --> E[4-Pillar Trust Audit]
    E --> F[Direct Connection]
Loading
  1. Natural Understanding: Converts conversational text and Hinglish inputs into structured requirement contracts.
  2. Deterministic & Explainable Matching: Computes a transparent 0โ€“100% Match Score based on mathematical criteria weights, not black-box guesses.
  3. Verified Credibility: Audits providers across Identity, Verified Experience, Ratings, and Responsiveness.
  4. Conversational Multi-Turn Refinement: Refines searches dynamically without losing session context.

โœจ Key Features

Category Feature Status Description
Search & Discovery Natural Language Need Parser โœ… Implemented Extracts service category, skill level, budget ceiling, location radius, and timing constraints from free-form text.
Search & Discovery Conversational Search Refinement โœ… Implemented Multi-turn query adjustments (e.g. "Only highly rated", "Within 3 km", "Available Sunday") preserving active search context.
Matching Engine 7-Factor Explainable Matching โœ… Implemented Transparent scoring algorithm evaluating skills, semantic similarity, distance, schedule, budget, trust, and response rate.
Matching Engine Dynamic Algorithm Weighting โœ… Implemented Interactive drawer allowing users to customize matching weight priorities in real time.
Matching Engine Provider Comparison Modal โœ… Implemented Side-by-side comparison of candidate match scores, hourly rates, verified jobs, and distance.
Trust & Verification 4-Pillar Trust Scorecard โœ… Implemented 100-point audit evaluating Identity (25 pts), Experience (25 pts), Ratings (30 pts), and Responsiveness (20 pts).
Trust & Verification AI Review Intelligence โœ… Implemented Grounded sentiment extraction displaying top praised qualities, honest caveats, and real client testimonials.
Provider Tools Provider AI Assistant โœ… Implemented Evaluates inbound job requests, computes Request Fit Score %, and generates rate-grounded suggested replies.
Telegram Interface Full-Featured Telegram AI Bot โœ… Implemented Complete conversational bot (@LocalConnect001bot) with interactive reply keyboards, inline match cards, profile viewers, and trust audits.
User Dashboard Customer & Provider Dashboards โœ… Implemented Active request status tracking, lead management, and profile enhancement modals.

๐Ÿง  AI & Smart Matching Architecture

The LocalConnect AI subsystem (ai/) is designed around a multi-provider architecture featuring Google Gemini 1.5/2.0 with an automated, zero-latency Local Deterministic Fallback Engine. This guarantees 100% uptime, zero hallucinations, and consistent test reliability even offline.

ai/
โ”œโ”€โ”€ parser/                 # Converts free-form text into structured NeedRequirement JSON
โ”œโ”€โ”€ matching/               # 7-factor weighted multi-criteria ranking algorithm
โ”œโ”€โ”€ refinement/             # Stateful multi-turn conversational filter manager
โ”œโ”€โ”€ trust/                  # 4-pillar verified trust score computation
โ”œโ”€โ”€ review_intelligence/    # Review sentiment, praised themes, and nuance extraction
โ”œโ”€โ”€ provider_assistant/     # Inbound lead fit evaluator & draft response generator
โ”œโ”€โ”€ services/               # GeminiProvider, LocalDeterministicProvider, AIService
โ”œโ”€โ”€ schemas/                # TypeScript interfaces and JSON data contracts
โ”œโ”€โ”€ shared/                 # Semantic domain ontology and keyword dictionary
โ””โ”€โ”€ prompts/                # Structured LLM system prompts

1. 7-Factor Matching Weight Formula

$$\text{Match Score} = \sum (w_i \times s_i)$$

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ 1. Skill & Category Match       (30%) โ”€โ”€ [Core Competency] โ”‚
โ”‚ 2. Semantic Intent Similarity   (20%) โ”€โ”€ [Context Match]   โ”‚
โ”‚ 3. Distance Proximity           (15%) โ”€โ”€ [Haversine / Km]  โ”‚
โ”‚ 4. Availability & Schedule      (10%) โ”€โ”€ [Day / Slot Fit]  โ”‚
โ”‚ 5. Budget Compatibility         (10%) โ”€โ”€ [Price Fit]       โ”‚
โ”‚ 6. Verified Trust Score         (10%) โ”€โ”€ [Credibility]     โ”‚
โ”‚ 7. Historical Response Rate     (05%) โ”€โ”€ [Reliability]     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2. Match Score vs. Trust Score Distinction

  • Match Score (0โ€“100%): Measures how well the provider satisfies the current specific user request (Category, Distance, Budget, Schedule).
  • Trust Score (0โ€“100 pts): Measures the provider's overall verified credibility across all time (Aadhaar verification, completed jobs count, verified client ratings, and reply speed).

๐Ÿ—บ๏ธ How It Works

Consumer Journey

sequenceDiagram
    autonumber
    actor User as Consumer
    participant UI as Web / Telegram Bot
    participant AI as AI Intelligence Layer
    participant Match as Matching Engine
    participant DB as Provider Registry

    User->>UI: "Need a Class 12 Maths tutor near Dharampeth under โ‚น500"
    UI->>AI: Parse natural language query
    AI-->>UI: Structured Requirement (Service: Maths, Budget: โ‚น500, Loc: Dharampeth)
    UI->>Match: Match against verified providers
    Match->>DB: Query candidates in radius
    Match-->>UI: Ranked Provider Cards with 7-factor Match Scores & Why Bullets
    User->>UI: Refine: "Only available on Sunday"
    UI->>Match: Re-rank with updated Sunday filter
    Match-->>UI: Refined Candidate Results
    User->>UI: View 4-Pillar Trust Scorecard & Reviews
    User->>UI: Click Connect
Loading

๐Ÿ› ๏ธ Technology Stack

Domain Technology Purpose
Frontend Framework React 19 (TypeScript) Declarative component UI and single-page application structure
Bundler & Tooling Vite 8 + Rolldown High-speed ESM development server and optimized production bundling
Styling & Design Tailwind CSS + Vanilla CSS Modern responsive design system, glassmorphism, and dark/light modes
UI Components Radix UI + Lucide React Accessible UI primitives, dialogs, drawers, sheets, and icon set
Animations Motion (Framer Motion) Smooth micro-interactions, page transitions, and slide animations
Backend API Node.js + Express 5 REST API server routing /api/ai/* endpoints and service adapters
AI / NLP Google Gemini + Deterministic Engine Semantic natural language parsing, lead evaluations, and zero-hallucination fallback
Chatbot Interface Telegram Bot API (Node.js) Standalone Telegram bot with long-polling daemon and inline keyboard routers
Data Contracts TypeScript Interfaces + JSON Schemas Strict type safety across frontend, backend, and AI pipeline
Test Automation Node.js Native Test Runner (.test.mjs) 153 automated tests covering parser, matching, refinement, trust, and bot

๐Ÿ›๏ธ System Architecture

graph TD
    subgraph Clients["User Interfaces"]
        WebApp["๐ŸŒ Web Application (React 19 / Vite)"]
        TeleBot["๐Ÿค– Telegram Bot (@LocalConnect001bot)"]
    end

    subgraph BackendAPI["Backend Layer (Node.js / Express)"]
        Router["Express Router (/api/ai)"]
        HealthEndpoint["/api/health"]
    end

    subgraph AIIntelligence["LocalConnect AI Subsystem (ai/)"]
        Parser["Parser Engine (ai/parser)"]
        MatchingEngine["7-Factor Match Engine (ai/matching)"]
        RefinementEngine["Refinement Engine (ai/refinement)"]
        TrustEngine["Trust Engine (ai/trust)"]
        ReviewEngine["Review Intelligence (ai/review_intelligence)"]
        AssistantEngine["Provider Assistant (ai/provider_assistant)"]
        ProviderAdapter["AIService Provider (Gemini / LocalFallback)"]
    end

    subgraph DataStore["Data & Domain Layer"]
        ProviderData["Verified Providers Registry"]
        Ontology["Semantic Domain Ontology & Thesaurus"]
    end

    WebApp --> Router
    TeleBot --> Router
    Router --> Parser
    Router --> MatchingEngine
    Router --> RefinementEngine
    Router --> TrustEngine
    Router --> ReviewEngine
    Router --> AssistantEngine
    Parser --> ProviderAdapter
    MatchingEngine --> ProviderAdapter
    MatchingEngine --> ProviderData
    MatchingEngine --> Ontology
Loading

๐Ÿ“ Repository Structure

LocalConnect/
โ”œโ”€โ”€ Backend/                        # Express API Backend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ config/                 # Database and service configs
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/            # AI & request controllers
โ”‚   โ”‚   โ”œโ”€โ”€ routes/                 # Express route definitions (/api/ai, /api/health)
โ”‚   โ”‚   โ”œโ”€โ”€ app.js                  # Express application setup
โ”‚   โ”‚   โ””โ”€โ”€ server.js               # Server bootstrap entry point
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ ai/                             # Core AI Intelligence Subsystem
โ”‚   โ”œโ”€โ”€ matching/                   # 7-factor ranking algorithm & weights
โ”‚   โ”œโ”€โ”€ parser/                     # Natural language & Hinglish requirement parser
โ”‚   โ”œโ”€โ”€ refinement/                 # Conversational multi-turn search refiner
โ”‚   โ”œโ”€โ”€ trust/                      # 4-pillar trust evaluation engine
โ”‚   โ”œโ”€โ”€ review_intelligence/        # Review sentiment & theme analysis
โ”‚   โ”œโ”€โ”€ provider_assistant/         # Lead fit evaluator & reply generator
โ”‚   โ”œโ”€โ”€ services/                   # Gemini & deterministic fallback providers
โ”‚   โ”œโ”€โ”€ schemas/                    # JSON and TypeScript data contracts
โ”‚   โ”œโ”€โ”€ shared/                     # Semantic ontology and dictionary
โ”‚   โ”œโ”€โ”€ prompts/                    # System prompt templates
โ”‚   โ””โ”€โ”€ index.ts                    # AI module exports
โ”œโ”€โ”€ src/                            # Frontend Source (React 19 + TypeScript)
โ”‚   โ”œโ”€โ”€ api/                        # Client API adapters (ai, providers, auth)
โ”‚   โ”œโ”€โ”€ assets/                     # Brand logos, photography, and fonts
โ”‚   โ”œโ”€โ”€ components/                 # Reusable UI primitives (dialogs, cards, buttons)
โ”‚   โ”œโ”€โ”€ context/                    # AuthContext and RequestContext state
โ”‚   โ”œโ”€โ”€ features/                   # Feature modules (matching, trust, refinement, provider)
โ”‚   โ”œโ”€โ”€ pages/                      # 12 page views (Home, Search, Results, Dashboards, Auth)
โ”‚   โ”œโ”€โ”€ services/                   # Matching & AI client bridge
โ”‚   โ”œโ”€โ”€ styles/                     # Global styling and Tailwind tokens
โ”‚   โ”œโ”€โ”€ types/                      # Domain interfaces and contracts
โ”‚   โ””โ”€โ”€ main.tsx                    # React application entry point
โ”œโ”€โ”€ telegram/                       # Telegram AI Chatbot Subsystem
โ”‚   โ”œโ”€โ”€ bot/
โ”‚   โ”‚   โ”œโ”€โ”€ formatters/             # Card, profile, trust scorecard & review formatters
โ”‚   โ”‚   โ”œโ”€โ”€ handlers/               # Command, text, callback, and refinement routers
โ”‚   โ”‚   โ”œโ”€โ”€ keyboards/              # Inline and reply keyboard layouts
โ”‚   โ”‚   โ”œโ”€โ”€ services/               # Telegram API & LocalConnect client bridge
โ”‚   โ”‚   โ”œโ”€โ”€ session/                # Multi-turn user session context store
โ”‚   โ”‚   โ”œโ”€โ”€ config.js               # Bot configuration & token validation
โ”‚   โ”‚   โ””โ”€โ”€ main.js                 # Telegram bot polling runner
โ”‚   โ””โ”€โ”€ tests/                      # Automated Telegram test suites (Steps 3โ€“7)
โ”œโ”€โ”€ Docs/                           # Architecture specs, PRD, TRD, and schemas
โ”œโ”€โ”€ dist/                           # Optimized production bundle
โ”œโ”€โ”€ package.json                    # Project dependencies and script runner
โ”œโ”€โ”€ tsconfig.json                   # TypeScript configuration
โ””โ”€โ”€ vite.config.ts                  # Vite build configuration

๐Ÿš€ Getting Started

Prerequisites

  • Node.js: v18.0.0 or higher (node -v)
  • npm: v9.0.0 or higher (npm -v)
  • Git: Installed and configured

1. Clone the Repository

git clone https://github.com/Nipun75/LocalConnect.git
cd LocalConnect

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env file in the root directory (refer to .env.example):

cp .env.example .env

Set the required environment variables:

# Server & API Ports
PORT=5000
LOCALCONNECT_API_URL=http://localhost:5000/api

# Telegram Chatbot (Optional for Telegram bot)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_from_botfather
TELEGRAM_POLL_INTERVAL_MS=1000

# Google Gemini AI (Optional - Local Deterministic Fallback used automatically if absent)
GEMINI_API_KEY=your_gemini_api_key_here

โšก Running the Project

LocalConnect components can be run independently or concurrently:

1. Start the Frontend (Development Server)

npm run dev

Access the web app at: http://localhost:5173

2. Build & Run the Production Frontend

npm run build
npm run preview

Access the production build at: http://localhost:4173

3. Start the Backend API Server

npm run start:backend

API health check available at: http://localhost:5000/api/health

4. Start the Live Telegram AI Bot

npm run start:telegram

Open Telegram and message: @LocalConnect001bot


๐Ÿ”Œ API Endpoints

The Express Backend exposes clean RESTful endpoints consumed by both the web application and the Telegram bot:

Method Endpoint Description Sample Payload / Params
GET /api/health Health check & feature discovery None
POST /api/ai/parse-need Parse natural language text into structured requirement {"text": "Need a maths tutor for class 12 under 500"}
POST /api/ai/match 7-factor ranking of providers for structured need {"requirement": {...}}
POST /api/ai/chat Conversational query refinement {"query": "Only highly rated ones", "currentRequirement": {...}}
POST /api/ai/refine Alias for multi-turn search refinement {"query": "Within 3 km", "context": {...}}
GET /api/ai/recommendations Get personalized provider recommendations ?lat=21.1458&lng=79.0882&category=tutor
POST /api/ai/feedback Record recommendation feedback for ranking tuning {"providerId": "prov_math_01", "rating": 5}

๐Ÿค– Telegram AI Bot

The LocalConnect Telegram bot is a native integration running directly against the existing LocalConnect AI and Backend subsystem.

Telegram User โ”€โ”€> Telegram Bot Service โ”€โ”€> AI Parser โ”€โ”€> 7-Factor Match Engine โ”€โ”€> Ranked Cards

Live Bot Details

  • Username: @LocalConnect001bot
  • Supported Commands:
    • /start โ€” Welcome screen with interactive navigation buttons.
    • /help โ€” How to search and command guide.
    • /search โ€” Start a fresh provider search and reset context.
    • /profile โ€” View user account status.
    • /requests โ€” View active service requests.
  • Natural Language Capabilities:
    • Send any natural language requirement directly: "Need an emergency electrician in Dharampeth right now"
    • Refine conversationally: "Only ones available Sunday", "Increase budget to โ‚น700", "Within 3 km"
    • Tap [ ๐Ÿ‘ค View Profile ], [ ๐Ÿ›ก๏ธ Trust Scorecard ], and [ โญ Customer Reviews ] to inspect credentials before connecting.

๐Ÿงช Testing Strategy

LocalConnect includes an extensive automated test suite of 153 unit and end-to-end tests validating all algorithms, fallback states, and bot interactions.

# Run all test suites across the repository
npm run test:all

Test Suites Breakdown

  1. AI Matching & Scoring Tests (npm run test:step6):
    • 19 automated tests validating natural language parsing, 7-factor weighted scoring, explainable why generation, conversational refinement, and provider assistant fit calculations.
  2. Telegram Bot Integration Tests (npm run test:telegram):
    • 102 automated tests across Steps 3, 4, 5, 6, and 7 validating connection lifecycle, requirement summaries, candidate rankings, context preservation, 4-pillar trust scorecards, and security on malformed callback IDs.
  3. Core AI Unit Tests (npm test):
    • 32 automated tests validating offline deterministic fallbacks and semantic ontology matching.

๐Ÿ”’ Security & Privacy

  • Zero PII Exposure: Private provider contact details (phone number, email, address) are never exposed through Telegram cards or search APIs prior to confirmed user connection.
  • Credential Isolation: Secrets (TELEGRAM_BOT_TOKEN, MONGO_URI, GEMINI_API_KEY) are managed strictly via git-ignored .env files and validated at boot.
  • Deterministic Guardrails: AI response templates are strictly grounded in factual provider profiles to prevent LLM hallucinations.
  • Input Sanitization: Callbacks, queries, and numerical parameters are parsed with strict boundary validation and safe fallback handlers.

๐Ÿ”„ Development Workflow

Create Feature Branch โ”€โ”€> Local Development โ”€โ”€> Run Test Suite โ”€โ”€> Build Verification โ”€โ”€> Open PR
  1. Create Branch: git checkout -b feature/your-feature-name
  2. Develop: Make modular code changes following the existing architecture.
  3. Test: Run npm run test:all (all 153 tests must pass 100%).
  4. Build: Run npm run build to verify clean TypeScript compilation and asset bundling.
  5. Commit & Push: Follow conventional commit conventions (feat:, fix:, docs:, test:).

๐Ÿ—บ๏ธ Roadmap

โœ… Phase 1: Core Implementation (Completed)

  • Natural language need parser with Hinglish support
  • 7-factor transparent provider matching algorithm
  • 4-pillar verified trust scorecard engine
  • AI review intelligence and testimonial summarization
  • Conversational multi-turn search refinement
  • Provider AI Assistant with request fit score & reply drafting
  • Complete 12-screen responsive React 19 web application
  • Native Telegram AI chatbot (@LocalConnect001bot)
  • 153 automated integration and unit tests

๐Ÿšง Phase 2: Platform Enhancements (In Progress)

  • Direct in-app WebRTC audio/video consultations
  • Multi-city expansion beyond the Nagpur pilot region
  • WhatsApp Business Cloud API bot integration
  • Real-time provider location tracking on interactive Leaflet/Mapbox maps

๐Ÿ”ฎ Phase 3: Long-term Vision (Planned)

  • Decentralized identity verification via verifiable credentials
  • Escrow-based smart milestone payments
  • Multi-lingual voice-to-text search support (Hindi, Marathi)

๐Ÿ“„ License & Authors

This project is licensed under the ISC License โ€” see the LICENSE file for details.

Developed with โค๏ธ for LocalConnect โ€” Making local discovery smarter, more trusted, and seamlessly connected.

Repository: https://github.com/Nipun75/LocalConnect

Releases

Packages

Contributors

Languages