# syedailsa/beaded-wear architecture

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

- Interactive diagram: https://gitdiagram.com/syedailsa/beaded-wear
- Repository: https://github.com/syedailsa/beaded-wear

## Overview

##### Main Components

A. Frontend Layer:
- Next.js Application (Client-Side)
- Pages/Routes Structure
- Components Library
- UI Components
- Context Management (CartContext)

B. Backend Layer:
- Next.js API Routes
- Sanity CMS Integration
- Data Models

C. Database/CMS:
- Sanity.io Studio
- Content Models (Products, Categories, Contact Forms)

##### Client Layer (Top)
- Pages (src/app/*)
- Home
- Products
- Categories
- About
- Contact

##### Component Layer (Middle)
- Layout Components
- Header
- Footer
- Navigation
- Cart
- UI Components
- Buttons
- Forms
- Animations

##### Data & API Layer (Bottom)
- API Routes
- Products API
- Sanity Integration
- Schema Types
- Client Config
- Image Handler

##### Interaction Flows to Highlight

- Client-side navigation flows
- API calls between frontend and backend
- Data flow between Next.js and Sanity
- Cart state management flow
- Image optimization pipeline

##### Technical Stack Indicators

- Next.js
- TypeScript
- Tailwind CSS
- Sanity CMS
- Vercel (deployment)

##### Additional Elements

- Notes about the app's routing structure
- Environment configuration flow
- Static vs. dynamic routes

Remember to:
- Keep components grouped logically
- Clear boundaries between different layers
- Major integration points
- Demonstrate the full request/response cycle
- Project's unique features (like the cart system and CMS integration)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Pages["Pages Layer"]
        HomePage["Home Page"]:::page
        ProductsPage["Products Page"]:::page
        CategoriesPage["Categories Page"]:::page
        AboutPage["About Page"]:::page
        ContactPage["Contact Page"]:::page
        
        Pages --> HomePage
        Pages --> ProductsPage
        Pages --> CategoriesPage
        Pages --> AboutPage
        Pages --> ContactPage
    end

    subgraph Components
        Layout["Layout Components"]
        Header["Header"]:::component
        Footer["Footer"]:::component
        Nav["Navigation"]:::component
        Cart["Cart"]:::component
        
        Layout --> Header
        Layout --> Footer
        Layout --> Nav
        Layout --> Cart
        
        UI["UI Components"]
        Button["Button"]:::ui
        Form["Form"]:::ui
        Input["Input"]:::ui
        Label["Label"]:::ui
        
        UI --> Button
        UI --> Form
        UI --> Input
        UI --> Label
    end

    subgraph State
        CartContext["Cart Context"]:::state
    end

    subgraph "API & Data"
        APIRoutes["API Routes"]
        ProductsAPI["Products API"]:::api
        ProductDetailAPI["Product Detail API"]:::api
        
        APIRoutes --> ProductsAPI
        APIRoutes --> ProductDetailAPI
        
        SanityInt["Sanity Integration"]
        ClientConfig["Client Config"]:::sanity
        ImageHandler["Image Handler"]:::sanity
        Studio["Studio Route"]:::sanity
        
        SanityInt --> ClientConfig
        SanityInt --> ImageHandler
        SanityInt --> Studio
        
        Models["Content Models"]
        ProductSchema["Product Schema"]:::schema
        CategorySchema["Category Schema"]:::schema
        ContactSchema["Contact Form Schema"]:::schema
        
        Models --> ProductSchema
        Models --> CategorySchema
        Models --> ContactSchema
    end

    Config["Configuration"]
    SanityConfig["Sanity Config"]:::config
    NextConfig["Next.js Config"]:::config
    EnvVars["Environment Variables"]:::config
    
    Config --> SanityConfig
    Config --> NextConfig
    Config --> EnvVars

    %% Relationships
    Pages --> Layout
    Layout --> UI
    CartContext --> Cart
    APIRoutes --> SanityInt
    SanityInt --> Models

    %% Click Events
    click HomePage "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/home/page.tsx"
    click ProductsPage "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/products/[slug]/page.tsx"
    click CategoriesPage "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/categories/page.tsx"
    click AboutPage "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/about/page.tsx"
    click ContactPage "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/contact/page.tsx"
    click Header "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/layout/header.tsx"
    click Footer "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/layout/footer.tsx"
    click Nav "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/layout/navItems.tsx"
    click Cart "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/layout/cart.tsx"
    click Button "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/ui/button.tsx"
    click Form "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/ui/form.tsx"
    click Input "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/ui/input.tsx"
    click Label "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/components/ui/label.tsx"
    click CartContext "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/context/CartContext.tsx"
    click ProductsAPI "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/api/products/route.ts"
    click ProductDetailAPI "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/api/products/[slug]/route.ts"
    click ClientConfig "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/lib/client.ts"
    click ImageHandler "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/lib/image.ts"
    click Studio "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/app/studio/[[...tool]]/page.tsx"
    click ProductSchema "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/schemaTypes/product.ts"
    click CategorySchema "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/schemaTypes/category.ts"
    click ContactSchema "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/schemaTypes/contactForm.ts"
    click SanityConfig "https://github.com/Syedailsa/Beaded-Wear/blob/main/sanity.config.ts"
    click NextConfig "https://github.com/Syedailsa/Beaded-Wear/blob/main/next.config.mjs"
    click EnvVars "https://github.com/Syedailsa/Beaded-Wear/blob/main/src/sanity/env.ts"

    %% Styling
    classDef page fill:#2563eb,color:white
    classDef component fill:#3b82f6,color:white
    classDef ui fill:#60a5fa,color:white
    classDef state fill:#7c3aed,color:white
    classDef api fill:#22c55e,color:white
    classDef sanity fill:#f97316,color:white
    classDef schema fill:#fb923c,color:white
    classDef config fill:#6b7280,color:white
```
