# amar-spe/e-waste architecture

> Architecture diagram of the GitHub repository amar-spe/e-waste, 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/amar-spe/e-waste
- Repository: https://github.com/amar-spe/e-waste

## Overview

E-Waste is a website for learning about recycling electronics and submitting a recycling cart. Its clearest transactional workflow is a visitor adding items and quantities in the browser, submitting them to the Express server, and having the server store an address and items in MySQL. The repository also includes login/signup handlers, informational pages, dashboard charts, and a location finder. Source excerpts show the server routes and client-side behavior, but not the EJS templates, so links between particular pages and scripts are not asserted.

Main entry points: [`index.js`](https://github.com/amar-spe/e-waste/blob/main/index.js) (Express routes), [`public/cart.js`](https://github.com/amar-spe/e-waste/blob/main/public/cart.js) (Cart form), [`public/service.js`](https://github.com/amar-spe/e-waste/blob/main/public/service.js) (Recycler locator), [`views`](https://github.com/amar-spe/e-waste/tree/main/views) (Page templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_server["Express routes<br/>[index.js]"]
  node_templates["Page templates"]
  node_dashboard_charts["Dashboard charts<br/>[main.js]"]
  node_home_chart["Home chart<br/>[home.js]"]
end

subgraph group_account["Accounts and data"]
  node_account_handlers["Login and signup<br/>[index.js]"]
  node_user_store[("User database<br/>[index.js]")]
  node_login_ui["Login interactions<br/>[login.js]"]
  node_logout_ui["Logout interactions<br/>[logout.js]"]
end

subgraph group_recycling["Recycling features"]
  node_cart_ui["Cart form<br/>[cart.js]"]
  node_cart_store[("Cart database<br/>[index.js]")]
  node_service_locator["Recycler locator<br/>[service.js]"]
  node_recycler_list["Recycler list<br/>[recyclers.js]"]
end

subgraph group_content["Informational content"]
  node_news["News list<br/>[news.js]"]
  node_contact["Contact form<br/>[contact.js]"]
  node_landing_interactions["Landing interactions<br/>[index1.js]"]
  node_about_interactions["About interactions<br/>[about.js]"]
  node_dashboard_about["Dashboard about<br/>[Dashabout.js]"]
end

node_visitor(("Visitor"))
node_maps["Google Maps"]

node_visitor -->|"requests pages"| node_server
node_server -->|"renders pages"| node_templates
node_visitor -->|"submits items"| node_cart_ui
node_cart_ui -->|"posts cart"| node_server
node_server -->|"writes address and items"| node_cart_store
node_visitor -.->|"submits credentials"| node_account_handlers
node_account_handlers -->|"queries and inserts users"| node_user_store
node_visitor -->|"requests location"| node_service_locator
node_service_locator -->|"opens search"| node_maps

click node_server "https://github.com/amar-spe/e-waste/blob/main/index.js"
click node_templates "https://github.com/amar-spe/e-waste/tree/main/views"
click node_cart_ui "https://github.com/amar-spe/e-waste/blob/main/public/cart.js"
click node_cart_store "https://github.com/amar-spe/e-waste/blob/main/index.js"
click node_account_handlers "https://github.com/amar-spe/e-waste/blob/main/index.js"
click node_user_store "https://github.com/amar-spe/e-waste/blob/main/index.js"
click node_service_locator "https://github.com/amar-spe/e-waste/blob/main/public/service.js"
click node_dashboard_charts "https://github.com/amar-spe/e-waste/blob/main/public/main.js"
click node_home_chart "https://github.com/amar-spe/e-waste/blob/main/public/home.js"
click node_news "https://github.com/amar-spe/e-waste/blob/main/public/news.js"
click node_recycler_list "https://github.com/amar-spe/e-waste/blob/main/public/recyclers.js"
click node_contact "https://github.com/amar-spe/e-waste/blob/main/public/contact.js"
click node_landing_interactions "https://github.com/amar-spe/e-waste/blob/main/public/index1.js"
click node_about_interactions "https://github.com/amar-spe/e-waste/blob/main/public/about.js"
click node_dashboard_about "https://github.com/amar-spe/e-waste/blob/main/public/Dashabout.js"
click node_login_ui "https://github.com/amar-spe/e-waste/blob/main/public/login.js"
click node_logout_ui "https://github.com/amar-spe/e-waste/blob/main/public/logout.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_server,node_templates,node_dashboard_charts,node_home_chart toneBlue
class node_account_handlers,node_user_store,node_login_ui,node_logout_ui toneAmber
class node_cart_ui,node_cart_store,node_service_locator,node_recycler_list toneMint
class node_news,node_contact,node_landing_interactions,node_about_interactions,node_dashboard_about toneRose
class node_visitor,node_maps toneIndigo
```

## Components

### Web application

- [Express routes](https://github.com/amar-spe/e-waste/blob/main/index.js): `index.js`
- [Page templates](https://github.com/amar-spe/e-waste/tree/main/views): `views`
- [Dashboard charts](https://github.com/amar-spe/e-waste/blob/main/public/main.js): `public/main.js`
- [Home chart](https://github.com/amar-spe/e-waste/blob/main/public/home.js): `public/home.js`

### Accounts and data

- [Login and signup](https://github.com/amar-spe/e-waste/blob/main/index.js): `index.js`
- [User database](https://github.com/amar-spe/e-waste/blob/main/index.js): `index.js`
- [Login interactions](https://github.com/amar-spe/e-waste/blob/main/public/login.js): `public/login.js`
- [Logout interactions](https://github.com/amar-spe/e-waste/blob/main/public/logout.js): `public/logout.js`

### Recycling features

- [Cart form](https://github.com/amar-spe/e-waste/blob/main/public/cart.js): `public/cart.js`
- [Cart database](https://github.com/amar-spe/e-waste/blob/main/index.js): `index.js`
- [Recycler locator](https://github.com/amar-spe/e-waste/blob/main/public/service.js): `public/service.js`
- [Recycler list](https://github.com/amar-spe/e-waste/blob/main/public/recyclers.js): `public/recyclers.js`

### Informational content

- [News list](https://github.com/amar-spe/e-waste/blob/main/public/news.js): `public/news.js`
- [Contact form](https://github.com/amar-spe/e-waste/blob/main/public/contact.js): `public/contact.js`
- [Landing interactions](https://github.com/amar-spe/e-waste/blob/main/public/index1.js): `public/index1.js`
- [About interactions](https://github.com/amar-spe/e-waste/blob/main/public/about.js): `public/about.js`
- [Dashboard about](https://github.com/amar-spe/e-waste/blob/main/public/Dashabout.js): `public/Dashabout.js`

### Other components

- **Visitor**
- **Google Maps**

## Connections

- Visitor → Express routes: requests pages (evidence: `index.js`)
- Express routes → Page templates: renders pages (evidence: `index.js`)
- Visitor → Cart form: submits items (evidence: `public/cart.js`)
- Cart form → Express routes: posts cart (evidence: `public/cart.js`)
- Express routes → Cart database: writes address and items (evidence: `index.js`)
- Visitor → Login and signup: submits credentials
- Login and signup → User database: queries and inserts users (evidence: `index.js`)
- Visitor → Recycler locator: requests location (evidence: `public/service.js`)
- Recycler locator → Google Maps: opens search (evidence: `public/service.js`)
