# bebejane/humaneight architecture

> Architecture diagram of the GitHub repository bebejane/humaneight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bebejane/humaneight
- Repository: https://github.com/bebejane/humaneight

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js Application (Core)
- Client-Side Components
- Server-Side Components
- Route Handlers

b) Integration Layer:
- Shopify Integration
- DatoCMS Integration

c) API Layer:
- REST Endpoints
- GraphQL Endpoints

##### Detailed Component Breakdown

a) Frontend Architecture:
- Pages & Routes (show the dynamic routing structure with [country] and other parameters)
- Components (organize into categories):
- Common Components
- Layout Components
- Navigation Components
- Shop Components
- Form Components

b) Data Flow Layer:
- Client-side Hooks
- Server Actions
- API Routes

c) Integration Services:
- Shopify Services:
- Cart Management
- Product Management
- Customer Management
- Order Management
- DatoCMS Services:
- Content Management
- Asset Management
- Draft/Preview System

##### Key Architectural Patterns to Highlight

- Separation between:
- Server-side and client-side components
- API routes and server actions
- Content management and e-commerce functionality

##### Specific Implementation Details

Important aspects:

a) Authentication Flow:
- Customer authentication process
- Secure routes and public routes

b) Data Synchronization:
- Sync mechanisms between Shopify and DatoCMS
- Revalidation paths

c) Shopping Experience:
- Cart management flow
- Checkout process
- Product browsing and filtering

##### Infrastructure Layer

Elements:

- Vercel deployment
- Edge functions
- API endpoints
- Content delivery network

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NextApp[Next.js Application]
        ClientComp[Client Components]
        ServerComp[Server Components]
        RouteHandlers[Route Handlers]
    end

    subgraph Integration
        ShopifyInt[Shopify Integration]:::shopify
        DatoCMSInt[DatoCMS Integration]:::datocms
    end

    subgraph API
        RestAPI[REST Endpoints]:::api
        GraphQLAPI[GraphQL Endpoints]:::graphql
    end

    subgraph Components
        CoreComps[Common Components]:::component
        LayoutComps[Layout Components]:::component
        NavComps[Navigation Components]:::component
        ShopComps[Shop Components]:::component
        FormComps[Form Components]:::component
        ContentBlocks[Content Blocks]:::component
    end

    subgraph ShopifyServices
        CartMgmt[Cart Management]:::shopify
        ProductMgmt[Product Management]:::shopify
        CustomerMgmt[Customer Management]:::shopify
        OrderMgmt[Order Management]:::shopify
    end

    subgraph DatoCMSServices
        ContentMgmt[Content Management]:::datocms
        AssetMgmt[Asset Management]:::datocms
        PreviewSystem[Draft/Preview System]:::datocms
    end

    subgraph Infrastructure
        Vercel[Vercel Deployment]
        EdgeFuncs[Edge Functions]
        CDN[Content Delivery Network]
    end

    subgraph Auth
        AuthFlow[Authentication Flow]:::auth
        SecureRoutes[Secure Routes]:::auth
        PublicRoutes[Public Routes]:::auth
    end

    %% Connections
    NextApp --> ClientComp
    NextApp --> ServerComp
    NextApp --> RouteHandlers
    
    ShopifyInt --> CartMgmt
    ShopifyInt --> ProductMgmt
    ShopifyInt --> CustomerMgmt
    ShopifyInt --> OrderMgmt
    
    DatoCMSInt --> ContentMgmt
    DatoCMSInt --> AssetMgmt
    DatoCMSInt --> PreviewSystem
    
    AuthFlow --> SecureRoutes
    AuthFlow --> PublicRoutes

    %% Click events
    click DatoCMSInt "https://github.com/bebejane/humaneight/tree/main/app/(datocms)"
    click ShopifyInt "https://github.com/bebejane/humaneight/tree/main/shopify"
    click CartMgmt "https://github.com/bebejane/humaneight/tree/main/app/(shopify)/api/cart"
    click ProductMgmt "https://github.com/bebejane/humaneight/tree/main/app/products/[product]"
    click CoreComps "https://github.com/bebejane/humaneight/tree/main/components/common"
    click LayoutComps "https://github.com/bebejane/humaneight/tree/main/components/layout"
    click NavComps "https://github.com/bebejane/humaneight/tree/main/components/nav"
    click FormComps "https://github.com/bebejane/humaneight/tree/main/components/forms"
    click GraphQLAPI "https://github.com/bebejane/humaneight/tree/main/graphql"
    click ContentBlocks "https://github.com/bebejane/humaneight/tree/main/components/content/blocks"
    click AuthFlow "https://github.com/bebejane/humaneight/tree/main/shopify/route-handlers/account"
    click RestAPI "https://github.com/bebejane/humaneight/tree/main/app/(datocms)/api"

    %% Styling
    classDef shopify fill:#90EE90
    classDef datocms fill:#DDA0DD
    classDef api fill:#FFA500
    classDef auth fill:#FFD700
    classDef component fill:#ADD8E6
    classDef graphql fill:#FF69B4

    %% Legend
    subgraph Legend
        L1[Next.js Components]:::component
        L2[Shopify Integration]:::shopify
        L3[DatoCMS Integration]:::datocms
        L4[API Endpoints]:::api
        L5[Authentication]:::auth
        L6[GraphQL]:::graphql
    end
```
