# rmgonella/react-node-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/rmgonella/react-node-ecommerce
- Repository: https://github.com/rmgonella/react-node-ecommerce

## Overview

This is a React storefront backed by an Express API and PostgreSQL, with Stripe-hosted checkout. The main shopper flow loads products and categories, filters and displays products, adds items to an in-memory cart, then requests a checkout session and redirects to Stripe. The graph also includes documented authentication and catalog administration. Connections are limited to shown imports, calls, database queries, and README-stated capabilities; frontend login and product-detail behavior are not evidenced as working flows.

Main entry points: [`frontend/src/App.jsx`](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/App.jsx) (App State and Routing), [`backend/index.js`](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/index.js) (Express API Server), [`frontend/src/components/Home.jsx`](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Home.jsx) (Catalog and Filters), [`backend/routes/cart.js`](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/cart.js) (Checkout Sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App State and Routing<br/>[App.jsx]"]
  node_site_entry["React Entry<br/>[main.jsx]"]
  node_header["Store Header<br/>[Header.jsx]"]
  node_catalog_view["Catalog and Filters<br/>[Home.jsx]"]
  node_product_card["Product Card<br/>[ProductCard.jsx]"]
  node_cart_view["Cart and Checkout<br/>[Cart.jsx]"]
  node_success_view["Checkout Success<br/>[Success.jsx]"]
  node_cancel_view["Checkout Cancel<br/>[Cancel.jsx]"]
end

subgraph group_api["Backend API"]
  node_api_server["Express API Server<br/>[index.js]"]
  node_auth_routes["JWT Authentication<br/>[auth.js]"]
  node_product_routes["Product CRUD<br/>[products.js]"]
  node_category_routes["Category CRUD<br/>[categories.js]"]
  node_checkout_route["Checkout Sessions<br/>[cart.js]"]
end

subgraph group_commerce["Commerce Services"]
  node_pg_pool["PostgreSQL Pool<br/>[db.js]"]
  node_postgres[("PostgreSQL")]
  node_stripe["Stripe Checkout"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_site_entry -->|"renders"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_catalog_view
node_app -->|"renders"| node_cart_view
node_app -->|"renders"| node_success_view
node_app -->|"renders"| node_cancel_view
node_catalog_view -->|"renders"| node_product_card
node_catalog_view -->|"fetches products"| node_product_routes
node_catalog_view -->|"fetches categories"| node_category_routes
node_cart_view -->|"requests session"| node_checkout_route
node_checkout_route -->|"creates session"| node_stripe
node_checkout_route -->|"returns session ID"| node_cart_view
node_stripe -->|"redirects on success"| node_success_view
node_stripe -->|"redirects on cancel"| node_cancel_view
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_product_routes
node_api_server -->|"mounts routes"| node_category_routes
node_api_server -->|"mounts routes"| node_checkout_route
node_auth_routes -->|"queries users"| node_pg_pool
node_product_routes -->|"queries products"| node_pg_pool
node_category_routes -->|"queries categories"| node_pg_pool
node_pg_pool -->|"connects to"| node_postgres
node_shopper -->|"registers or logs in"| node_auth_routes

click node_app "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/App.jsx"
click node_site_entry "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/main.jsx"
click node_header "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Header.jsx"
click node_catalog_view "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Home.jsx"
click node_product_card "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/ProductCard.jsx"
click node_cart_view "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Cart.jsx"
click node_success_view "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Success.jsx"
click node_cancel_view "https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Cancel.jsx"
click node_api_server "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/index.js"
click node_auth_routes "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/auth.js"
click node_product_routes "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/products.js"
click node_category_routes "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/categories.js"
click node_checkout_route "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/cart.js"
click node_pg_pool "https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/db.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_site_entry,node_header,node_catalog_view,node_product_card,node_cart_view,node_success_view,node_cancel_view toneBlue
class node_api_server,node_auth_routes,node_product_routes,node_category_routes,node_checkout_route toneAmber
class node_pg_pool,node_postgres,node_stripe toneMint
class node_shopper toneIndigo
```

## Components

### Storefront

- [App State and Routing](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [React Entry](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Store Header](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Header.jsx): `frontend/src/components/Header.jsx`
- [Catalog and Filters](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Home.jsx): `frontend/src/components/Home.jsx`
- [Product Card](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/ProductCard.jsx): `frontend/src/components/ProductCard.jsx`
- [Cart and Checkout](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Cart.jsx): `frontend/src/components/Cart.jsx`
- [Checkout Success](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Success.jsx): `frontend/src/components/Success.jsx`
- [Checkout Cancel](https://github.com/rmgonella/react-node-ecommerce/blob/main/frontend/src/components/Cancel.jsx): `frontend/src/components/Cancel.jsx`

### Backend API

- [Express API Server](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/index.js): `backend/index.js`
- [JWT Authentication](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Product CRUD](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/products.js): `backend/routes/products.js`
- [Category CRUD](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/categories.js): `backend/routes/categories.js`
- [Checkout Sessions](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/routes/cart.js): `backend/routes/cart.js`

### Commerce Services

- [PostgreSQL Pool](https://github.com/rmgonella/react-node-ecommerce/blob/main/backend/db.js): `backend/db.js`
- **PostgreSQL**
- **Stripe Checkout**

### Other components

- **Shopper**

## Connections

- Shopper → App State and Routing: uses
- React Entry → App State and Routing: renders (evidence: `frontend/src/main.jsx`)
- App State and Routing → Store Header: renders (evidence: `frontend/src/App.jsx`)
- App State and Routing → Catalog and Filters: renders (evidence: `frontend/src/App.jsx`)
- App State and Routing → Cart and Checkout: renders (evidence: `frontend/src/App.jsx`)
- App State and Routing → Checkout Success: renders (evidence: `frontend/src/App.jsx`)
- App State and Routing → Checkout Cancel: renders (evidence: `frontend/src/App.jsx`)
- Catalog and Filters → Product Card: renders (evidence: `frontend/src/components/Home.jsx`)
- Catalog and Filters → Product CRUD: fetches products (evidence: `frontend/src/components/Home.jsx`)
- Catalog and Filters → Category CRUD: fetches categories (evidence: `frontend/src/components/Home.jsx`)
- Cart and Checkout → Checkout Sessions: requests session (evidence: `frontend/src/components/Cart.jsx`)
- Checkout Sessions → Stripe Checkout: creates session (evidence: `backend/routes/cart.js`)
- Checkout Sessions → Cart and Checkout: returns session ID (evidence: `frontend/src/components/Cart.jsx`)
- Stripe Checkout → Checkout Success: redirects on success
- Stripe Checkout → Checkout Cancel: redirects on cancel
- Express API Server → JWT Authentication: mounts routes (evidence: `backend/index.js`)
- Express API Server → Product CRUD: mounts routes (evidence: `backend/index.js`)
- Express API Server → Category CRUD: mounts routes (evidence: `backend/index.js`)
- Express API Server → Checkout Sessions: mounts routes (evidence: `backend/index.js`)
- JWT Authentication → PostgreSQL Pool: queries users (evidence: `backend/routes/auth.js`)
- Product CRUD → PostgreSQL Pool: queries products (evidence: `backend/routes/products.js`)
- Category CRUD → PostgreSQL Pool: queries categories (evidence: `backend/routes/categories.js`)
- PostgreSQL Pool → PostgreSQL: connects to (evidence: `backend/db.js`)
- Shopper → JWT Authentication: registers or logs in
