# councicroff-commits/cc-main architecture

> Architecture diagram of the GitHub repository councicroff-commits/cc-main, 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/councicroff-commits/cc-main
- Repository: https://github.com/councicroff-commits/cc-main

## Overview

This is a React storefront with account management and an e-commerce flow: visitors browse and inspect products, add items to a cart, proceed through checkout, and view orders. The router selects public and protected pages; shared contexts hold authentication, product, cart, checkout, and order state. Product and account contexts make API requests, while cart context also handles cart-related requests. The source excerpts show only part of the routing and context behavior, so unsampled page links are included only where the SOURCE INDEX or excerpts name them; no payment provider or persistent order backend is inferred.

Main entry points: [`src/router/AppRouter.tsx`](https://github.com/councicroff-commits/cc-main/blob/main/src/router/AppRouter.tsx) (Route selection), [`src/main.tsx`](https://github.com/councicroff-commits/cc-main/blob/main/src/main.tsx) (App setup), [`src/context/CartContext.tsx`](https://github.com/councicroff-commits/cc-main/blob/main/src/context/CartContext.tsx) (Cart state), [`src/pages/CheckoutPage.tsx`](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/CheckoutPage.tsx) (Checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_app["App setup<br/>[main.tsx]"]
  node_router["Route selection<br/>[AppRouter.tsx]"]
  node_protected["Access guard<br/>[ProtectedRoute.tsx]"]
  node_layout["Store layout<br/>[Navbar.tsx]"]
end

subgraph group_shopping["Storefront"]
  node_home["Home storefront<br/>[Home.tsx]"]
  node_catalog["Product catalog<br/>[ProductGrid.tsx]"]
  node_product["Product detail<br/>[ProductDetail.tsx]"]
  node_cartpage["Cart<br/>[CartPage.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_orders["Order views<br/>[OrderPage.tsx]"]
end

subgraph group_state["Commerce state"]
  node_productstate["Product state<br/>[ProductContext.tsx]"]
  node_cartstate["Cart state<br/>[CartContext.tsx]"]
  node_checkoutstate["Checkout state"]
  node_orderstate["Order state<br/>[OrderContext.tsx]"]
end

subgraph group_account["Account"]
  node_authpages["Sign-in and profile<br/>[LoginPage.tsx]"]
  node_authstate["Authentication<br/>[AuthContext.tsx]"]
end

node_customer(("Shopper"))
node_backend[("Application API")]

node_customer -->|"browses"| node_router
node_app -->|"renders"| node_router
node_app -->|"provides"| node_authstate
node_app -->|"provides"| node_productstate
node_app -->|"provides"| node_cartstate
node_app -->|"provides"| node_checkoutstate
node_app -->|"provides"| node_orderstate
node_router -->|"renders"| node_layout
node_router -->|"routes"| node_home
node_router -->|"routes"| node_catalog
node_router -->|"routes"| node_product
node_router -->|"guards"| node_protected
node_protected -->|"checks"| node_authstate
node_router -->|"routes"| node_cartpage
node_router -->|"routes"| node_checkout
node_router -->|"routes"| node_orders
node_router -->|"routes"| node_authpages
node_product -->|"fetches product"| node_productstate
node_product -->|"adds items"| node_cartstate
node_cartpage -->|"uses cart"| node_cartstate
node_checkout -->|"uses cart"| node_cartstate
node_checkout -->|"uses checkout"| node_checkoutstate
node_checkout -->|"uses orders"| node_orderstate
node_orders -.->|"uses orders"| node_orderstate
node_layout -->|"reads count"| node_cartstate
node_authpages -.->|"authenticates"| node_authstate
node_authstate -->|"requests account"| node_backend
node_productstate -->|"fetches products"| node_backend
node_cartstate -->|"requests cart data"| node_backend

click node_app "https://github.com/councicroff-commits/cc-main/blob/main/src/main.tsx"
click node_router "https://github.com/councicroff-commits/cc-main/blob/main/src/router/AppRouter.tsx"
click node_protected "https://github.com/councicroff-commits/cc-main/blob/main/src/router/ProtectedRoute.tsx"
click node_layout "https://github.com/councicroff-commits/cc-main/blob/main/src/components/layout/Navbar.tsx"
click node_home "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/Home.tsx"
click node_catalog "https://github.com/councicroff-commits/cc-main/blob/main/src/components/product/ProductGrid.tsx"
click node_product "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/ProductDetail.tsx"
click node_productstate "https://github.com/councicroff-commits/cc-main/blob/main/src/context/ProductContext.tsx"
click node_cartpage "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/CartPage.tsx"
click node_cartstate "https://github.com/councicroff-commits/cc-main/blob/main/src/context/CartContext.tsx"
click node_checkout "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/CheckoutPage.tsx"
click node_checkoutstate "https://github.com/councicroff-commits/cc-main/blob/main/src/context/CheckoutContext.tsx"
click node_orders "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/OrderPage.tsx"
click node_orderstate "https://github.com/councicroff-commits/cc-main/blob/main/src/context/OrderContext.tsx"
click node_authpages "https://github.com/councicroff-commits/cc-main/blob/main/src/pages/LoginPage.tsx"
click node_authstate "https://github.com/councicroff-commits/cc-main/blob/main/src/context/AuthContext.tsx"

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_router,node_protected,node_layout toneBlue
class node_home,node_catalog,node_product,node_cartpage,node_checkout,node_orders,node_backend toneAmber
class node_productstate,node_cartstate,node_checkoutstate,node_orderstate toneMint
class node_authpages,node_authstate toneRose
class node_customer toneIndigo
```

## Components

### App navigation

- [App setup](https://github.com/councicroff-commits/cc-main/blob/main/src/main.tsx): `src/main.tsx`
- [Route selection](https://github.com/councicroff-commits/cc-main/blob/main/src/router/AppRouter.tsx): `src/router/AppRouter.tsx`
- [Access guard](https://github.com/councicroff-commits/cc-main/blob/main/src/router/ProtectedRoute.tsx): `src/router/ProtectedRoute.tsx`
- [Store layout](https://github.com/councicroff-commits/cc-main/blob/main/src/components/layout/Navbar.tsx): `src/components/layout/Navbar.tsx`

### Storefront

- [Home storefront](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Product catalog](https://github.com/councicroff-commits/cc-main/blob/main/src/components/product/ProductGrid.tsx): `src/components/product/ProductGrid.tsx`
- [Product detail](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/ProductDetail.tsx): `src/pages/ProductDetail.tsx`
- [Cart](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/CartPage.tsx): `src/pages/CartPage.tsx`
- [Checkout](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/CheckoutPage.tsx): `src/pages/CheckoutPage.tsx`
- [Order views](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/OrderPage.tsx): `src/pages/OrderPage.tsx`

### Commerce state

- [Product state](https://github.com/councicroff-commits/cc-main/blob/main/src/context/ProductContext.tsx): `src/context/ProductContext.tsx`
- [Cart state](https://github.com/councicroff-commits/cc-main/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`
- [Checkout state](https://github.com/councicroff-commits/cc-main/blob/main/src/context/CheckoutContext.tsx): `src/context/CheckoutContext.tsx`
- [Order state](https://github.com/councicroff-commits/cc-main/blob/main/src/context/OrderContext.tsx): `src/context/OrderContext.tsx`

### Account

- [Sign-in and profile](https://github.com/councicroff-commits/cc-main/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`
- [Authentication](https://github.com/councicroff-commits/cc-main/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`

### Other components

- **Shopper**
- **Application API**

## Connections

- Shopper → Route selection: browses (evidence: `src/router/AppRouter.tsx`)
- App setup → Route selection: renders
- App setup → Authentication: provides (evidence: `src/main.tsx`)
- App setup → Product state: provides (evidence: `src/main.tsx`)
- App setup → Cart state: provides (evidence: `src/main.tsx`)
- App setup → Checkout state: provides (evidence: `src/main.tsx`)
- App setup → Order state: provides (evidence: `src/main.tsx`)
- Route selection → Store layout: renders (evidence: `src/router/AppRouter.tsx`)
- Route selection → Home storefront: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Product catalog: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Product detail: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Access guard: guards (evidence: `src/router/AppRouter.tsx`)
- Access guard → Authentication: checks (evidence: `src/router/ProtectedRoute.tsx`)
- Route selection → Cart: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Checkout: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Order views: routes (evidence: `src/router/AppRouter.tsx`)
- Route selection → Sign-in and profile: routes (evidence: `src/router/AppRouter.tsx`)
- Product detail → Product state: fetches product (evidence: `src/pages/ProductDetail.tsx`)
- Product detail → Cart state: adds items (evidence: `src/pages/ProductDetail.tsx`)
- Cart → Cart state: uses cart (evidence: `src/pages/CartPage.tsx`)
- Checkout → Cart state: uses cart (evidence: `src/pages/CheckoutPage.tsx`)
- Checkout → Checkout state: uses checkout (evidence: `src/pages/CheckoutPage.tsx`)
- Checkout → Order state: uses orders (evidence: `src/pages/CheckoutPage.tsx`)
- Order views → Order state: uses orders
- Store layout → Cart state: reads count (evidence: `src/components/layout/Navbar.tsx`)
- Sign-in and profile → Authentication: authenticates (evidence: `src/pages/LoginPage.tsx`)
- Authentication → Application API: requests account (evidence: `src/context/AuthContext.tsx`)
- Product state → Application API: fetches products (evidence: `src/context/ProductContext.tsx`)
- Cart state → Application API: requests cart data (evidence: `src/context/CartContext.tsx`)
