# leonardondev/dev-store architecture

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

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

## Overview

Dev Store is a Next.js storefront for browsing featured products, viewing product details, searching the catalog, and adding items to a client-side cart. The main journey runs from the store UI through a shared API client to product endpoints backed by local JSON data; product pages can then add products to cart state. The source index and excerpts support the UI and API relationships shown, but do not verify the client’s HTTP routing to individual endpoints, so those links are marked unverified.

Main entry points: [`src/data/api.ts`](https://github.com/leonardondev/dev-store/blob/main/src/data/api.ts) (API Client), [`src/app/api/data.json`](https://github.com/leonardondev/dev-store/blob/main/src/app/api/data.json) (Catalog Data), [`src/app/(store)/(home)/page.tsx`](https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/(home)/page.tsx) (Featured Home), [`src/components/header.tsx`](https://github.com/leonardondev/dev-store/blob/main/src/components/header.tsx) (Store Header)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront UI"]
  node_store_layout["Store Layout<br/>[layout.tsx]"]
  node_home["Featured Home<br/>[page.tsx]"]
  node_product_page["Product Detail<br/>[page.tsx]"]
  node_search_page["Search Results<br/>[page.tsx]"]
  node_header["Store Header<br/>[header.tsx]"]
  node_search_form["Search Form<br/>[search-form.tsx]"]
  node_loading_skeleton["Loading Skeleton<br/>[skeleton.tsx]"]
end

subgraph group_catalog["Catalog API"]
  node_featured_api["Featured Products<br/>[route.ts]"]
  node_product_api["Product Lookup<br/>[route.ts]"]
  node_search_api["Product Search API<br/>[route.ts]"]
  node_products_api["Product Listing API<br/>[route.ts]"]
  node_catalog_data[("Catalog Data<br/>[data.json]")]
end

subgraph group_cart["Cart State"]
  node_cart_provider["Cart Provider<br/>[cart-context.tsx]"]
  node_add_button["Add to Cart"]
  node_cart_widget["Cart Widget<br/>[cart-widget.tsx]"]
end

subgraph group_data["Data Access"]
  node_api_client["API Client<br/>[api.ts]"]
  node_env_config["API Environment<br/>[env.ts]"]
  node_product_types["Product Types<br/>[products.ts]"]
end

node_shopper(("Shopper"))

node_shopper -->|"browses"| node_home
node_store_layout -->|"renders"| node_header
node_store_layout -->|"provides cart"| node_cart_provider
node_header -->|"renders"| node_search_form
node_header -->|"renders"| node_cart_widget
node_home -->|"requests featured"| node_api_client
node_product_page -->|"requests product"| node_api_client
node_search_page -.->|"requests results"| node_api_client
node_api_client -->|"reads endpoint"| node_env_config
node_api_client -.->|"HTTP request"| node_featured_api
node_api_client -.->|"HTTP request"| node_product_api
node_api_client -.->|"HTTP request"| node_search_api
node_api_client -.->|"HTTP request"| node_products_api
node_featured_api -->|"reads products"| node_catalog_data
node_product_api -->|"finds product"| node_catalog_data
node_search_api -->|"filters products"| node_catalog_data
node_products_api -->|"reads products"| node_catalog_data
node_product_page -->|"renders"| node_add_button
node_add_button -->|"updates cart"| node_cart_provider
node_cart_widget -->|"reads cart"| node_cart_provider
node_shopper -->|"submits query"| node_search_form
node_search_page -->|"shows loading"| node_loading_skeleton
node_home -->|"shows loading"| node_loading_skeleton

click node_store_layout "https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/layout.tsx"
click node_home "https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/(home)/page.tsx"
click node_product_page "https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/product/%5Bslug%5D/page.tsx"
click node_search_page "https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/search/page.tsx"
click node_header "https://github.com/leonardondev/dev-store/blob/main/src/components/header.tsx"
click node_search_form "https://github.com/leonardondev/dev-store/blob/main/src/components/search-form.tsx"
click node_loading_skeleton "https://github.com/leonardondev/dev-store/blob/main/src/components/skeleton.tsx"
click node_api_client "https://github.com/leonardondev/dev-store/blob/main/src/data/api.ts"
click node_env_config "https://github.com/leonardondev/dev-store/blob/main/src/env.ts"
click node_product_types "https://github.com/leonardondev/dev-store/blob/main/src/data/types/products.ts"
click node_featured_api "https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/featured/route.ts"
click node_product_api "https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/%5Bslug%5D/route.ts"
click node_search_api "https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/search/route.ts"
click node_products_api "https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/route.ts"
click node_catalog_data "https://github.com/leonardondev/dev-store/blob/main/src/app/api/data.json"
click node_cart_provider "https://github.com/leonardondev/dev-store/blob/main/src/context/cart-context.tsx"
click node_add_button "https://github.com/leonardondev/dev-store/blob/main/src/components/add-to-cart-button.tsx"
click node_cart_widget "https://github.com/leonardondev/dev-store/blob/main/src/components/cart-widget.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_store_layout,node_home,node_product_page,node_search_page,node_header,node_search_form,node_loading_skeleton toneBlue
class node_featured_api,node_product_api,node_search_api,node_products_api,node_catalog_data toneAmber
class node_cart_provider,node_add_button,node_cart_widget toneMint
class node_api_client,node_env_config,node_product_types toneRose
class node_shopper toneIndigo
```

## Components

### Storefront UI

- [Store Layout](https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/layout.tsx): `src/app/(store)/layout.tsx`
- [Featured Home](https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/(home)/page.tsx): `src/app/(store)/(home)/page.tsx`
- [Product Detail](https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/product/%5Bslug%5D/page.tsx): `src/app/(store)/product/[slug]/page.tsx`
- [Search Results](https://github.com/leonardondev/dev-store/blob/main/src/app/(store)/search/page.tsx): `src/app/(store)/search/page.tsx`
- [Store Header](https://github.com/leonardondev/dev-store/blob/main/src/components/header.tsx): `src/components/header.tsx`
- [Search Form](https://github.com/leonardondev/dev-store/blob/main/src/components/search-form.tsx): `src/components/search-form.tsx`
- [Loading Skeleton](https://github.com/leonardondev/dev-store/blob/main/src/components/skeleton.tsx): `src/components/skeleton.tsx`

### Catalog API

- [Featured Products](https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/featured/route.ts): `src/app/api/products/featured/route.ts`
- [Product Lookup](https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/%5Bslug%5D/route.ts): `src/app/api/products/[slug]/route.ts`
- [Product Search API](https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/search/route.ts): `src/app/api/products/search/route.ts`
- [Product Listing API](https://github.com/leonardondev/dev-store/blob/main/src/app/api/products/route.ts): `src/app/api/products/route.ts`
- [Catalog Data](https://github.com/leonardondev/dev-store/blob/main/src/app/api/data.json): `src/app/api/data.json`

### Cart State

- [Cart Provider](https://github.com/leonardondev/dev-store/blob/main/src/context/cart-context.tsx): `src/context/cart-context.tsx`
- [Add to Cart](https://github.com/leonardondev/dev-store/blob/main/src/components/add-to-cart-button.tsx): `src/components/add-to-cart-button.tsx`
- [Cart Widget](https://github.com/leonardondev/dev-store/blob/main/src/components/cart-widget.tsx): `src/components/cart-widget.tsx`

### Data Access

- [API Client](https://github.com/leonardondev/dev-store/blob/main/src/data/api.ts): `src/data/api.ts`
- [API Environment](https://github.com/leonardondev/dev-store/blob/main/src/env.ts): `src/env.ts`
- [Product Types](https://github.com/leonardondev/dev-store/blob/main/src/data/types/products.ts): `src/data/types/products.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Featured Home: browses
- Store Layout → Store Header: renders (evidence: `src/app/(store)/layout.tsx`)
- Store Layout → Cart Provider: provides cart (evidence: `src/app/(store)/layout.tsx`)
- Store Header → Search Form: renders (evidence: `src/components/header.tsx`)
- Store Header → Cart Widget: renders (evidence: `src/components/header.tsx`)
- Featured Home → API Client: requests featured (evidence: `src/app/(store)/(home)/page.tsx`)
- Product Detail → API Client: requests product (evidence: `src/app/(store)/product/[slug]/page.tsx`)
- Search Results → API Client: requests results (evidence: `src/app/(store)/search/page.tsx`)
- API Client → API Environment: reads endpoint (evidence: `src/data/api.ts`)
- API Client → Featured Products: HTTP request
- API Client → Product Lookup: HTTP request
- API Client → Product Search API: HTTP request
- API Client → Product Listing API: HTTP request
- Featured Products → Catalog Data: reads products (evidence: `src/app/api/products/featured/route.ts`)
- Product Lookup → Catalog Data: finds product (evidence: `src/app/api/products/[slug]/route.ts`)
- Product Search API → Catalog Data: filters products (evidence: `src/app/api/products/search/route.ts`)
- Product Listing API → Catalog Data: reads products (evidence: `src/app/api/products/route.ts`)
- Product Detail → Add to Cart: renders (evidence: `src/app/(store)/product/[slug]/page.tsx`)
- Add to Cart → Cart Provider: updates cart (evidence: `src/components/add-to-cart-button.tsx`)
- Cart Widget → Cart Provider: reads cart (evidence: `src/components/cart-widget.tsx`)
- Shopper → Search Form: submits query (evidence: `src/components/search-form.tsx`)
- Search Results → Loading Skeleton: shows loading
- Featured Home → Loading Skeleton: shows loading
