# machadop1407/ecommerce-nextjs-fullstack-app architecture

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

- Interactive diagram: https://gitdiagram.com/machadop1407/ecommerce-nextjs-fullstack-app
- Repository: https://github.com/machadop1407/ecommerce-nextjs-fullstack-app

## Overview

This Next.js ecommerce storefront lets shoppers browse Stripe products, add quantities to a persistent client-side cart, submit an order for Stripe Checkout, and reach a success page after payment. Its main stages are product discovery, product detail and cart updates, order review, payment-session creation, and post-payment navigation. The README also highlights a rotating product carousel and live cart count. Relationships are based on the README and indexed source references; some page and carousel implementations were not excerpted.

Main entry points: [`app/checkout/page.tsx`](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/checkout/page.tsx) (Cart review), [`lib/stripe.ts`](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/lib/stripe.ts) (Stripe client), [`components/product-card.tsx`](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-card.tsx) (Product card), [`components/ui/button.tsx`](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/ui/button.tsx) (Button)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home page<br/>[page.tsx]"]
  node_carousel["Product carousel<br/>[carousel.tsx]"]
  node_products["Product catalog page<br/>[page.tsx]"]
  node_product_list["Product list<br/>[product-list.tsx]"]
  node_product_card["Product card<br/>[product-card.tsx]"]
  node_product_route["Product detail route<br/>[page.tsx]"]
  node_product_detail["Product details<br/>[product-detail.tsx]"]
  node_navbar["Navigation and cart count<br/>[navbar.tsx]"]
end

subgraph group_cart["Cart"]
  node_cart_store["Persistent cart state<br/>[cart-store.ts]"]
end

subgraph group_payment["Checkout and payment"]
  node_checkout_page["Cart review<br/>[page.tsx]"]
  node_checkout_action["Checkout session action<br/>[checkout-action.ts]"]
  node_success["Payment success page<br/>[page.tsx]"]
  node_stripe_client["Stripe client<br/>[stripe.ts]"]
end

subgraph group_presentation["UI components"]
  node_button["Button<br/>[button.tsx]"]
  node_card["Card components<br/>[card.tsx]"]
  node_layout["Application layout<br/>[layout.tsx]"]
  node_utils["Class utilities<br/>[utils.ts]"]
end

node_shopper(("Shopper"))
node_stripe{{"Stripe services"}}

node_shopper -->|"opens storefront"| node_home
node_shopper -->|"browses products"| node_products
node_shopper -->|"reviews cart"| node_checkout_page
node_home -->|"lists products"| node_stripe_client
node_home -->|"renders"| node_carousel
node_stripe_client -.->|"accesses API"| node_stripe
node_products -->|"lists products"| node_stripe_client
node_products -->|"renders"| node_product_list
node_product_list -->|"renders"| node_product_card
node_product_card -->|"links to details"| node_product_route
node_product_route -->|"loads product"| node_stripe_client
node_product_route -->|"renders"| node_product_detail
node_carousel -->|"uses cards"| node_card
node_product_card -->|"uses cards"| node_card
node_product_card -->|"uses button"| node_button
node_product_detail -->|"updates cart"| node_cart_store
node_navbar -->|"reads cart"| node_cart_store
node_navbar -->|"uses button"| node_button
node_checkout_page -->|"reads and updates"| node_cart_store
node_checkout_page -->|"submits form"| node_checkout_action
node_checkout_page -->|"uses cards"| node_card
node_checkout_page -->|"uses button"| node_button
node_checkout_action -->|"creates session"| node_stripe_client
node_checkout_action -->|"redirects on success"| node_success
node_success -->|"references cart"| node_cart_store
node_layout -->|"renders"| node_navbar
node_button -->|"merges classes"| node_utils
node_card -->|"merges classes"| node_utils

