# awaismumtaz1406/gig-fair architecture

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

- Interactive diagram: https://gitdiagram.com/awaismumtaz1406/gig-fair
- Repository: https://github.com/awaismumtaz1406/gig-fair

## Overview

GigFair is a worker-facing earnings, fairness, and dispute application with verifier and advocate roles. The main workflow runs from account access through earnings logging and anomaly-aware dashboarding, then optional verification, grievance handling, and certificate generation; advocates also review aggregate fairness and complaint patterns. The source index and excerpts support the frontend routing, API-client use, and selected calculations. The README documents database and media-storage capabilities, but their implementation and wiring are not established by the sampled source, so those relationships are documented rather than asserted as code calls.

Main entry points: [`src/App.jsx`](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/App.jsx) (Role-based routes), [`src/services/api.js`](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/services/api.js) (REST API clients), [`src/pages/EarningsLogger.jsx`](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/EarningsLogger.jsx) (Earnings logging), [`src/pages/Dashboard.jsx`](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/Dashboard.jsx) (Worker dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_app_routes["Role-based routes<br/>[App.jsx]"]
  node_auth_pages["Sign in and register<br/>[Login.jsx]"]
  node_auth_state["Authentication state<br/>[authStore.js]"]
end

subgraph group_worker["Worker earnings"]
  node_earnings_entry["Earnings logging<br/>[EarningsLogger.jsx]"]
  node_worker_dashboard["Worker dashboard<br/>[Dashboard.jsx]"]
  node_anomaly_rules["Anomaly and fairness rules"]
  node_charts["Analytics charts"]
  node_grievances["Grievance board<br/>[GrievanceBoard.jsx]"]
end

subgraph group_review["Review and advocacy"]
  node_verification["Earnings verification"]
  node_advocate_dashboard["Advocate analytics"]
  node_certificates["Income certificates"]
end

subgraph group_shared["Shared application services"]
  node_api_client["REST API clients<br/>[api.js]"]
  node_demo_state["Demo mode state<br/>[demoStore.js]"]
  node_demo_records["Demo records<br/>[demoData.js]"]
  node_ui_components["Shared UI components"]
end

node_worker_actor(("Gig worker"))
node_verifier_actor(("Verifier"))
node_advocate_actor(("Advocate"))
node_backend["Application API server<br/>[server.ts]"]
node_database[("MongoDB persistence")]
node_media_storage[("Verification media storage")]

node_worker_actor -->|"uses app"| node_app_routes
node_verifier_actor -->|"uses app"| node_app_routes
node_advocate_actor -->|"uses app"| node_app_routes
node_app_routes -->|"routes to"| node_auth_pages
node_app_routes -->|"routes to"| node_worker_dashboard
node_app_routes -->|"routes to"| node_earnings_entry
node_app_routes -->|"routes to"| node_verification
node_app_routes -->|"routes to"| node_grievances
node_app_routes -->|"routes to"| node_advocate_dashboard
node_app_routes -->|"routes to"| node_certificates
node_app_routes -->|"checks roles"| node_auth_state
node_auth_pages -->|"uses API"| node_api_client
node_auth_pages -->|"updates session"| node_auth_state
node_earnings_entry -->|"submits earnings"| node_api_client
node_earnings_entry -->|"checks anomalies"| node_anomaly_rules
node_worker_dashboard -->|"loads metrics"| node_api_client
node_worker_dashboard -->|"renders trends"| node_charts
node_worker_dashboard -->|"renders cards"| node_ui_components
node_grievances -->|"loads and files"| node_api_client
node_verification -->|"updates review"| node_api_client
node_verification -->|"checks deductions"| node_anomaly_rules
node_advocate_dashboard -->|"scores platforms"| node_anomaly_rules
node_advocate_dashboard -->|"reads examples"| node_demo_records
node_certificates -->|"uses API"| node_api_client
node_earnings_entry -->|"supports demo"| node_demo_state
node_earnings_entry -->|"reads examples"| node_demo_records
node_grievances -->|"reads examples"| node_demo_records
node_verification -->|"reads examples"| node_demo_records
node_api_client -.->|"calls endpoints"| node_backend
node_backend -.->|"persists records"| node_database
node_backend -.->|"stores proof files"| node_media_storage

click node_app_routes "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/App.jsx"
click node_auth_pages "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/Login.jsx"
click node_auth_state "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/store/authStore.js"
click node_earnings_entry "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/EarningsLogger.jsx"
click node_worker_dashboard "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/Dashboard.jsx"
click node_anomaly_rules "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/utils/anomalyDetection.js"
click node_charts "https://github.com/awaismumtaz1406/gig-fair/tree/master/src/components/charts"
click node_grievances "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/GrievanceBoard.jsx"
click node_verification "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/VerificationPanel.jsx"
click node_advocate_dashboard "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/AdvocateDashboard.jsx"
click node_certificates "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/CertificatePage.jsx"
click node_api_client "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/services/api.js"
click node_demo_state "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/store/demoStore.js"
click node_demo_records "https://github.com/awaismumtaz1406/gig-fair/blob/master/src/data/demoData.js"
click node_ui_components "https://github.com/awaismumtaz1406/gig-fair/tree/master/src/components/ui"
click node_backend "https://github.com/awaismumtaz1406/gig-fair/blob/master/server.ts"

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_routes,node_auth_pages,node_auth_state toneBlue
class node_earnings_entry,node_worker_dashboard,node_anomaly_rules,node_charts,node_grievances,node_database,node_media_storage toneAmber
class node_verification,node_advocate_dashboard,node_certificates,node_backend toneMint
class node_api_client,node_demo_state,node_demo_records,node_ui_components,node_worker_actor toneRose
class node_verifier_actor,node_advocate_actor toneIndigo
```

## Components

### Access and navigation

- [Role-based routes](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/App.jsx): `src/App.jsx`
- [Sign in and register](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Authentication state](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/store/authStore.js): `src/store/authStore.js`

### Worker earnings

- [Earnings logging](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/EarningsLogger.jsx): `src/pages/EarningsLogger.jsx`
- [Worker dashboard](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Anomaly and fairness rules](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/utils/anomalyDetection.js): `src/utils/anomalyDetection.js`
- [Analytics charts](https://github.com/awaismumtaz1406/gig-fair/tree/master/src/components/charts): `src/components/charts`
- [Grievance board](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/GrievanceBoard.jsx): `src/pages/GrievanceBoard.jsx`

### Review and advocacy

- [Earnings verification](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/VerificationPanel.jsx): `src/pages/VerificationPanel.jsx`
- [Advocate analytics](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/AdvocateDashboard.jsx): `src/pages/AdvocateDashboard.jsx`
- [Income certificates](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/pages/CertificatePage.jsx): `src/pages/CertificatePage.jsx`

### Shared application services

- [REST API clients](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/services/api.js): `src/services/api.js`
- [Demo mode state](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/store/demoStore.js): `src/store/demoStore.js`
- [Demo records](https://github.com/awaismumtaz1406/gig-fair/blob/master/src/data/demoData.js): `src/data/demoData.js`
- [Shared UI components](https://github.com/awaismumtaz1406/gig-fair/tree/master/src/components/ui): `src/components/ui`

### Other components

- **Gig worker**
- **Verifier**
- **Advocate**
- [Application API server](https://github.com/awaismumtaz1406/gig-fair/blob/master/server.ts): `server.ts`
- **MongoDB persistence**
- **Verification media storage**

## Connections

- Gig worker → Role-based routes: uses app (evidence: `README.md`)
- Verifier → Role-based routes: uses app (evidence: `README.md`)
- Advocate → Role-based routes: uses app (evidence: `README.md`)
- Role-based routes → Sign in and register: routes to (evidence: `src/App.jsx`)
- Role-based routes → Worker dashboard: routes to (evidence: `src/App.jsx`)
- Role-based routes → Earnings logging: routes to (evidence: `src/App.jsx`)
- Role-based routes → Earnings verification: routes to (evidence: `src/App.jsx`)
- Role-based routes → Grievance board: routes to (evidence: `src/App.jsx`)
- Role-based routes → Advocate analytics: routes to (evidence: `src/App.jsx`)
- Role-based routes → Income certificates: routes to (evidence: `src/App.jsx`)
- Role-based routes → Authentication state: checks roles (evidence: `src/App.jsx`)
- Sign in and register → REST API clients: uses API (evidence: `src/pages/Login.jsx`)
- Sign in and register → Authentication state: updates session (evidence: `src/pages/Login.jsx`)
- Earnings logging → REST API clients: submits earnings (evidence: `src/pages/EarningsLogger.jsx`)
- Earnings logging → Anomaly and fairness rules: checks anomalies (evidence: `src/pages/EarningsLogger.jsx`)
- Worker dashboard → REST API clients: loads metrics (evidence: `src/pages/Dashboard.jsx`)
- Worker dashboard → Analytics charts: renders trends (evidence: `src/pages/Dashboard.jsx`)
- Worker dashboard → Shared UI components: renders cards (evidence: `src/pages/Dashboard.jsx`)
- Grievance board → REST API clients: loads and files (evidence: `src/pages/GrievanceBoard.jsx`)
- Earnings verification → REST API clients: updates review (evidence: `src/pages/VerificationPanel.jsx`)
- Earnings verification → Anomaly and fairness rules: checks deductions (evidence: `src/pages/VerificationPanel.jsx`)
- Advocate analytics → Anomaly and fairness rules: scores platforms (evidence: `src/pages/AdvocateDashboard.jsx`)
- Advocate analytics → Demo records: reads examples (evidence: `src/pages/AdvocateDashboard.jsx`)
- Income certificates → REST API clients: uses API (evidence: `src/pages/CertificatePage.jsx`)
- Earnings logging → Demo mode state: supports demo (evidence: `src/pages/EarningsLogger.jsx`)
- Earnings logging → Demo records: reads examples (evidence: `src/pages/EarningsLogger.jsx`)
- Grievance board → Demo records: reads examples (evidence: `src/pages/GrievanceBoard.jsx`)
- Earnings verification → Demo records: reads examples (evidence: `src/pages/VerificationPanel.jsx`)
- REST API clients → Application API server: calls endpoints
- Application API server → MongoDB persistence: persists records (evidence: `README.md`)
- Application API server → Verification media storage: stores proof files (evidence: `README.md`)
