# harishb0401/ecolink architecture

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

- Interactive diagram: https://gitdiagram.com/harishb0401/ecolink
- Repository: https://github.com/harishb0401/ecolink

## Overview

Eco-Link is a circular e-waste marketplace and regulatory-compliance platform. Collectors register waste lots; recyclers browse matched lots and submit bids; collectors accept offers, creating escrow-style transactions and traceability records. Administrators oversee recycler verification and platform activity. The README documents the main API and database capabilities; sampled source confirms key routing, lot-matching, authentication, and offline-sync links. Some controller and page internals were not sampled, so those relationships rely on README descriptions or are omitted.

Main entry points: [`src/routes/AppRoutes.jsx`](https://github.com/harishb0401/ecolink/blob/main/src/routes/AppRoutes.jsx) (Role-based pages), [`src/App.jsx`](https://github.com/harishb0401/ecolink/blob/main/src/App.jsx) (Client application), [`server/controllers/wasteController.js`](https://github.com/harishb0401/ecolink/blob/main/server/controllers/wasteController.js) (Lot management), [`src/services/offline/syncManager.js`](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/syncManager.js) (Queued synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace client"]
  node_app["Client application<br/>[App.jsx]"]
  node_routes["Role-based pages<br/>[AppRoutes.jsx]"]
  node_lotform["Waste registration<br/>[RegisterWaste.jsx]"]
  node_guide["Recycle guide<br/>[RecycleGuide.jsx]"]
  node_localization["English and Tamil<br/>[index.jsx]"]
end

subgraph group_offline["Offline capability"]
  node_offline_state["Network status<br/>[networkStatus.js]"]
  node_offline_content["Offline reference content"]
  node_offline_db[("Local database<br/>[offlineDatabase.js]")]
  node_offline_session["Offline collector session<br/>[offlineSession.js]"]
  node_sync["Queued synchronization<br/>[syncManager.js]"]
end

subgraph group_api["API and domain services"]
  node_api_client["REST client<br/>[api.js]"]
  node_waste_client["Waste client service<br/>[wasteService.js]"]
  node_auth_client["Authentication client<br/>[authService.js]"]
  node_server["Express API<br/>[app.js]"]
  node_waste_routes["Waste routes<br/>[wasteRoutes.js]"]
  node_waste_controller["Lot management<br/>[wasteController.js]"]
  node_matching["Recycler matching<br/>[matchingService.js]"]
  node_pricing["Pricing rules<br/>[pricingService.js]"]
  node_offers["Offers and acceptance<br/>[offerController.js]"]
  node_transactions["Escrow transactions"]
  node_auth["JWT authentication<br/>[authMiddleware.js]"]
end

subgraph group_compliance["Compliance and oversight"]
  node_admin["Administration<br/>[adminController.js]"]
  node_verification["Recycler verification"]
end

subgraph group_persistence["Persistence"]
  node_database[("Supabase PostgreSQL")]
end

node_collector(("Collector"))
node_recycler(("Recycler"))
node_authority(("Environmental authority"))

node_collector -->|"uses"| node_routes
node_recycler -->|"uses"| node_routes
node_authority -.->|"uses"| node_routes
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_lotform
node_routes -->|"routes to"| node_guide
node_lotform -->|"checks pricing"| node_pricing
node_app -->|"provides language"| node_localization
node_localization -->|"localizes"| node_guide
node_app -->|"loads lot data"| node_waste_client
node_waste_client -->|"calls"| node_api_client
node_auth_client -->|"calls"| node_api_client
node_auth_client -->|"checks connectivity"| node_offline_state
node_auth_client -->|"reads and saves"| node_offline_session
node_offline_session -->|"stores session"| node_offline_db
node_offline_content -->|"stores content"| node_offline_db
node_offline_content -->|"uses price reference"| node_database
node_sync -->|"reads queue"| node_offline_db
node_sync -->|"checks network"| node_offline_state
node_sync -->|"syncs lots"| node_api_client
node_app -->|"refreshes after sync"| node_sync
node_api_client -->|"sends REST requests"| node_server
node_server -->|"mounts routes"| node_waste_routes
node_waste_routes -->|"authenticates"| node_auth
node_waste_routes -->|"dispatches"| node_waste_controller
node_waste_controller -->|"matches lots"| node_matching
node_waste_controller -->|"reads and writes lots"| node_database
node_waste_controller -->|"classifies and prices"| node_pricing
node_recycler -.->|"receives eligible lots"| node_matching
node_recycler -.->|"submits bids"| node_offers
node_collector -.->|"accepts bid"| node_offers
node_offers -->|"creates transaction"| node_transactions
node_transactions -->|"records escrow"| node_database
node_authority -.->|"oversees platform"| node_admin
node_admin -->|"processes approvals"| node_verification
node_verification -.->|"records audit"| node_database

click node_app "https://github.com/harishb0401/ecolink/blob/main/src/App.jsx"
click node_routes "https://github.com/harishb0401/ecolink/blob/main/src/routes/AppRoutes.jsx"
click node_lotform "https://github.com/harishb0401/ecolink/blob/main/src/pages/collector/RegisterWaste.jsx"
click node_guide "https://github.com/harishb0401/ecolink/blob/main/src/pages/public/RecycleGuide.jsx"
click node_localization "https://github.com/harishb0401/ecolink/blob/main/src/i18n/index.jsx"
click node_api_client "https://github.com/harishb0401/ecolink/blob/main/src/services/api.js"
click node_waste_client "https://github.com/harishb0401/ecolink/blob/main/src/services/wasteService.js"
click node_auth_client "https://github.com/harishb0401/ecolink/blob/main/src/services/authService.js"
click node_offline_state "https://github.com/harishb0401/ecolink/blob/main/src/services/offline/networkStatus.js"
click node_offline_content "https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineContentService.js"
click node_offline_db "https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineDatabase.js"
click node_offline_session "https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineSession.js"
click node_sync "https://github.com/harishb0401/ecolink/blob/main/src/services/offline/syncManager.js"
click node_server "https://github.com/harishb0401/ecolink/blob/main/server/app.js"
click node_waste_routes "https://github.com/harishb0401/ecolink/blob/main/server/routes/wasteRoutes.js"
click node_waste_controller "https://github.com/harishb0401/ecolink/blob/main/server/controllers/wasteController.js"
click node_matching "https://github.com/harishb0401/ecolink/blob/main/server/services/matchingService.js"
click node_pricing "https://github.com/harishb0401/ecolink/blob/main/server/services/pricingService.js"
click node_offers "https://github.com/harishb0401/ecolink/blob/main/server/controllers/offerController.js"
click node_transactions "https://github.com/harishb0401/ecolink/blob/main/server/services/transactionService.js"
click node_auth "https://github.com/harishb0401/ecolink/blob/main/server/middleware/authMiddleware.js"
click node_admin "https://github.com/harishb0401/ecolink/blob/main/server/controllers/adminController.js"
click node_verification "https://github.com/harishb0401/ecolink/blob/main/server/services/verificationService.js"

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_routes,node_lotform,node_guide,node_localization toneBlue
class node_offline_state,node_offline_content,node_offline_db,node_offline_session,node_sync toneAmber
class node_api_client,node_waste_client,node_auth_client,node_server,node_waste_routes,node_waste_controller,node_matching,node_pricing,node_offers,node_transactions,node_auth toneMint
class node_admin,node_verification toneRose
class node_database,node_collector,node_recycler,node_authority toneIndigo
```

## Components

### Marketplace client

- [Client application](https://github.com/harishb0401/ecolink/blob/main/src/App.jsx): `src/App.jsx`
- [Role-based pages](https://github.com/harishb0401/ecolink/blob/main/src/routes/AppRoutes.jsx): `src/routes/AppRoutes.jsx`
- [Waste registration](https://github.com/harishb0401/ecolink/blob/main/src/pages/collector/RegisterWaste.jsx): `src/pages/collector/RegisterWaste.jsx`
- [Recycle guide](https://github.com/harishb0401/ecolink/blob/main/src/pages/public/RecycleGuide.jsx): `src/pages/public/RecycleGuide.jsx`
- [English and Tamil](https://github.com/harishb0401/ecolink/blob/main/src/i18n/index.jsx): `src/i18n/index.jsx`

### Offline capability

- [Network status](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/networkStatus.js): `src/services/offline/networkStatus.js`
- [Offline reference content](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineContentService.js): `src/services/offline/offlineContentService.js`
- [Local database](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineDatabase.js): `src/services/offline/offlineDatabase.js`
- [Offline collector session](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/offlineSession.js): `src/services/offline/offlineSession.js`
- [Queued synchronization](https://github.com/harishb0401/ecolink/blob/main/src/services/offline/syncManager.js): `src/services/offline/syncManager.js`

### API and domain services

- [REST client](https://github.com/harishb0401/ecolink/blob/main/src/services/api.js): `src/services/api.js`
- [Waste client service](https://github.com/harishb0401/ecolink/blob/main/src/services/wasteService.js): `src/services/wasteService.js`
- [Authentication client](https://github.com/harishb0401/ecolink/blob/main/src/services/authService.js): `src/services/authService.js`
- [Express API](https://github.com/harishb0401/ecolink/blob/main/server/app.js): `server/app.js`
- [Waste routes](https://github.com/harishb0401/ecolink/blob/main/server/routes/wasteRoutes.js): `server/routes/wasteRoutes.js`
- [Lot management](https://github.com/harishb0401/ecolink/blob/main/server/controllers/wasteController.js): `server/controllers/wasteController.js`
- [Recycler matching](https://github.com/harishb0401/ecolink/blob/main/server/services/matchingService.js): `server/services/matchingService.js`
- [Pricing rules](https://github.com/harishb0401/ecolink/blob/main/server/services/pricingService.js): `server/services/pricingService.js`
- [Offers and acceptance](https://github.com/harishb0401/ecolink/blob/main/server/controllers/offerController.js): `server/controllers/offerController.js`
- [Escrow transactions](https://github.com/harishb0401/ecolink/blob/main/server/services/transactionService.js): `server/services/transactionService.js`
- [JWT authentication](https://github.com/harishb0401/ecolink/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Compliance and oversight

- [Administration](https://github.com/harishb0401/ecolink/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [Recycler verification](https://github.com/harishb0401/ecolink/blob/main/server/services/verificationService.js): `server/services/verificationService.js`

### Persistence

- **Supabase PostgreSQL**

### Other components

- **Collector**
- **Recycler**
- **Environmental authority**

## Connections

- Collector → Role-based pages: uses (evidence: `src/routes/AppRoutes.jsx`)
- Recycler → Role-based pages: uses (evidence: `src/routes/AppRoutes.jsx`)
- Environmental authority → Role-based pages: uses (evidence: `README.md`)
- Client application → Role-based pages: renders (evidence: `src/App.jsx`)
- Role-based pages → Waste registration: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Role-based pages → Recycle guide: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Waste registration → Pricing rules: checks pricing (evidence: `src/pages/collector/RegisterWaste.jsx`)
- Client application → English and Tamil: provides language (evidence: `src/App.jsx`)
- English and Tamil → Recycle guide: localizes (evidence: `src/pages/public/RecycleGuide.jsx`)
- Client application → Waste client service: loads lot data (evidence: `src/App.jsx`)
- Waste client service → REST client: calls (evidence: `src/services/wasteService.js`)
- Authentication client → REST client: calls (evidence: `src/services/authService.js`)
- Authentication client → Network status: checks connectivity (evidence: `src/services/authService.js`)
- Authentication client → Offline collector session: reads and saves (evidence: `src/services/authService.js`)
- Offline collector session → Local database: stores session (evidence: `src/services/offline/offlineSession.js`)
- Offline reference content → Local database: stores content (evidence: `src/services/offline/offlineContentService.js`)
- Offline reference content → Supabase PostgreSQL: uses price reference (evidence: `src/services/offline/offlineContentService.js`)
- Queued synchronization → Local database: reads queue (evidence: `src/services/offline/syncManager.js`)
- Queued synchronization → Network status: checks network (evidence: `src/services/offline/syncManager.js`)
- Queued synchronization → REST client: syncs lots (evidence: `src/services/offline/syncManager.js`)
- Client application → Queued synchronization: refreshes after sync (evidence: `src/App.jsx`)
- REST client → Express API: sends REST requests (evidence: `README.md`)
- Express API → Waste routes: mounts routes (evidence: `server/app.js`)
- Waste routes → JWT authentication: authenticates (evidence: `server/routes/wasteRoutes.js`)
- Waste routes → Lot management: dispatches (evidence: `server/routes/wasteRoutes.js`)
- Lot management → Recycler matching: matches lots (evidence: `server/controllers/wasteController.js`)
- Lot management → Supabase PostgreSQL: reads and writes lots (evidence: `server/controllers/wasteController.js`)
- Lot management → Pricing rules: classifies and prices (evidence: `server/controllers/wasteController.js`)
- Recycler → Recycler matching: receives eligible lots (evidence: `README.md`)
- Recycler → Offers and acceptance: submits bids (evidence: `README.md`)
- Collector → Offers and acceptance: accepts bid (evidence: `README.md`)
- Offers and acceptance → Escrow transactions: creates transaction (evidence: `server/controllers/offerController.js`)
- Escrow transactions → Supabase PostgreSQL: records escrow (evidence: `README.md`)
- Environmental authority → Administration: oversees platform (evidence: `README.md`)
- Administration → Recycler verification: processes approvals (evidence: `server/controllers/adminController.js`)
- Recycler verification → Supabase PostgreSQL: records audit (evidence: `README.md`)
