# andymutale/store architecture

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

- Interactive diagram: https://gitdiagram.com/andymutale/store
- Repository: https://github.com/andymutale/store

## Overview

Store is a full-stack sporting-goods commerce app. The main customer journey runs from catalogue discovery and variant selection through a persistent cart, server-driven checkout, Stripe confirmation, and fulfilment-oriented order records. Separate branches cover customer accounts and store administration. Source excerpts and the SOURCE INDEX substantiate the cart, authentication, and payment-confirmation links; checkout internals and several documented capabilities are represented at their exact enclosing directories because their implementation was not sampled.

Main entry points: [`src/lib/db.ts`](https://github.com/andymutale/store/blob/main/src/lib/db.ts) (Prisma database), [`src/app/(customerFacing)/products`](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/products) (Product discovery), [`src/lib/stripe-webhook.ts`](https://github.com/andymutale/store/blob/main/src/lib/stripe-webhook.ts) (Payment webhook), [`src/app/_actions/cart.ts`](https://github.com/andymutale/store/blob/main/src/app/_actions/cart.ts) (Cart actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Storefront"]
  node_catalog["Product discovery"]
  node_product["Product detail"]
end

subgraph group_commerce["Commerce"]
  node_cartui["Cart review"]
  node_cartactions["Cart actions<br/>[cart.ts]"]
  node_cartservice["Cart service<br/>[cart.ts]"]
  node_checkout["Checkout"]
  node_checkoutactions["Checkout actions<br/>[checkout.ts]"]
  node_stripe["Stripe payments<br/>[stripe.ts]"]
  node_webhook["Payment webhook<br/>[stripe-webhook.ts]"]
  node_orderemail["Order confirmation email"]
  node_webhookroute["Stripe webhook route<br/>[route.ts]"]
end

subgraph group_identity["Accounts"]
  node_orderhistory["Order history"]
  node_accounts["Account management"]
  node_authactions["Authentication actions<br/>[auth.ts]"]
  node_authservice["Session service<br/>[auth.ts]"]
end

subgraph group_operations["Store operations"]
  node_admin["Admin dashboard"]
  node_admincatalog["Catalog management<br/>[products.ts]"]
  node_adminorders["Order management<br/>[orders.ts]"]
  node_fulfilment["Fulfilment operations"]
end

subgraph group_shared["Runtime services"]
  node_db[("Prisma database<br/>[db.ts]")]
  node_formatters["Currency formatters<br/>[formatters.ts]"]
end

node_customer(("Shopper"))
node_payment["Stripe"]

node_customer -->|"browses"| node_catalog
node_catalog -->|"opens product"| node_product
node_product -->|"adds variant"| node_cartactions
node_cartactions -->|"updates cart"| node_cartservice
node_cartui -->|"loads cart"| node_cartservice
node_cartui -->|"proceeds to"| node_checkout
node_customer -->|"submits details"| node_checkout
node_checkout -.->|"submits checkout"| node_checkoutactions
node_checkoutactions -.->|"creates intent"| node_stripe
node_stripe -.->|"creates payment"| node_payment
node_payment -.->|"sends event"| node_webhookroute
node_webhookroute -.->|"dispatches handler"| node_webhook
node_webhook -->|"updates order and stock"| node_db
node_webhook -->|"clears guest cart"| node_cartactions
node_webhook -->|"sends confirmation"| node_orderemail
node_orderhistory -.->|"reads orders"| node_db
node_accounts -->|"requires session"| node_authservice
node_authactions -->|"creates session"| node_authservice
node_authservice -->|"stores sessions"| node_db
node_admin -->|"reads metrics"| node_db
node_admincatalog -.->|"manages catalogue"| node_db
node_adminorders -.->|"manages orders"| node_db
node_adminorders -.->|"supports fulfilment"| node_fulfilment
node_catalog -->|"reads catalogue"| node_db
node_catalog -->|"formats prices"| node_formatters
node_orderemail -->|"formats totals"| node_formatters

click node_catalog "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/products"
click node_product "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/products/%5Bslug%5D"
click node_cartui "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/cart"
click node_cartactions "https://github.com/andymutale/store/blob/main/src/app/_actions/cart.ts"
click node_cartservice "https://github.com/andymutale/store/blob/main/src/lib/cart.ts"
click node_checkout "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/checkout"
click node_checkoutactions "https://github.com/andymutale/store/blob/main/src/app/_actions/checkout.ts"
click node_stripe "https://github.com/andymutale/store/blob/main/src/lib/stripe.ts"
click node_webhook "https://github.com/andymutale/store/blob/main/src/lib/stripe-webhook.ts"
click node_orderemail "https://github.com/andymutale/store/blob/main/src/email/OrderConfirmation.tsx"
click node_orderhistory "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/account/orders"
click node_accounts "https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/account"
click node_authactions "https://github.com/andymutale/store/blob/main/src/app/_actions/auth.ts"
click node_authservice "https://github.com/andymutale/store/blob/main/src/lib/auth.ts"
click node_admin "https://github.com/andymutale/store/tree/main/src/app/admin"
click node_admincatalog "https://github.com/andymutale/store/blob/main/src/app/admin/_actions/products.ts"
click node_adminorders "https://github.com/andymutale/store/blob/main/src/app/admin/_actions/orders.ts"
click node_db "https://github.com/andymutale/store/blob/main/src/lib/db.ts"
click node_formatters "https://github.com/andymutale/store/blob/main/src/lib/formatters.ts"
click node_fulfilment "https://github.com/andymutale/store/tree/main/src/app/admin/orders"
click node_webhookroute "https://github.com/andymutale/store/blob/main/src/app/webhooks/stripe/route.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_catalog,node_product toneBlue
class node_cartui,node_cartactions,node_cartservice,node_checkout,node_checkoutactions,node_stripe,node_webhook,node_orderemail,node_webhookroute toneAmber
class node_orderhistory,node_accounts,node_authactions,node_authservice toneMint
class node_admin,node_admincatalog,node_adminorders,node_fulfilment toneRose
class node_db,node_formatters,node_customer,node_payment toneIndigo
```

## Components

### Storefront

- [Product discovery](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/products): `src/app/(customerFacing)/products`
- [Product detail](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/products/%5Bslug%5D): `src/app/(customerFacing)/products/[slug]`

### Commerce

- [Cart review](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/cart): `src/app/(customerFacing)/cart`
- [Cart actions](https://github.com/andymutale/store/blob/main/src/app/_actions/cart.ts): `src/app/_actions/cart.ts`
- [Cart service](https://github.com/andymutale/store/blob/main/src/lib/cart.ts): `src/lib/cart.ts`
- [Checkout](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/checkout): `src/app/(customerFacing)/checkout`
- [Checkout actions](https://github.com/andymutale/store/blob/main/src/app/_actions/checkout.ts): `src/app/_actions/checkout.ts`
- [Stripe payments](https://github.com/andymutale/store/blob/main/src/lib/stripe.ts): `src/lib/stripe.ts`
- [Payment webhook](https://github.com/andymutale/store/blob/main/src/lib/stripe-webhook.ts): `src/lib/stripe-webhook.ts`
- [Order confirmation email](https://github.com/andymutale/store/blob/main/src/email/OrderConfirmation.tsx): `src/email/OrderConfirmation.tsx`
- [Stripe webhook route](https://github.com/andymutale/store/blob/main/src/app/webhooks/stripe/route.ts): `src/app/webhooks/stripe/route.ts`

### Accounts

- [Order history](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/account/orders): `src/app/(customerFacing)/account/orders`
- [Account management](https://github.com/andymutale/store/tree/main/src/app/(customerFacing)/account): `src/app/(customerFacing)/account`
- [Authentication actions](https://github.com/andymutale/store/blob/main/src/app/_actions/auth.ts): `src/app/_actions/auth.ts`
- [Session service](https://github.com/andymutale/store/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Store operations

- [Admin dashboard](https://github.com/andymutale/store/tree/main/src/app/admin): `src/app/admin`
- [Catalog management](https://github.com/andymutale/store/blob/main/src/app/admin/_actions/products.ts): `src/app/admin/_actions/products.ts`
- [Order management](https://github.com/andymutale/store/blob/main/src/app/admin/_actions/orders.ts): `src/app/admin/_actions/orders.ts`
- [Fulfilment operations](https://github.com/andymutale/store/tree/main/src/app/admin/orders): `src/app/admin/orders`

### Runtime services

- [Prisma database](https://github.com/andymutale/store/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Currency formatters](https://github.com/andymutale/store/blob/main/src/lib/formatters.ts): `src/lib/formatters.ts`

### Other components

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

## Connections

- Shopper → Product discovery: browses
- Product discovery → Product detail: opens product (evidence: `src/app/(customerFacing)/products/page.tsx`)
- Product detail → Cart actions: adds variant (evidence: `src/app/(customerFacing)/products/[slug]/_components/ProductActions.tsx`)
- Cart actions → Cart service: updates cart (evidence: `src/app/_actions/cart.ts`)
- Cart review → Cart service: loads cart (evidence: `src/app/(customerFacing)/cart/page.tsx`)
- Cart review → Checkout: proceeds to (evidence: `src/app/(customerFacing)/cart/page.tsx`)
- Shopper → Checkout: submits details
- Checkout → Checkout actions: submits checkout
- Checkout actions → Stripe payments: creates intent
- Stripe payments → Stripe: creates payment
- Stripe → Stripe webhook route: sends event
- Stripe webhook route → Payment webhook: dispatches handler
- Payment webhook → Prisma database: updates order and stock (evidence: `src/lib/stripe-webhook.ts`)
- Payment webhook → Cart actions: clears guest cart (evidence: `src/lib/stripe-webhook.ts`)
- Payment webhook → Order confirmation email: sends confirmation (evidence: `src/lib/stripe-webhook.ts`)
- Order history → Prisma database: reads orders
- Account management → Session service: requires session (evidence: `src/app/(customerFacing)/account/page.tsx`)
- Authentication actions → Session service: creates session (evidence: `src/app/_actions/auth.ts`)
- Session service → Prisma database: stores sessions (evidence: `src/lib/auth.ts`)
- Admin dashboard → Prisma database: reads metrics (evidence: `src/app/admin/page.tsx`)
- Catalog management → Prisma database: manages catalogue
- Order management → Prisma database: manages orders
- Order management → Fulfilment operations: supports fulfilment (evidence: `src/app/admin/orders/_components/OrderStatusForm.tsx`)
- Product discovery → Prisma database: reads catalogue (evidence: `src/app/(customerFacing)/products/page.tsx`)
- Product discovery → Currency formatters: formats prices (evidence: `src/app/(customerFacing)/products/[slug]/page.tsx`)
- Order confirmation email → Currency formatters: formats totals (evidence: `src/email/OrderConfirmation.tsx`)
