# harshithreddy973/karmika-sih-26 architecture

> Architecture diagram of the GitHub repository harshithreddy973/karmika-sih-26, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshithreddy973/karmika-sih-26
- Repository: https://github.com/harshithreddy973/karmika-sih-26

## Overview

Karmika is a cooperative local-services marketplace. Customers book and locate a service, review nearby worker matches, then follow the booking through worker acceptance and completion, itemized payment, welfare contribution, and review. Workers maintain skills, availability, and location, handle requests, and complete jobs; administrators verify workers and manage services, bookings, welfare, and demand forecasts. The frontend uses Supabase for authentication and persisted product data, with SQL-backed location matching. The graph follows README capabilities where implementation excerpts are absent; those connections are documented rather than inferred from filenames.

Main entry points: [`src/lib/supabaseClient.js`](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/supabaseClient.js) (Supabase client), [`src/App.jsx`](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/App.jsx) (Route dispatch), [`src/pages/AdminDashboard.jsx`](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/AdminDashboard.jsx) (Admin dashboard), [`src/pages/BookService.jsx`](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BookService.jsx) (Create booking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and identity"]
  node_app["Route dispatch<br/>[App.jsx]"]
  node_auth["Authentication and roles<br/>[useAuth.js]"]
end

subgraph group_customer["Customer booking"]
  node_browse["Browse services<br/>[BrowseServices.jsx]"]
  node_booking["Create booking<br/>[BookService.jsx]"]
  node_map["Map location picker<br/>[MapPicker.jsx]"]
  node_matching["Nearby worker matching<br/>[MatchedWorkers.jsx]"]
  node_score["Match scoring<br/>[matchingScore.js]"]
  node_bookings["Booking status and tracking<br/>[BookingTracker.jsx]"]
  node_mybookings["Customer bookings<br/>[MyBookings.jsx]"]
  node_payment["Payment summary<br/>[PaymentSummary.jsx]"]
  node_review["Customer rating and review<br/>[RateReview.jsx]"]
end

subgraph group_worker["Worker operations"]
  node_requests["Worker requests and acceptance"]
  node_profile["Worker profile and location"]
  node_completion["Job completion"]
end

subgraph group_admin["Platform administration"]
  node_adminpage["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_verification["Worker verification"]
  node_servicesmanager["Services and pricing"]
  node_overview["Booking overview"]
  node_welfare["Worker welfare"]
  node_forecast["Demand forecasting<br/>[DemandForecast.jsx]"]
end

subgraph group_services["Shared services"]
  node_supabase["Supabase client<br/>[supabaseClient.js]"]
  node_data[("Platform database<br/>[phase1_schema.sql]")]
  node_jobdisplay["Job display helpers<br/>[jobDisplay.js]"]
  node_paymentcalc["Payment breakdown<br/>[payment.js]"]
  node_forecastlib["Forecast calculations<br/>[forecast.js]"]
  node_i18n["English and Hindi<br/>[index.js]"]
  node_languages["Language preference"]
end

node_users(("Customer / worker / admin"))

node_users -->|"opens app"| node_app
node_app -->|"guards routes"| node_auth
node_auth -->|"loads session"| node_supabase
node_supabase -.->|"queries"| node_data
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_booking
node_booking -->|"renders"| node_map
node_booking -->|"creates booking"| node_supabase
node_booking -->|"navigates to"| node_matching
node_matching -->|"uses scoring"| node_score
node_matching -->|"loads candidates"| node_supabase
node_app -->|"routes to"| node_requests
node_requests -->|"loads and updates jobs"| node_supabase
node_profile -->|"saves worker profile"| node_supabase
node_requests -->|"formats job details"| node_jobdisplay
node_app -->|"routes to"| node_completion
node_completion -->|"updates completion"| node_supabase
node_completion -->|"computes payout"| node_paymentcalc
node_completion -->|"formats job details"| node_jobdisplay
node_app -->|"routes to"| node_payment
node_payment -->|"loads payment data"| node_supabase
node_payment -->|"computes totals"| node_paymentcalc
node_app -->|"routes to"| node_review
node_review -->|"records review"| node_supabase
node_app -->|"routes to"| node_bookings
node_app -->|"routes to"| node_mybookings
node_bookings -->|"loads status"| node_supabase
node_mybookings -->|"loads bookings"| node_supabase
node_app -->|"routes to"| node_adminpage
node_adminpage -->|"renders tab"| node_verification
node_adminpage -->|"renders tab"| node_servicesmanager
node_adminpage -->|"renders tab"| node_overview
node_adminpage -->|"renders tab"| node_welfare
node_adminpage -->|"renders tab"| node_forecast
node_verification -->|"updates verification"| node_supabase
node_servicesmanager -->|"manages services"| node_supabase
node_overview -->|"loads bookings"| node_supabase
node_welfare -->|"loads contributions"| node_supabase
node_forecast -->|"loads booking history"| node_supabase
node_forecast -->|"calculates forecast"| node_forecastlib
node_languages -->|"changes language"| node_i18n
node_languages -->|"saves preference"| node_supabase
node_auth -->|"applies preference"| node_i18n

click node_app "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/App.jsx"
click node_auth "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/useAuth.js"
click node_supabase "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/supabaseClient.js"
click node_data "https://github.com/harshithreddy973/karmika-sih-26/blob/main/database/phase1_schema.sql"
click node_browse "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BrowseServices.jsx"
click node_booking "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BookService.jsx"
click node_map "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/MapPicker.jsx"
click node_matching "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/MatchedWorkers.jsx"
click node_score "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/matchingScore.js"
click node_bookings "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BookingTracker.jsx"
click node_mybookings "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/MyBookings.jsx"
click node_requests "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerJobRequests.jsx"
click node_profile "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerProfileSetup.jsx"
click node_completion "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerJobCompletion.jsx"
click node_jobdisplay "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/jobDisplay.js"
click node_payment "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/PaymentSummary.jsx"
click node_paymentcalc "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/payment.js"
click node_review "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/RateReview.jsx"
click node_adminpage "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/AdminDashboard.jsx"
click node_verification "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/VerificationQueue.jsx"
click node_servicesmanager "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/ServicesManager.jsx"
click node_overview "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/BookingsOverview.jsx"
click node_welfare "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/WelfareOverview.jsx"
click node_forecast "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/DemandForecast.jsx"
click node_forecastlib "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/forecast.js"
click node_i18n "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/i18n/index.js"
click node_languages "https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/LanguageSwitcher.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth toneBlue
class node_browse,node_booking,node_map,node_matching,node_score,node_bookings,node_mybookings,node_payment,node_review toneAmber
class node_requests,node_profile,node_completion toneMint
class node_adminpage,node_verification,node_servicesmanager,node_overview,node_welfare,node_forecast,node_users toneRose
class node_supabase,node_data,node_jobdisplay,node_paymentcalc,node_forecastlib,node_i18n,node_languages toneIndigo
```

## Components

### App and identity

- [Route dispatch](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication and roles](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/useAuth.js): `src/lib/useAuth.js`

### Customer booking

- [Browse services](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BrowseServices.jsx): `src/pages/BrowseServices.jsx`
- [Create booking](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BookService.jsx): `src/pages/BookService.jsx`
- [Map location picker](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/MapPicker.jsx): `src/components/MapPicker.jsx`
- [Nearby worker matching](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/MatchedWorkers.jsx): `src/pages/MatchedWorkers.jsx`
- [Match scoring](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/matchingScore.js): `src/lib/matchingScore.js`
- [Booking status and tracking](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/BookingTracker.jsx): `src/pages/BookingTracker.jsx`
- [Customer bookings](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/MyBookings.jsx): `src/pages/MyBookings.jsx`
- [Payment summary](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/PaymentSummary.jsx): `src/pages/PaymentSummary.jsx`
- [Customer rating and review](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/RateReview.jsx): `src/pages/RateReview.jsx`

### Worker operations

- [Worker requests and acceptance](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerJobRequests.jsx): `src/pages/WorkerJobRequests.jsx`
- [Worker profile and location](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerProfileSetup.jsx): `src/pages/WorkerProfileSetup.jsx`
- [Job completion](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/WorkerJobCompletion.jsx): `src/pages/WorkerJobCompletion.jsx`

### Platform administration

- [Admin dashboard](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/pages/AdminDashboard.jsx): `src/pages/AdminDashboard.jsx`
- [Worker verification](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/VerificationQueue.jsx): `src/components/admin/VerificationQueue.jsx`
- [Services and pricing](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/ServicesManager.jsx): `src/components/admin/ServicesManager.jsx`
- [Booking overview](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/BookingsOverview.jsx): `src/components/admin/BookingsOverview.jsx`
- [Worker welfare](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/WelfareOverview.jsx): `src/components/admin/WelfareOverview.jsx`
- [Demand forecasting](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/admin/DemandForecast.jsx): `src/components/admin/DemandForecast.jsx`

### Shared services

- [Supabase client](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/supabaseClient.js): `src/lib/supabaseClient.js`
- [Platform database](https://github.com/harshithreddy973/karmika-sih-26/blob/main/database/phase1_schema.sql): `database/phase1_schema.sql`
- [Job display helpers](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/jobDisplay.js): `src/lib/jobDisplay.js`
- [Payment breakdown](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/payment.js): `src/lib/payment.js`
- [Forecast calculations](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/lib/forecast.js): `src/lib/forecast.js`
- [English and Hindi](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/i18n/index.js): `src/i18n/index.js`
- [Language preference](https://github.com/harshithreddy973/karmika-sih-26/blob/main/src/components/LanguageSwitcher.jsx): `src/components/LanguageSwitcher.jsx`

### Other components

- **Customer / worker / admin**

## Connections

- Customer / worker / admin → Route dispatch: opens app (evidence: `README.md`)
- Route dispatch → Authentication and roles: guards routes (evidence: `src/App.jsx`)
- Authentication and roles → Supabase client: loads session (evidence: `src/lib/useAuth.js`)
- Supabase client → Platform database: queries (evidence: `README.md`)
- Route dispatch → Browse services: routes to (evidence: `src/App.jsx`)
- Route dispatch → Create booking: routes to (evidence: `src/App.jsx`)
- Create booking → Map location picker: renders (evidence: `src/pages/BookService.jsx`)
- Create booking → Supabase client: creates booking (evidence: `src/pages/BookService.jsx`)
- Create booking → Nearby worker matching: navigates to (evidence: `src/pages/BookService.jsx`)
- Nearby worker matching → Match scoring: uses scoring (evidence: `src/pages/MatchedWorkers.jsx`)
- Nearby worker matching → Supabase client: loads candidates (evidence: `src/pages/MatchedWorkers.jsx`)
- Route dispatch → Worker requests and acceptance: routes to (evidence: `src/App.jsx`)
- Worker requests and acceptance → Supabase client: loads and updates jobs (evidence: `src/pages/WorkerJobRequests.jsx`)
- Worker profile and location → Supabase client: saves worker profile (evidence: `src/pages/WorkerProfileSetup.jsx`)
- Worker requests and acceptance → Job display helpers: formats job details (evidence: `src/pages/WorkerJobRequests.jsx`)
- Route dispatch → Job completion: routes to (evidence: `src/App.jsx`)
- Job completion → Supabase client: updates completion (evidence: `src/pages/WorkerJobCompletion.jsx`)
- Job completion → Payment breakdown: computes payout (evidence: `src/pages/WorkerJobCompletion.jsx`)
- Job completion → Job display helpers: formats job details (evidence: `src/pages/WorkerJobCompletion.jsx`)
- Route dispatch → Payment summary: routes to (evidence: `src/App.jsx`)
- Payment summary → Supabase client: loads payment data (evidence: `src/pages/PaymentSummary.jsx`)
- Payment summary → Payment breakdown: computes totals (evidence: `src/pages/PaymentSummary.jsx`)
- Route dispatch → Customer rating and review: routes to (evidence: `src/App.jsx`)
- Customer rating and review → Supabase client: records review (evidence: `src/pages/RateReview.jsx`)
- Route dispatch → Booking status and tracking: routes to (evidence: `src/App.jsx`)
- Route dispatch → Customer bookings: routes to (evidence: `src/App.jsx`)
- Booking status and tracking → Supabase client: loads status (evidence: `src/pages/BookingTracker.jsx`)
- Customer bookings → Supabase client: loads bookings (evidence: `src/pages/MyBookings.jsx`)
- Route dispatch → Admin dashboard: routes to (evidence: `src/App.jsx`)
- Admin dashboard → Worker verification: renders tab (evidence: `src/pages/AdminDashboard.jsx`)
- Admin dashboard → Services and pricing: renders tab (evidence: `src/pages/AdminDashboard.jsx`)
- Admin dashboard → Booking overview: renders tab (evidence: `src/pages/AdminDashboard.jsx`)
- Admin dashboard → Worker welfare: renders tab (evidence: `src/pages/AdminDashboard.jsx`)
- Admin dashboard → Demand forecasting: renders tab (evidence: `src/pages/AdminDashboard.jsx`)
- Worker verification → Supabase client: updates verification (evidence: `src/components/admin/VerificationQueue.jsx`)
- Services and pricing → Supabase client: manages services (evidence: `src/components/admin/ServicesManager.jsx`)
- Booking overview → Supabase client: loads bookings (evidence: `src/components/admin/BookingsOverview.jsx`)
- Worker welfare → Supabase client: loads contributions (evidence: `src/components/admin/WelfareOverview.jsx`)
- Demand forecasting → Supabase client: loads booking history (evidence: `src/components/admin/DemandForecast.jsx`)
- Demand forecasting → Forecast calculations: calculates forecast (evidence: `src/components/admin/DemandForecast.jsx`)
- Language preference → English and Hindi: changes language (evidence: `src/components/LanguageSwitcher.jsx`)
- Language preference → Supabase client: saves preference (evidence: `src/components/LanguageSwitcher.jsx`)
- Authentication and roles → English and Hindi: applies preference (evidence: `src/lib/useAuth.js`)
