# karun99/plastic-waste-conservation architecture

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

- Interactive diagram: https://gitdiagram.com/karun99/plastic-waste-conservation
- Repository: https://github.com/karun99/plastic-waste-conservation

## Overview

This is an education-first web platform for plastic-waste literacy and conservation. Visitors learn about plastics, explore real-world case studies, estimate diversion impacts, and use a rule-based matcher and stakeholder dashboard. The optional tutor sends questions through a chat endpoint to OpenRouter, with case-study context. The graph follows README capabilities and the supplied source index; unsampled pages are represented at their documented paths, and no unverified implementation details are inferred.

Main entry points: [`data/caseStudies.js`](https://github.com/karun99/plastic-waste-conservation/blob/main/data/caseStudies.js) (Case study content), [`app/layout.js`](https://github.com/karun99/plastic-waste-conservation/blob/main/app/layout.js) (Application shell), [`app/page.js`](https://github.com/karun99/plastic-waste-conservation/blob/main/app/page.js) (Home overview), [`components/CaseStudyExplorer.js`](https://github.com/karun99/plastic-waste-conservation/blob/main/components/CaseStudyExplorer.js) (Case study explorer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Site experience"]
  node_shell["Application shell<br/>[layout.js]"]
  node_navigation["Navigation<br/>[Navbar.js]"]
  node_footer["Footer<br/>[Footer.js]"]
  node_home["Home overview<br/>[page.js]"]
end

subgraph group_learning["Learning content"]
  node_literacy["Plastic literacy<br/>[page.js]"]
  node_polymerdata["Polymer reference<br/>[plastics.js]"]
  node_caseindex["Case study index<br/>[page.js]"]
  node_explorer["Case study explorer"]
  node_casecard["Case study card<br/>[CaseStudyCard.js]"]
  node_casedetail["Case study detail<br/>[page.js]"]
  node_casedata["Case study content<br/>[caseStudies.js]"]
end

subgraph group_planning["Impact and solutions"]
  node_calculator["Impact calculator<br/>[page.js]"]
  node_matcher["Solution matcher<br/>[page.js]"]
  node_solutiondata["Solutions and stakeholder data<br/>[solutions.js]"]
  node_dashboard["Stakeholder dashboard<br/>[page.js]"]
end

subgraph group_tutor["AI tutor"]
  node_chatui["Plastic Pal chat<br/>[Chatbot.js]"]
  node_chatroute["Chat endpoint<br/>[route.js]"]
  node_openrouter["OpenRouter client and cache<br/>[openrouter.js]"]
end

node_visitor(("Site visitor"))
node_llm{{"OpenRouter service"}}

node_visitor -->|"opens site"| node_shell
node_shell -->|"renders"| node_navigation
node_shell -->|"renders"| node_footer
node_shell -->|"renders"| node_chatui
node_visitor -->|"views"| node_home
node_home -->|"reads"| node_casedata
node_home -->|"reads"| node_polymerdata
node_home -->|"renders"| node_casecard
node_visitor -->|"learns"| node_literacy
node_literacy -->|"reads"| node_polymerdata
node_visitor -->|"explores"| node_caseindex
node_caseindex -->|"renders"| node_explorer
node_explorer -->|"filters"| node_casedata
node_explorer -->|"renders"| node_casecard
node_casecard -->|"links to"| node_casedetail
node_visitor -->|"reads"| node_casedetail
node_casedetail -->|"looks up"| node_casedata
node_visitor -->|"estimates impact"| node_calculator
node_calculator -->|"reads factors"| node_polymerdata
node_visitor -->|"finds solutions"| node_matcher
node_matcher -->|"matches against"| node_solutiondata
node_visitor -->|"views needs"| node_dashboard
node_dashboard -->|"reads"| node_solutiondata
node_dashboard -->|"reads"| node_casedata
node_visitor -->|"asks question"| node_chatui
node_chatui -->|"posts question"| node_chatroute
node_chatroute -->|"builds context"| node_casedata
node_chatroute -->|"requests answer"| node_openrouter
node_openrouter -->|"calls completions API"| node_llm

click node_shell "https://github.com/karun99/plastic-waste-conservation/blob/main/app/layout.js"
click node_navigation "https://github.com/karun99/plastic-waste-conservation/blob/main/components/Navbar.js"
click node_footer "https://github.com/karun99/plastic-waste-conservation/blob/main/components/Footer.js"
click node_home "https://github.com/karun99/plastic-waste-conservation/blob/main/app/page.js"
click node_literacy "https://github.com/karun99/plastic-waste-conservation/blob/main/app/plastics/page.js"
click node_polymerdata "https://github.com/karun99/plastic-waste-conservation/blob/main/data/plastics.js"
click node_caseindex "https://github.com/karun99/plastic-waste-conservation/blob/main/app/case-studies/page.js"
click node_explorer "https://github.com/karun99/plastic-waste-conservation/blob/main/components/CaseStudyExplorer.js"
click node_casecard "https://github.com/karun99/plastic-waste-conservation/blob/main/components/CaseStudyCard.js"
click node_casedetail "https://github.com/karun99/plastic-waste-conservation/blob/main/app/case-studies/%5Bslug%5D/page.js"
click node_casedata "https://github.com/karun99/plastic-waste-conservation/blob/main/data/caseStudies.js"
click node_calculator "https://github.com/karun99/plastic-waste-conservation/blob/main/app/calculator/page.js"
click node_matcher "https://github.com/karun99/plastic-waste-conservation/blob/main/app/solutions/page.js"
click node_solutiondata "https://github.com/karun99/plastic-waste-conservation/blob/main/data/solutions.js"
click node_dashboard "https://github.com/karun99/plastic-waste-conservation/blob/main/app/dashboard/page.js"
click node_chatui "https://github.com/karun99/plastic-waste-conservation/blob/main/components/Chatbot.js"
click node_chatroute "https://github.com/karun99/plastic-waste-conservation/blob/main/app/api/chat/route.js"
click node_openrouter "https://github.com/karun99/plastic-waste-conservation/blob/main/lib/openrouter.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_shell,node_navigation,node_footer,node_home toneBlue
class node_literacy,node_polymerdata,node_caseindex,node_explorer,node_casecard,node_casedetail,node_casedata toneAmber
class node_calculator,node_matcher,node_solutiondata,node_dashboard,node_llm toneMint
class node_chatui,node_chatroute,node_openrouter toneRose
class node_visitor toneIndigo
```

## Components

### Site experience

- [Application shell](https://github.com/karun99/plastic-waste-conservation/blob/main/app/layout.js): `app/layout.js`
- [Navigation](https://github.com/karun99/plastic-waste-conservation/blob/main/components/Navbar.js): `components/Navbar.js`
- [Footer](https://github.com/karun99/plastic-waste-conservation/blob/main/components/Footer.js): `components/Footer.js`
- [Home overview](https://github.com/karun99/plastic-waste-conservation/blob/main/app/page.js): `app/page.js`

### Learning content

- [Plastic literacy](https://github.com/karun99/plastic-waste-conservation/blob/main/app/plastics/page.js): `app/plastics/page.js`
- [Polymer reference](https://github.com/karun99/plastic-waste-conservation/blob/main/data/plastics.js): `data/plastics.js`
- [Case study index](https://github.com/karun99/plastic-waste-conservation/blob/main/app/case-studies/page.js): `app/case-studies/page.js`
- [Case study explorer](https://github.com/karun99/plastic-waste-conservation/blob/main/components/CaseStudyExplorer.js): `components/CaseStudyExplorer.js`
- [Case study card](https://github.com/karun99/plastic-waste-conservation/blob/main/components/CaseStudyCard.js): `components/CaseStudyCard.js`
- [Case study detail](https://github.com/karun99/plastic-waste-conservation/blob/main/app/case-studies/%5Bslug%5D/page.js): `app/case-studies/[slug]/page.js`
- [Case study content](https://github.com/karun99/plastic-waste-conservation/blob/main/data/caseStudies.js): `data/caseStudies.js`

### Impact and solutions

- [Impact calculator](https://github.com/karun99/plastic-waste-conservation/blob/main/app/calculator/page.js): `app/calculator/page.js`
- [Solution matcher](https://github.com/karun99/plastic-waste-conservation/blob/main/app/solutions/page.js): `app/solutions/page.js`
- [Solutions and stakeholder data](https://github.com/karun99/plastic-waste-conservation/blob/main/data/solutions.js): `data/solutions.js`
- [Stakeholder dashboard](https://github.com/karun99/plastic-waste-conservation/blob/main/app/dashboard/page.js): `app/dashboard/page.js`

### AI tutor

- [Plastic Pal chat](https://github.com/karun99/plastic-waste-conservation/blob/main/components/Chatbot.js): `components/Chatbot.js`
- [Chat endpoint](https://github.com/karun99/plastic-waste-conservation/blob/main/app/api/chat/route.js): `app/api/chat/route.js`
- [OpenRouter client and cache](https://github.com/karun99/plastic-waste-conservation/blob/main/lib/openrouter.js): `lib/openrouter.js`

### Other components

- **Site visitor**
- **OpenRouter service**

## Connections

- Site visitor → Application shell: opens site (evidence: `README.md`)
- Application shell → Navigation: renders (evidence: `app/layout.js`)
- Application shell → Footer: renders (evidence: `app/layout.js`)
- Application shell → Plastic Pal chat: renders (evidence: `app/layout.js`)
- Site visitor → Home overview: views (evidence: `README.md`)
- Home overview → Case study content: reads (evidence: `app/page.js`)
- Home overview → Polymer reference: reads (evidence: `app/page.js`)
- Home overview → Case study card: renders (evidence: `app/page.js`)
- Site visitor → Plastic literacy: learns (evidence: `README.md`)
- Plastic literacy → Polymer reference: reads (evidence: `app/plastics/page.js`)
- Site visitor → Case study index: explores (evidence: `README.md`)
- Case study index → Case study explorer: renders (evidence: `app/case-studies/page.js`)
- Case study explorer → Case study content: filters (evidence: `components/CaseStudyExplorer.js`)
- Case study explorer → Case study card: renders (evidence: `components/CaseStudyExplorer.js`)
- Case study card → Case study detail: links to (evidence: `components/CaseStudyCard.js`)
- Site visitor → Case study detail: reads (evidence: `README.md`)
- Case study detail → Case study content: looks up (evidence: `app/case-studies/[slug]/page.js`)
- Site visitor → Impact calculator: estimates impact (evidence: `README.md`)
- Impact calculator → Polymer reference: reads factors (evidence: `app/calculator/page.js`)
- Site visitor → Solution matcher: finds solutions (evidence: `README.md`)
- Solution matcher → Solutions and stakeholder data: matches against (evidence: `app/solutions/page.js`)
- Site visitor → Stakeholder dashboard: views needs (evidence: `README.md`)
- Stakeholder dashboard → Solutions and stakeholder data: reads (evidence: `app/dashboard/page.js`)
- Stakeholder dashboard → Case study content: reads (evidence: `app/dashboard/page.js`)
- Site visitor → Plastic Pal chat: asks question (evidence: `README.md`)
- Plastic Pal chat → Chat endpoint: posts question (evidence: `components/Chatbot.js`)
- Chat endpoint → Case study content: builds context (evidence: `app/api/chat/route.js`)
- Chat endpoint → OpenRouter client and cache: requests answer (evidence: `app/api/chat/route.js`)
- OpenRouter client and cache → OpenRouter service: calls completions API (evidence: `lib/openrouter.js`)
