# horinezachary/shoppinglist architecture

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

- Interactive diagram: https://gitdiagram.com/horinezachary/shoppinglist
- Repository: https://github.com/horinezachary/shoppinglist

## Overview

Lori’s List is a full-stack shopping-list app with browser pages and a JSON API for mobile apps. People sign in, manage multiple named and colored lists, add or check off items, and share lists; the API also supports device tokens and live change notifications. The web server renders the site and uses MySQL, while the API is split between route adaptation and list/account rules. The README documents email-based sharing and reset links. Several implementation details are unsampled, so the graph omits uncertain connections rather than inferring them.

Main entry points: [`server.js`](https://github.com/horinezachary/shoppinglist/blob/master/server.js) (Web routes), [`lib/api.js`](https://github.com/horinezachary/shoppinglist/blob/master/lib/api.js) (API operations), [`lib/apiRouter.js`](https://github.com/horinezachary/shoppinglist/blob/master/lib/apiRouter.js) (API route adapter), [`sqlConfig.js`](https://github.com/horinezachary/shoppinglist/blob/master/sqlConfig.js) (MySQL access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webserver["Web routes<br/>[server.js]"]
  node_templates["Page templates"]
  node_links["App link association<br/>[appLinks.js]"]
end

subgraph group_api["Mobile API"]
  node_api_routes["API route adapter<br/>[apiRouter.js]"]
  node_api_rules["API operations<br/>[api.js]"]
  node_events["Live change events<br/>[apiEvents.js]"]
  node_idempotency["Retry protection<br/>[idempotency.js]"]
  node_validation["Input validation<br/>[validate.js]"]
end

subgraph group_identity["Accounts and access"]
  node_tokens["Device tokens<br/>[apiTokens.js]"]
  node_accounts["Account deletion<br/>[accounts.js]"]
  node_rate_limit["Rate limiting<br/>[rateLimit.js]"]
  node_passwords["Password handling<br/>[passwords.js]"]
end

subgraph group_data["Persistence"]
  node_mysql[("MySQL access<br/>[sqlConfig.js]")]
  node_migrations["Schema migrations<br/>[migrations.js]"]
  node_schema["Database schema"]
end

node_browser(("Browser user"))
node_mobile(("Mobile app"))
node_email["Email service"]

node_browser -->|"uses pages"| node_webserver
node_webserver -->|"renders pages"| node_templates
node_webserver -->|"starts pool"| node_mysql
node_webserver -.->|"mounts links"| node_links
node_mobile -->|"calls API"| node_api_routes
node_api_routes -->|"dispatches routes"| node_api_rules
node_api_routes -->|"handles streams"| node_events
node_api_routes -->|"guards writes"| node_idempotency
node_events -->|"checks changes"| node_api_rules
node_api_rules -->|"validates input"| node_validation
node_api_rules -.->|"deletes accounts"| node_accounts
node_api_rules -->|"authenticates tokens"| node_tokens
node_api_rules -.->|"queries data"| node_mysql
node_webserver -.->|"deletes accounts"| node_accounts
node_webserver -.->|"checks passwords"| node_passwords
node_webserver -.->|"limits sign-in"| node_rate_limit
node_webserver -.->|"sends messages"| node_email
node_migrations -.->|"applies changes"| node_schema
node_mysql -.->|"stores records"| node_schema

click node_webserver "https://github.com/horinezachary/shoppinglist/blob/master/server.js"
click node_templates "https://github.com/horinezachary/shoppinglist/tree/master/views"
click node_links "https://github.com/horinezachary/shoppinglist/blob/master/lib/appLinks.js"
click node_api_routes "https://github.com/horinezachary/shoppinglist/blob/master/lib/apiRouter.js"
click node_api_rules "https://github.com/horinezachary/shoppinglist/blob/master/lib/api.js"
click node_events "https://github.com/horinezachary/shoppinglist/blob/master/lib/apiEvents.js"
click node_idempotency "https://github.com/horinezachary/shoppinglist/blob/master/lib/idempotency.js"
click node_validation "https://github.com/horinezachary/shoppinglist/blob/master/lib/validate.js"
click node_tokens "https://github.com/horinezachary/shoppinglist/blob/master/lib/apiTokens.js"
click node_accounts "https://github.com/horinezachary/shoppinglist/blob/master/lib/accounts.js"
click node_rate_limit "https://github.com/horinezachary/shoppinglist/blob/master/lib/rateLimit.js"
click node_passwords "https://github.com/horinezachary/shoppinglist/blob/master/lib/passwords.js"
click node_mysql "https://github.com/horinezachary/shoppinglist/blob/master/sqlConfig.js"
click node_migrations "https://github.com/horinezachary/shoppinglist/blob/master/lib/migrations.js"
click node_schema "https://github.com/horinezachary/shoppinglist/tree/master/migrations"

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_webserver,node_templates,node_links,node_browser toneBlue
class node_api_routes,node_api_rules,node_events,node_idempotency,node_validation toneAmber
class node_tokens,node_accounts,node_rate_limit,node_passwords toneMint
class node_mysql,node_migrations,node_schema toneRose
class node_mobile,node_email toneIndigo
```

## Components

### Web experience

- [Web routes](https://github.com/horinezachary/shoppinglist/blob/master/server.js): `server.js`
- [Page templates](https://github.com/horinezachary/shoppinglist/tree/master/views): `views`
- [App link association](https://github.com/horinezachary/shoppinglist/blob/master/lib/appLinks.js): `lib/appLinks.js`

### Mobile API

- [API route adapter](https://github.com/horinezachary/shoppinglist/blob/master/lib/apiRouter.js): `lib/apiRouter.js`
- [API operations](https://github.com/horinezachary/shoppinglist/blob/master/lib/api.js): `lib/api.js`
- [Live change events](https://github.com/horinezachary/shoppinglist/blob/master/lib/apiEvents.js): `lib/apiEvents.js`
- [Retry protection](https://github.com/horinezachary/shoppinglist/blob/master/lib/idempotency.js): `lib/idempotency.js`
- [Input validation](https://github.com/horinezachary/shoppinglist/blob/master/lib/validate.js): `lib/validate.js`

### Accounts and access

- [Device tokens](https://github.com/horinezachary/shoppinglist/blob/master/lib/apiTokens.js): `lib/apiTokens.js`
- [Account deletion](https://github.com/horinezachary/shoppinglist/blob/master/lib/accounts.js): `lib/accounts.js`
- [Rate limiting](https://github.com/horinezachary/shoppinglist/blob/master/lib/rateLimit.js): `lib/rateLimit.js`
- [Password handling](https://github.com/horinezachary/shoppinglist/blob/master/lib/passwords.js): `lib/passwords.js`

### Persistence

- [MySQL access](https://github.com/horinezachary/shoppinglist/blob/master/sqlConfig.js): `sqlConfig.js`
- [Schema migrations](https://github.com/horinezachary/shoppinglist/blob/master/lib/migrations.js): `lib/migrations.js`
- [Database schema](https://github.com/horinezachary/shoppinglist/tree/master/migrations): `migrations`

### Other components

- **Browser user**
- **Mobile app**
- **Email service**

## Connections

- Browser user → Web routes: uses pages (evidence: `README.md`)
- Web routes → Page templates: renders pages (evidence: `server.js`)
- Web routes → MySQL access: starts pool (evidence: `server.js`)
- Web routes → App link association: mounts links (evidence: `server.js`)
- Mobile app → API route adapter: calls API (evidence: `README.md`)
- API route adapter → API operations: dispatches routes (evidence: `lib/apiRouter.js`)
- API route adapter → Live change events: handles streams (evidence: `lib/apiRouter.js`)
- API route adapter → Retry protection: guards writes (evidence: `lib/apiRouter.js`)
- Live change events → API operations: checks changes (evidence: `lib/apiEvents.js`)
- API operations → Input validation: validates input (evidence: `lib/api.js`)
- API operations → Account deletion: deletes accounts (evidence: `lib/api.js`)
- API operations → Device tokens: authenticates tokens (evidence: `lib/api.js`)
- API operations → MySQL access: queries data
- Web routes → Account deletion: deletes accounts (evidence: `server.js`)
- Web routes → Password handling: checks passwords (evidence: `server.js`)
- Web routes → Rate limiting: limits sign-in (evidence: `server.js`)
- Web routes → Email service: sends messages
- Schema migrations → Database schema: applies changes
- MySQL access → Database schema: stores records
