# gaetanbloch/norder architecture

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

- Interactive diagram: https://gitdiagram.com/gaetanbloch/norder
- Repository: https://github.com/gaetanbloch/norder

## Overview

This is an Express/EJS online shop. A shopper browses paginated products, adds items to a session-authenticated cart, checks out through Stripe, and later views orders or downloads an invoice; administrators manage their own product listings, while users can sign up, log in, and reset passwords. The graph separates routing, identity, catalog administration, commerce, and persistence. README capabilities include the documented PDF invoice and email flows; unsampled templates and integrations are represented only where the tree or README supports them.

Main entry points: [`controllers/shop.js`](https://github.com/gaetanbloch/norder/blob/master/controllers/shop.js) (Shopping workflow), [`app.js`](https://github.com/gaetanbloch/norder/blob/master/app.js) (Express application), [`models/user.js`](https://github.com/gaetanbloch/norder/blob/master/models/user.js) (User and cart), [`controllers/admin.js`](https://github.com/gaetanbloch/norder/blob/master/controllers/admin.js) (Product administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Express application<br/>[app.js]"]
  node_utils["Listing and errors<br/>[utils.js]"]
end

subgraph group_identity["Identity"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_auth_controller["Authentication<br/>[auth.js]"]
  node_auth_guard["Login guard<br/>[is-auth.js]"]
  node_user_model[("User and cart<br/>[user.js]")]
  node_email["Email delivery"]
end

subgraph group_catalog["Catalog administration"]
  node_admin_routes["Admin routes<br/>[admin.js]"]
  node_admin_controller["Product administration<br/>[admin.js]"]
  node_product_model[("Products<br/>[product.js]")]
  node_admin_views["Admin product views"]
end

subgraph group_commerce["Shopping and orders"]
  node_catalog_routes["Shop routes<br/>[shop.js]"]
  node_shop_controller["Shopping workflow<br/>[shop.js]"]
  node_order_model[("Orders<br/>[order.js]")]
  node_product_listing["Product listing<br/>[product-list.ejs]"]
  node_product_detail["Product detail<br/>[product-detail.ejs]"]
  node_cart_view["Cart and checkout views<br/>[cart.ejs]"]
  node_orders_view["Orders view<br/>[orders.ejs]"]
  node_pagination["Listing pagination<br/>[pagination.ejs]"]
end

subgraph group_data["Data and integrations"]
  node_mongodb[("MongoDB")]
  node_stripe["Stripe checkout"]
  node_pdfkit["PDF generation"]
end

node_shopper(("Shopper"))
node_admin_actor(("Administrator"))

node_shopper -.->|"uses"| node_app
node_admin_actor -.->|"uses"| node_app
node_app -->|"mounts"| node_auth_routes
node_app -->|"mounts"| node_admin_routes
node_app -->|"mounts"| node_catalog_routes
node_app -->|"loads session user"| node_user_model
node_app -->|"connects"| node_mongodb
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"checks signup email"| node_user_model
node_auth_controller -->|"reads and saves"| node_user_model
node_auth_controller -->|"sends messages"| node_email
node_admin_routes -->|"guards routes"| node_auth_guard
node_admin_routes -->|"dispatches"| node_admin_controller
node_admin_controller -->|"manages products"| node_product_model
node_admin_controller -->|"renders"| node_admin_views
node_admin_controller -->|"uses listing and file helpers"| node_utils
node_catalog_routes -->|"guards cart and orders"| node_auth_guard
node_catalog_routes -->|"dispatches"| node_shop_controller
node_shop_controller -->|"reads products"| node_product_model
node_shop_controller -->|"updates cart"| node_user_model
node_shop_controller -->|"creates and reads orders"| node_order_model
node_shop_controller -->|"creates checkout session"| node_stripe
node_shop_controller -->|"generates invoice"| node_pdfkit
node_shop_controller -->|"renders"| node_product_listing
node_shop_controller -->|"renders"| node_product_detail
node_shop_controller -->|"renders"| node_cart_view
node_shop_controller -->|"renders"| node_orders_view
node_shop_controller -->|"uses product listing helper"| node_utils
node_utils -->|"queries paginated products"| node_product_model
node_product_listing -.->|"uses"| node_pagination
node_product_model -.->|"persists products"| node_mongodb
node_user_model -.->|"persists user and cart"| node_mongodb
node_order_model -.->|"persists orders"| node_mongodb

click node_app "https://github.com/gaetanbloch/norder/blob/master/app.js"
click node_auth_routes "https://github.com/gaetanbloch/norder/blob/master/routes/auth.js"
click node_auth_controller "https://github.com/gaetanbloch/norder/blob/master/controllers/auth.js"
click node_auth_guard "https://github.com/gaetanbloch/norder/blob/master/middleware/is-auth.js"
click node_user_model "https://github.com/gaetanbloch/norder/blob/master/models/user.js"
click node_admin_routes "https://github.com/gaetanbloch/norder/blob/master/routes/admin.js"
click node_admin_controller "https://github.com/gaetanbloch/norder/blob/master/controllers/admin.js"
click node_catalog_routes "https://github.com/gaetanbloch/norder/blob/master/routes/shop.js"
click node_shop_controller "https://github.com/gaetanbloch/norder/blob/master/controllers/shop.js"
click node_product_model "https://github.com/gaetanbloch/norder/blob/master/models/product.js"
click node_order_model "https://github.com/gaetanbloch/norder/blob/master/models/order.js"
click node_product_listing "https://github.com/gaetanbloch/norder/blob/master/views/shop/product-list.ejs"
click node_product_detail "https://github.com/gaetanbloch/norder/blob/master/views/shop/product-detail.ejs"
click node_cart_view "https://github.com/gaetanbloch/norder/blob/master/views/shop/cart.ejs"
click node_orders_view "https://github.com/gaetanbloch/norder/blob/master/views/shop/orders.ejs"
click node_admin_views "https://github.com/gaetanbloch/norder/tree/master/views/admin"
click node_pagination "https://github.com/gaetanbloch/norder/blob/master/views/includes/pagination.ejs"
click node_utils "https://github.com/gaetanbloch/norder/blob/master/utils.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_utils toneBlue
class node_auth_routes,node_auth_controller,node_auth_guard,node_user_model,node_email toneAmber
class node_admin_routes,node_admin_controller,node_product_model,node_admin_views toneMint
class node_catalog_routes,node_shop_controller,node_order_model,node_product_listing,node_product_detail,node_cart_view,node_orders_view,node_pagination toneRose
class node_mongodb,node_stripe,node_pdfkit,node_shopper,node_admin_actor toneIndigo
```

## Components

### Web application

- [Express application](https://github.com/gaetanbloch/norder/blob/master/app.js): `app.js`
- [Listing and errors](https://github.com/gaetanbloch/norder/blob/master/utils.js): `utils.js`

### Identity

- [Auth routes](https://github.com/gaetanbloch/norder/blob/master/routes/auth.js): `routes/auth.js`
- [Authentication](https://github.com/gaetanbloch/norder/blob/master/controllers/auth.js): `controllers/auth.js`
- [Login guard](https://github.com/gaetanbloch/norder/blob/master/middleware/is-auth.js): `middleware/is-auth.js`
- [User and cart](https://github.com/gaetanbloch/norder/blob/master/models/user.js): `models/user.js`
- **Email delivery**

### Catalog administration

- [Admin routes](https://github.com/gaetanbloch/norder/blob/master/routes/admin.js): `routes/admin.js`
- [Product administration](https://github.com/gaetanbloch/norder/blob/master/controllers/admin.js): `controllers/admin.js`
- [Products](https://github.com/gaetanbloch/norder/blob/master/models/product.js): `models/product.js`
- [Admin product views](https://github.com/gaetanbloch/norder/tree/master/views/admin): `views/admin`

### Shopping and orders

- [Shop routes](https://github.com/gaetanbloch/norder/blob/master/routes/shop.js): `routes/shop.js`
- [Shopping workflow](https://github.com/gaetanbloch/norder/blob/master/controllers/shop.js): `controllers/shop.js`
- [Orders](https://github.com/gaetanbloch/norder/blob/master/models/order.js): `models/order.js`
- [Product listing](https://github.com/gaetanbloch/norder/blob/master/views/shop/product-list.ejs): `views/shop/product-list.ejs`
- [Product detail](https://github.com/gaetanbloch/norder/blob/master/views/shop/product-detail.ejs): `views/shop/product-detail.ejs`
- [Cart and checkout views](https://github.com/gaetanbloch/norder/blob/master/views/shop/cart.ejs): `views/shop/cart.ejs`
- [Orders view](https://github.com/gaetanbloch/norder/blob/master/views/shop/orders.ejs): `views/shop/orders.ejs`
- [Listing pagination](https://github.com/gaetanbloch/norder/blob/master/views/includes/pagination.ejs): `views/includes/pagination.ejs`

### Data and integrations

- **MongoDB**
- **Stripe checkout**
- **PDF generation**

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Express application: uses (evidence: `README.md`)
- Administrator → Express application: uses (evidence: `README.md`)
- Express application → Auth routes: mounts (evidence: `app.js`)
- Express application → Admin routes: mounts (evidence: `app.js`)
- Express application → Shop routes: mounts (evidence: `app.js`)
- Express application → User and cart: loads session user (evidence: `app.js`)
- Express application → MongoDB: connects (evidence: `app.js`)
- Auth routes → Authentication: dispatches (evidence: `routes/auth.js`)
- Auth routes → User and cart: checks signup email (evidence: `routes/auth.js`)
- Authentication → User and cart: reads and saves (evidence: `controllers/auth.js`)
- Authentication → Email delivery: sends messages (evidence: `controllers/auth.js`)
- Admin routes → Login guard: guards routes (evidence: `routes/admin.js`)
- Admin routes → Product administration: dispatches (evidence: `routes/admin.js`)
- Product administration → Products: manages products (evidence: `controllers/admin.js`)
- Product administration → Admin product views: renders (evidence: `controllers/admin.js`)
- Product administration → Listing and errors: uses listing and file helpers (evidence: `controllers/admin.js`)
- Shop routes → Login guard: guards cart and orders (evidence: `routes/shop.js`)
- Shop routes → Shopping workflow: dispatches (evidence: `routes/shop.js`)
- Shopping workflow → Products: reads products (evidence: `controllers/shop.js`)
- Shopping workflow → User and cart: updates cart (evidence: `controllers/shop.js`)
- Shopping workflow → Orders: creates and reads orders (evidence: `controllers/shop.js`)
- Shopping workflow → Stripe checkout: creates checkout session (evidence: `controllers/shop.js`)
- Shopping workflow → PDF generation: generates invoice (evidence: `controllers/shop.js`)
- Shopping workflow → Product listing: renders (evidence: `controllers/shop.js`)
- Shopping workflow → Product detail: renders (evidence: `controllers/shop.js`)
- Shopping workflow → Cart and checkout views: renders (evidence: `controllers/shop.js`)
- Shopping workflow → Orders view: renders (evidence: `controllers/shop.js`)
- Shopping workflow → Listing and errors: uses product listing helper (evidence: `controllers/shop.js`)
- Listing and errors → Products: queries paginated products (evidence: `utils.js`)
- Product listing → Listing pagination: uses
- Products → MongoDB: persists products (evidence: `README.md`)
- User and cart → MongoDB: persists user and cart (evidence: `README.md`)
- Orders → MongoDB: persists orders (evidence: `README.md`)
