# hardik-sharma-1005/punarchakra architecture

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

- Interactive diagram: https://gitdiagram.com/hardik-sharma-1005/punarchakra
- Repository: https://github.com/hardik-sharma-1005/punarchakra

## Overview

PunarChakra is a role-based C&D waste recovery marketplace. Its main workflow runs from generator listings through collector pickup and processor takeover to completion, with admin approval gating account access. The dashboard coordinates role-specific views; auth helpers and Supabase server access provide an internal access/data layer. The graph also preserves the landing-page capabilities and future aggregation concept. Some dashboard and processor implementations were not sampled, so their links rely on README statements or indexed references rather than inspected implementation details.

Main entry points: [`lib/supabase/server.ts`](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/supabase/server.ts) (Supabase server client), [`app/dashboard/page.tsx`](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/page.tsx) (Role dashboard), [`app/dashboard/processor-discovery.tsx`](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/processor-discovery.tsx) (Processor discovery and tracking), [`lib/auth/get-approved-profile.ts`](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/get-approved-profile.ts) (Approved-role check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product experience"]
  node_landing["Marketplace landing<br/>[page.tsx]"]
  node_landing_sections["Recovery overview<br/>[how-it-works.tsx]"]
  node_matching_story["Matching explainer<br/>[economics.tsx]"]
  node_aggregation_story["Load aggregation concept<br/>[aggregation.tsx]"]
  node_status_story["Status updates<br/>[verification.tsx]"]
end

subgraph group_access["Identity and approval"]
  node_auth_modal["Sign-in entry<br/>[auth-modal.tsx]"]
  node_login["Login<br/>[page.tsx]"]
  node_registration["Role registration<br/>[page.tsx]"]
  node_auth_actions["Auth actions<br/>[actions.ts]"]
  node_profile["Current profile"]
  node_approved_profile["Approved-role check"]
  node_approval["Admin approval"]
end

subgraph group_recovery["Recovery workflow"]
  node_dashboard["Role dashboard<br/>[page.tsx]"]
  node_generator_listing["Create listing"]
  node_listing_actions["Listing operations<br/>[actions.ts]"]
  node_collector["Collector discovery and tracking"]
  node_collector_data["Collector recovery services<br/>[discovery.ts]"]
  node_collector_active["Collector active recoveries"]
  node_processor["Processor discovery and tracking"]
  node_processor_actions["Processor operations<br/>[actions.ts]"]
  node_processor_active["Processor active recoveries"]
  node_transactions["Recovery transactions"]
end

subgraph group_platform["Data services"]
  node_supabase_client["Supabase server client<br/>[server.ts]"]
  node_database[("Supabase auth and database")]
end

node_visitor(("Platform user"))

node_visitor -->|"browses"| node_landing
node_landing -->|"renders"| node_landing_sections
node_landing -->|"renders"| node_matching_story
node_landing -->|"renders"| node_aggregation_story
node_landing -->|"renders"| node_status_story
node_visitor -.->|"starts access"| node_auth_modal
node_auth_modal -.->|"opens login"| node_login
node_auth_modal -.->|"opens registration"| node_registration
node_login -->|"submits credentials"| node_auth_actions
node_registration -->|"submits registration"| node_auth_actions
node_auth_actions -->|"uses client"| node_supabase_client
node_auth_actions -->|"checks profile"| node_profile
node_profile -->|"reads account"| node_supabase_client
node_profile -->|"reads profile"| node_database
node_approved_profile -->|"checks approval"| node_profile
node_auth_actions -->|"updates approval"| node_approval
node_visitor -->|"uses workspace"| node_dashboard
node_dashboard -->|"renders"| node_generator_listing
node_generator_listing -->|"submits listing"| node_listing_actions
node_listing_actions -->|"checks role"| node_approved_profile
node_listing_actions -->|"uses client"| node_supabase_client
node_dashboard -->|"renders"| node_collector
node_dashboard -->|"loads opportunities"| node_collector_data
node_dashboard -->|"loads active work"| node_collector_active
node_collector_data -->|"checks role"| node_approved_profile
node_collector_data -->|"queries listings"| node_supabase_client
node_collector_active -->|"checks role"| node_approved_profile
node_collector_active -->|"reads recoveries"| node_supabase_client
node_collector -.->|"accepts recovery"| node_transactions
node_dashboard -->|"renders"| node_processor
node_processor -->|"uses operations"| node_processor_actions
node_processor -.->|"tracks recovery"| node_processor_active
node_processor_actions -->|"checks role"| node_approved_profile
node_processor_actions -->|"uses client"| node_supabase_client
node_processor_active -->|"checks role"| node_approved_profile
node_processor_active -->|"reads recoveries"| node_supabase_client
node_collector -->|"hands off material"| node_processor
node_processor -.->|"advances status"| node_transactions
node_transactions -->|"updates lifecycle"| node_database
node_supabase_client -->|"connects"| node_database
node_generator_listing -->|"lists then matches"| node_collector
node_processor -->|"reports completion"| node_dashboard

click node_landing "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/page.tsx"
click node_landing_sections "https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/how-it-works.tsx"
click node_matching_story "https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/economics.tsx"
click node_aggregation_story "https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/aggregation.tsx"
click node_status_story "https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/verification.tsx"
click node_auth_modal "https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/site/auth-modal.tsx"
click node_login "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/login/page.tsx"
click node_registration "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/register/page.tsx"
click node_auth_actions "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/actions.ts"
click node_profile "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/get-current-profile.ts"
click node_approved_profile "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/get-approved-profile.ts"
click node_approval "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/admin-approval-panel.tsx"
click node_dashboard "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/page.tsx"
click node_generator_listing "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/generator-waste-listing-form.tsx"
click node_listing_actions "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/listings/actions.ts"
click node_collector "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/collector-discovery.tsx"
click node_collector_data "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/discovery.ts"
click node_collector_active "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/active-recoveries.ts"
click node_processor "https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/processor-discovery.tsx"
click node_processor_actions "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/processor/actions.ts"
click node_processor_active "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/processor/active-recoveries.ts"
click node_transactions "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/transaction-actions.ts"
click node_supabase_client "https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/supabase/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_landing,node_landing_sections,node_matching_story,node_aggregation_story,node_status_story,node_visitor toneBlue
class node_auth_modal,node_login,node_registration,node_auth_actions,node_profile,node_approved_profile,node_approval toneAmber
class node_dashboard,node_generator_listing,node_listing_actions,node_collector,node_collector_data,node_collector_active,node_processor,node_processor_actions,node_processor_active,node_transactions toneMint
class node_supabase_client,node_database toneRose
```

## Components

### Product experience

- [Marketplace landing](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/page.tsx): `app/page.tsx`
- [Recovery overview](https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/how-it-works.tsx): `components/sections/how-it-works.tsx`
- [Matching explainer](https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/economics.tsx): `components/sections/economics.tsx`
- [Load aggregation concept](https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/aggregation.tsx): `components/sections/aggregation.tsx`
- [Status updates](https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/sections/verification.tsx): `components/sections/verification.tsx`

### Identity and approval

- [Sign-in entry](https://github.com/hardik-sharma-1005/punarchakra/blob/main/components/site/auth-modal.tsx): `components/site/auth-modal.tsx`
- [Login](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Role registration](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/register/page.tsx): `app/register/page.tsx`
- [Auth actions](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/actions.ts): `lib/auth/actions.ts`
- [Current profile](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/get-current-profile.ts): `lib/auth/get-current-profile.ts`
- [Approved-role check](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/auth/get-approved-profile.ts): `lib/auth/get-approved-profile.ts`
- [Admin approval](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/admin-approval-panel.tsx): `app/dashboard/admin-approval-panel.tsx`

### Recovery workflow

- [Role dashboard](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Create listing](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/generator-waste-listing-form.tsx): `app/dashboard/generator-waste-listing-form.tsx`
- [Listing operations](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/listings/actions.ts): `lib/listings/actions.ts`
- [Collector discovery and tracking](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/collector-discovery.tsx): `app/dashboard/collector-discovery.tsx`
- [Collector recovery services](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/discovery.ts): `lib/collector/discovery.ts`
- [Collector active recoveries](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/active-recoveries.ts): `lib/collector/active-recoveries.ts`
- [Processor discovery and tracking](https://github.com/hardik-sharma-1005/punarchakra/blob/main/app/dashboard/processor-discovery.tsx): `app/dashboard/processor-discovery.tsx`
- [Processor operations](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/processor/actions.ts): `lib/processor/actions.ts`
- [Processor active recoveries](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/processor/active-recoveries.ts): `lib/processor/active-recoveries.ts`
- [Recovery transactions](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/collector/transaction-actions.ts): `lib/collector/transaction-actions.ts`

### Data services

- [Supabase server client](https://github.com/hardik-sharma-1005/punarchakra/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- **Supabase auth and database**

### Other components

- **Platform user**

## Connections

- Platform user → Marketplace landing: browses (evidence: `app/page.tsx`)
- Marketplace landing → Recovery overview: renders (evidence: `app/page.tsx`)
- Marketplace landing → Matching explainer: renders (evidence: `app/page.tsx`)
- Marketplace landing → Load aggregation concept: renders (evidence: `app/page.tsx`)
- Marketplace landing → Status updates: renders (evidence: `app/page.tsx`)
- Platform user → Sign-in entry: starts access
- Sign-in entry → Login: opens login
- Sign-in entry → Role registration: opens registration
- Login → Auth actions: submits credentials (evidence: `app/login/page.tsx`)
- Role registration → Auth actions: submits registration (evidence: `app/register/page.tsx`)
- Auth actions → Supabase server client: uses client (evidence: `lib/auth/actions.ts`)
- Auth actions → Current profile: checks profile (evidence: `lib/auth/actions.ts`)
- Current profile → Supabase server client: reads account (evidence: `lib/auth/get-current-profile.ts`)
- Current profile → Supabase auth and database: reads profile (evidence: `lib/auth/get-current-profile.ts`)
- Approved-role check → Current profile: checks approval (evidence: `lib/auth/get-approved-profile.ts`)
- Auth actions → Admin approval: updates approval (evidence: `lib/auth/actions.ts`)
- Platform user → Role dashboard: uses workspace (evidence: `README.md`)
- Role dashboard → Create listing: renders (evidence: `app/dashboard/page.tsx`)
- Create listing → Listing operations: submits listing (evidence: `app/dashboard/generator-waste-listing-form.tsx`)
- Listing operations → Approved-role check: checks role (evidence: `lib/listings/actions.ts`)
- Listing operations → Supabase server client: uses client (evidence: `lib/listings/actions.ts`)
- Role dashboard → Collector discovery and tracking: renders (evidence: `app/dashboard/page.tsx`)
- Role dashboard → Collector recovery services: loads opportunities (evidence: `app/dashboard/page.tsx`)
- Role dashboard → Collector active recoveries: loads active work (evidence: `app/dashboard/page.tsx`)
- Collector recovery services → Approved-role check: checks role (evidence: `lib/collector/discovery.ts`)
- Collector recovery services → Supabase server client: queries listings (evidence: `lib/collector/discovery.ts`)
- Collector active recoveries → Approved-role check: checks role (evidence: `lib/collector/active-recoveries.ts`)
- Collector active recoveries → Supabase server client: reads recoveries (evidence: `lib/collector/active-recoveries.ts`)
- Collector discovery and tracking → Recovery transactions: accepts recovery (evidence: `app/dashboard/collector-discovery.tsx`)
- Role dashboard → Processor discovery and tracking: renders (evidence: `app/dashboard/page.tsx`)
- Processor discovery and tracking → Processor operations: uses operations
- Processor discovery and tracking → Processor active recoveries: tracks recovery
- Processor operations → Approved-role check: checks role (evidence: `lib/processor/actions.ts`)
- Processor operations → Supabase server client: uses client (evidence: `lib/processor/actions.ts`)
- Processor active recoveries → Approved-role check: checks role (evidence: `lib/processor/active-recoveries.ts`)
- Processor active recoveries → Supabase server client: reads recoveries (evidence: `lib/processor/active-recoveries.ts`)
- Collector discovery and tracking → Processor discovery and tracking: hands off material (evidence: `README.md`)
- Processor discovery and tracking → Recovery transactions: advances status
- Recovery transactions → Supabase auth and database: updates lifecycle (evidence: `README.md`)
- Supabase server client → Supabase auth and database: connects (evidence: `README.md`)
- Create listing → Collector discovery and tracking: lists then matches (evidence: `README.md`)
- Processor discovery and tracking → Role dashboard: reports completion (evidence: `README.md`)
