# ishanth777/sih architecture

> Architecture diagram of the GitHub repository ishanth777/sih, 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/ishanth777/sih
- Repository: https://github.com/ishanth777/sih

## Overview

This is a cooperative labour marketplace serving customers, workers, cooperative societies, and federations. Its central workflow is customer service discovery and booking, followed by worker matching, job tracking, and payment; operational modules also cover identity, cooperative administration, welfare, disputes, and demand forecasting. Web and mobile clients sit alongside a NestJS API and a separate Python forecasting service. The supplied excerpts establish only some call paths; uncertain integrations are omitted or marked unverified.

Main entry points: [`apps/api/src/requests/requests.service.ts`](https://github.com/ishanth777/sih/blob/main/apps/api/src/requests/requests.service.ts) (Service requests), [`apps/api/src/workers/workers.service.ts`](https://github.com/ishanth777/sih/blob/main/apps/api/src/workers/workers.service.ts) (Worker profiles and availability), [`apps/api/src/matching/matching.service.ts`](https://github.com/ishanth777/sih/blob/main/apps/api/src/matching/matching.service.ts) (Worker matching), [`apps/api/src/auth/auth.service.ts`](https://github.com/ishanth777/sih/blob/main/apps/api/src/auth/auth.service.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experiences"]
  node_web_booking["Web booking<br/>[page.tsx]"]
  node_recommend["Worker recommendations"]
  node_mobile_worker["Worker mobile screens"]
  node_location_hook["Location tracking hook"]
  node_location_service["Location service"]
  node_offline[("Offline cache")]
end

subgraph group_api["Marketplace API"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_customers["Customer accounts"]
  node_requests["Service requests"]
  node_catalog["Service catalog"]
  node_matching["Worker matching"]
  node_jobs["Job lifecycle<br/>[jobs.service.ts]"]
  node_payments["Payments"]
  node_workers["Worker profiles and availability<br/>[workers.service.ts]"]
  node_disputes["Disputes"]
  node_welfare["Worker welfare<br/>[welfare.service.ts]"]
  node_notifications["Notifications"]
  node_prisma[("Database access<br/>[prisma.service.ts]")]
end

subgraph group_org["Cooperative operations"]
  node_federations["Federation management"]
  node_cooperatives["Cooperative management"]
end

subgraph group_insights["Forecasting"]
  node_forecast_api["Forecast API"]
  node_forecast_runtime["Forecast endpoint<br/>[main.py]"]
  node_forecaster["Demand forecaster<br/>[forecaster.py]"]
end

node_customer(("Customer"))
node_worker(("Worker"))
node_admins(("Society and federation admins"))

node_customer -.->|"books through"| node_web_booking
node_web_booking -.->|"submits request"| node_requests
node_customer -.->|"requests recommendation"| node_recommend
node_recommend -->|"creates booking"| node_requests
node_worker -.->|"uses"| node_mobile_worker
node_mobile_worker -.->|"tracks location"| node_location_hook
node_location_hook -->|"calls"| node_location_service
node_location_service -.->|"updates location"| node_workers
node_worker -->|"manages profile"| node_workers
node_admins -->|"manages workers"| node_workers
node_customer -->|"manages account"| node_customers
node_admins -->|"administers federation"| node_federations
node_admins -->|"administers cooperative"| node_cooperatives
node_admins -.->|"reviews requests"| node_requests
node_admins -.->|"maintains catalog"| node_catalog
node_admins -->|"manages welfare"| node_welfare
node_customer -.->|"pays for jobs"| node_payments
node_customer -.->|"raises dispute"| node_disputes
node_requests -.->|"requests matching"| node_matching
node_matching -.->|"selects workers"| node_workers
node_matching -.->|"dispatches job"| node_jobs
node_jobs -.->|"initiates payment"| node_payments
node_auth -->|"reads and writes"| node_prisma
node_auth -.->|"may notify"| node_notifications
node_admins -->|"requests forecast"| node_forecast_api
node_forecast_api -.->|"obtains forecast"| node_forecast_runtime
node_forecast_runtime -->|"generates forecast"| node_forecaster

click node_web_booking "https://github.com/ishanth777/sih/blob/main/apps/web/app/(customer)/booking/page.tsx"
click node_recommend "https://github.com/ishanth777/sih/blob/main/apps/web/components/matching/WorkerRecommendationChatbot.tsx"
click node_mobile_worker "https://github.com/ishanth777/sih/blob/main/apps/mobile/src/screens/WorkerAvailabilityToggle.tsx"
click node_location_hook "https://github.com/ishanth777/sih/blob/main/apps/mobile/src/hooks/useWorkerLocation.ts"
click node_location_service "https://github.com/ishanth777/sih/blob/main/apps/mobile/src/services/location.service.ts"
click node_offline "https://github.com/ishanth777/sih/blob/main/apps/mobile/src/services/offline-cache.service.ts"
click node_auth "https://github.com/ishanth777/sih/blob/main/apps/api/src/auth/auth.service.ts"
click node_customers "https://github.com/ishanth777/sih/blob/main/apps/api/src/customers/customers.service.ts"
click node_requests "https://github.com/ishanth777/sih/blob/main/apps/api/src/requests/requests.service.ts"
click node_catalog "https://github.com/ishanth777/sih/blob/main/apps/api/src/services-catalog/services-catalog.service.ts"
click node_matching "https://github.com/ishanth777/sih/blob/main/apps/api/src/matching/matching.service.ts"
click node_jobs "https://github.com/ishanth777/sih/blob/main/apps/api/src/jobs/jobs.service.ts"
click node_payments "https://github.com/ishanth777/sih/blob/main/apps/api/src/payments/payments.service.ts"
click node_workers "https://github.com/ishanth777/sih/blob/main/apps/api/src/workers/workers.service.ts"
click node_disputes "https://github.com/ishanth777/sih/blob/main/apps/api/src/disputes/disputes.service.ts"
click node_welfare "https://github.com/ishanth777/sih/blob/main/apps/api/src/welfare/welfare.service.ts"
click node_notifications "https://github.com/ishanth777/sih/blob/main/apps/api/src/notifications/notifications.service.ts"
click node_prisma "https://github.com/ishanth777/sih/blob/main/apps/api/src/common/prisma/prisma.service.ts"
click node_federations "https://github.com/ishanth777/sih/blob/main/apps/api/src/federations/federations.service.ts"
click node_cooperatives "https://github.com/ishanth777/sih/blob/main/apps/api/src/cooperatives/cooperatives.service.ts"
click node_forecast_api "https://github.com/ishanth777/sih/blob/main/apps/api/src/forecasting/forecasting.service.ts"
click node_forecast_runtime "https://github.com/ishanth777/sih/blob/main/apps/forecasting/main.py"
click node_forecaster "https://github.com/ishanth777/sih/blob/main/apps/forecasting/forecaster.py"

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_web_booking,node_recommend,node_mobile_worker,node_location_hook,node_location_service,node_offline toneBlue
class node_auth,node_customers,node_requests,node_catalog,node_matching,node_jobs,node_payments,node_workers,node_disputes,node_welfare,node_notifications,node_prisma toneAmber
class node_federations,node_cooperatives toneMint
class node_forecast_api,node_forecast_runtime,node_forecaster,node_worker toneRose
class node_customer,node_admins toneIndigo
```

## Components

### Client experiences

- [Web booking](https://github.com/ishanth777/sih/blob/main/apps/web/app/(customer)/booking/page.tsx): `apps/web/app/(customer)/booking/page.tsx`
- [Worker recommendations](https://github.com/ishanth777/sih/blob/main/apps/web/components/matching/WorkerRecommendationChatbot.tsx): `apps/web/components/matching/WorkerRecommendationChatbot.tsx`
- [Worker mobile screens](https://github.com/ishanth777/sih/blob/main/apps/mobile/src/screens/WorkerAvailabilityToggle.tsx): `apps/mobile/src/screens/WorkerAvailabilityToggle.tsx`
- [Location tracking hook](https://github.com/ishanth777/sih/blob/main/apps/mobile/src/hooks/useWorkerLocation.ts): `apps/mobile/src/hooks/useWorkerLocation.ts`
- [Location service](https://github.com/ishanth777/sih/blob/main/apps/mobile/src/services/location.service.ts): `apps/mobile/src/services/location.service.ts`
- [Offline cache](https://github.com/ishanth777/sih/blob/main/apps/mobile/src/services/offline-cache.service.ts): `apps/mobile/src/services/offline-cache.service.ts`

### Marketplace API

- [Authentication](https://github.com/ishanth777/sih/blob/main/apps/api/src/auth/auth.service.ts): `apps/api/src/auth/auth.service.ts`
- [Customer accounts](https://github.com/ishanth777/sih/blob/main/apps/api/src/customers/customers.service.ts): `apps/api/src/customers/customers.service.ts`
- [Service requests](https://github.com/ishanth777/sih/blob/main/apps/api/src/requests/requests.service.ts): `apps/api/src/requests/requests.service.ts`
- [Service catalog](https://github.com/ishanth777/sih/blob/main/apps/api/src/services-catalog/services-catalog.service.ts): `apps/api/src/services-catalog/services-catalog.service.ts`
- [Worker matching](https://github.com/ishanth777/sih/blob/main/apps/api/src/matching/matching.service.ts): `apps/api/src/matching/matching.service.ts`
- [Job lifecycle](https://github.com/ishanth777/sih/blob/main/apps/api/src/jobs/jobs.service.ts): `apps/api/src/jobs/jobs.service.ts`
- [Payments](https://github.com/ishanth777/sih/blob/main/apps/api/src/payments/payments.service.ts): `apps/api/src/payments/payments.service.ts`
- [Worker profiles and availability](https://github.com/ishanth777/sih/blob/main/apps/api/src/workers/workers.service.ts): `apps/api/src/workers/workers.service.ts`
- [Disputes](https://github.com/ishanth777/sih/blob/main/apps/api/src/disputes/disputes.service.ts): `apps/api/src/disputes/disputes.service.ts`
- [Worker welfare](https://github.com/ishanth777/sih/blob/main/apps/api/src/welfare/welfare.service.ts): `apps/api/src/welfare/welfare.service.ts`
- [Notifications](https://github.com/ishanth777/sih/blob/main/apps/api/src/notifications/notifications.service.ts): `apps/api/src/notifications/notifications.service.ts`
- [Database access](https://github.com/ishanth777/sih/blob/main/apps/api/src/common/prisma/prisma.service.ts): `apps/api/src/common/prisma/prisma.service.ts`

### Cooperative operations

- [Federation management](https://github.com/ishanth777/sih/blob/main/apps/api/src/federations/federations.service.ts): `apps/api/src/federations/federations.service.ts`
- [Cooperative management](https://github.com/ishanth777/sih/blob/main/apps/api/src/cooperatives/cooperatives.service.ts): `apps/api/src/cooperatives/cooperatives.service.ts`

### Forecasting

- [Forecast API](https://github.com/ishanth777/sih/blob/main/apps/api/src/forecasting/forecasting.service.ts): `apps/api/src/forecasting/forecasting.service.ts`
- [Forecast endpoint](https://github.com/ishanth777/sih/blob/main/apps/forecasting/main.py): `apps/forecasting/main.py`
- [Demand forecaster](https://github.com/ishanth777/sih/blob/main/apps/forecasting/forecaster.py): `apps/forecasting/forecaster.py`

### Other components

- **Customer**
- **Worker**
- **Society and federation admins**

## Connections

- Customer → Web booking: books through
- Web booking → Service requests: submits request
- Customer → Worker recommendations: requests recommendation
- Worker recommendations → Service requests: creates booking (evidence: `apps/web/components/matching/WorkerRecommendationChatbot.tsx`)
- Worker → Worker mobile screens: uses
- Worker mobile screens → Location tracking hook: tracks location
- Location tracking hook → Location service: calls (evidence: `apps/mobile/src/hooks/useWorkerLocation.ts`)
- Location service → Worker profiles and availability: updates location
- Worker → Worker profiles and availability: manages profile
- Society and federation admins → Worker profiles and availability: manages workers
- Customer → Customer accounts: manages account
- Society and federation admins → Federation management: administers federation
- Society and federation admins → Cooperative management: administers cooperative
- Society and federation admins → Service requests: reviews requests
- Society and federation admins → Service catalog: maintains catalog
- Society and federation admins → Worker welfare: manages welfare
- Customer → Payments: pays for jobs
- Customer → Disputes: raises dispute
- Service requests → Worker matching: requests matching
- Worker matching → Worker profiles and availability: selects workers
- Worker matching → Job lifecycle: dispatches job
- Job lifecycle → Payments: initiates payment
- Authentication → Database access: reads and writes (evidence: `apps/api/src/auth/auth.service.ts`)
- Authentication → Notifications: may notify (evidence: `apps/api/src/auth/auth.service.ts`)
- Society and federation admins → Forecast API: requests forecast
- Forecast API → Forecast endpoint: obtains forecast
- Forecast endpoint → Demand forecaster: generates forecast (evidence: `apps/forecasting/main.py`)