click node_home "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/page.tsx"
click node_carousel "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/carousel.tsx"
click node_products "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/products/page.tsx"
click node_product_list "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-list.tsx"
click node_product_card "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-card.tsx"
click node_product_route "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/products/%5Bid%5D/page.tsx"
click node_product_detail "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-detail.tsx"
click node_navbar "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/navbar.tsx"
click node_cart_store "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/store/cart-store.ts"
click node_checkout_page "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/checkout/page.tsx"
click node_checkout_action "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/checkout/checkout-action.ts"
click node_success "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/success/page.tsx"
click node_stripe_client "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/lib/stripe.ts"
click node_button "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/ui/button.tsx"
click node_card "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/ui/card.tsx"
click node_layout "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/layout.tsx"
click node_utils "https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/lib/utils.ts"

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_home,node_carousel,node_products,node_product_list,node_product_card,node_product_route,node_product_detail,node_navbar toneBlue
class node_cart_store toneAmber
class node_checkout_page,node_checkout_action,node_success,node_stripe_client toneMint
class node_button,node_card,node_layout,node_utils toneRose
class node_shopper,node_stripe toneIndigo
```

## Components

### Storefront

- [Home page](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/page.tsx): `app/page.tsx`
- [Product carousel](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/carousel.tsx): `components/carousel.tsx`
- [Product catalog page](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/products/page.tsx): `app/products/page.tsx`
- [Product list](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-list.tsx): `components/product-list.tsx`
- [Product card](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-card.tsx): `components/product-card.tsx`
- [Product detail route](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/products/%5Bid%5D/page.tsx): `app/products/[id]/page.tsx`
- [Product details](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/product-detail.tsx): `components/product-detail.tsx`
- [Navigation and cart count](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/navbar.tsx): `components/navbar.tsx`

### Cart

- [Persistent cart state](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/store/cart-store.ts): `store/cart-store.ts`

### Checkout and payment

- [Cart review](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/checkout/page.tsx): `app/checkout/page.tsx`
- [Checkout session action](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/checkout/checkout-action.ts): `app/checkout/checkout-action.ts`
- [Payment success page](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/success/page.tsx): `app/success/page.tsx`
- [Stripe client](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/lib/stripe.ts): `lib/stripe.ts`

### UI components

- [Button](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/ui/button.tsx): `components/ui/button.tsx`
- [Card components](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/components/ui/card.tsx): `components/ui/card.tsx`
- [Application layout](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/app/layout.tsx): `app/layout.tsx`
- [Class utilities](https://github.com/machadop1407/ecommerce-nextjs-fullstack-app/blob/main/lib/utils.ts): `lib/utils.ts`

### Other components

- **Shopper**
- **Stripe services**

## Connections

- Shopper → Home page: opens storefront (evidence: `README.md`)
- Shopper → Product catalog page: browses products (evidence: `README.md`)
- Shopper → Cart review: reviews cart (evidence: `README.md`)
- Home page → Stripe client: lists products (evidence: `app/page.tsx`)
- Home page → Product carousel: renders (evidence: `app/page.tsx`)
- Stripe client → Stripe services: accesses API
- Product catalog page → Stripe client: lists products (evidence: `app/products/page.tsx`)
- Product catalog page → Product list: renders (evidence: `app/products/page.tsx`)
- Product list → Product card: renders (evidence: `components/product-list.tsx`)
- Product card → Product detail route: links to details (evidence: `components/product-card.tsx`)
- Product detail route → Stripe client: loads product (evidence: `app/products/[id]/page.tsx`)
- Product detail route → Product details: renders (evidence: `app/products/[id]/page.tsx`)
- Product carousel → Card components: uses cards (evidence: `components/carousel.tsx`)
- Product card → Card components: uses cards (evidence: `components/product-card.tsx`)
- Product card → Button: uses button (evidence: `components/product-card.tsx`)
- Product details → Persistent cart state: updates cart (evidence: `components/product-detail.tsx`)
- Navigation and cart count → Persistent cart state: reads cart (evidence: `components/navbar.tsx`)
- Navigation and cart count → Button: uses button (evidence: `components/navbar.tsx`)
- Cart review → Persistent cart state: reads and updates (evidence: `app/checkout/page.tsx`)
- Cart review → Checkout session action: submits form (evidence: `app/checkout/page.tsx`)
- Cart review → Card components: uses cards (evidence: `app/checkout/page.tsx`)
- Cart review → Button: uses button (evidence: `app/checkout/page.tsx`)
- Checkout session action → Stripe client: creates session (evidence: `app/checkout/checkout-action.ts`)
- Checkout session action → Payment success page: redirects on success (evidence: `app/checkout/checkout-action.ts`)
- Payment success page → Persistent cart state: references cart (evidence: `app/success/page.tsx`)
- Application layout → Navigation and cart count: renders (evidence: `app/layout.tsx`)
- Button → Class utilities: merges classes (evidence: `components/ui/button.tsx`)
- Card components → Class utilities: merges classes (evidence: `components/ui/card.tsx`)
