# tushgaurav/nodebench-site architecture

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

- Interactive diagram: https://gitdiagram.com/tushgaurav/nodebench-site
- Repository: https://github.com/tushgaurav/nodebench-site

## Overview

##### Main Components

a. Frontend Layer:
- Next.js App Router (app/ directory structure)
- UI Components (components/ directory)
- MDX Content (for reviews)
- Client-side State Management
- PostHog Analytics Integration

b. Server Layer:
- Next.js API Routes (/api directory)
- Server Components
- Database Integration Layer

c. Database Layer:
- Drizzle ORM connection
- Database schema (from db/schema.ts)

d. External Services:
- PostHog Analytics
- Image Storage/CDN (for public/images)

##### Relationships and Data Flow

- Client-Server communication via API routes
- Server-Database interactions
- Analytics data flow to PostHog
- Static/Dynamic content serving paths

##### Architectural Patterns to Highlight

a. Next.js App Router Structure:
- Route grouping ((app) folder)
- Parallel routes for different sections
- Layout hierarchy

b. Component Organization:
- Shared components
- Page-specific components
- UI component library

##### Implementation Details to Note

- Separation of concerns between:
- UI components (components/)
- Business logic (lib/)
- API routes (app/api/)
- Database operations (db/)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Side"]
        direction TB
        AppRouter["Next.js App Router"]
        
        subgraph UILayer["UI Components Layer"]
            SharedComp["Shared Components"]
            PageComp["Page Components"]
            Forms["Form Components"]
        end
        
        subgraph MDXSystem["MDX Content System"]
            Reviews["Review Content"]
            Benchmarks["Benchmark Content"]
        end
        
        subgraph ClientState["Client-side State"]
            LocalStorage["Local Storage"]
            StateManagement["State Management"]
            Cache["Client Cache"]
        end
        
        subgraph ClientAnalytics["Analytics Layer"]
            EventTracking["Event Tracking"]
            UserMetrics["User Metrics"]
            Performance["Performance Monitoring"]
        end
        
        subgraph StaticAssets["Static Assets"]
            Images["Image Assets"]
            Styles["CSS/Tailwind"]
            PublicFiles["Public Files"]
        end
    end

    %% Internal Client Relationships
    AppRouter --> UILayer
    AppRouter --> MDXSystem
    AppRouter --> ClientState
    UILayer --> SharedComp
    UILayer --> PageComp
    UILayer --> Forms
    MDXSystem --> Reviews
    MDXSystem --> Benchmarks
    ClientState --> LocalStorage
    ClientState --> StateManagement
    ClientState --> Cache
    ClientAnalytics --> EventTracking
    ClientAnalytics --> UserMetrics
    ClientAnalytics --> Performance
    StaticAssets --> Images
    StaticAssets --> Styles
    StaticAssets --> PublicFiles

    %% Styling
    classDef frontend fill:#3b82f6,color:white
    classDef component fill:#60a5fa,color:white
    classDef content fill:#93c5fd,color:white
    classDef state fill:#2563eb,color:white
    classDef assets fill:#1d4ed8,color:white

    class Client,AppRouter frontend
    class UILayer,SharedComp,PageComp,Forms component
    class MDXSystem,Reviews,Benchmarks content
    class ClientState,LocalStorage,StateManagement,Cache state
    class StaticAssets,Images,Styles,PublicFiles assets
    class ClientAnalytics,EventTracking,UserMetrics,Performance state

    %% Click Events
    click AppRouter "https://github.com/tushgaurav/nodebench-site/tree/main/app/(app)/"
    click UILayer "https://github.com/tushgaurav/nodebench-site/tree/main/components/ui/"
    click MDXSystem "https://github.com/tushgaurav/nodebench-site/tree/main/app/(app)/review/"
    click StaticAssets "https://github.com/tushgaurav/nodebench-site/tree/main/public/"
    click ClientAnalytics "https://github.com/tushgaurav/nodebench-site/blob/main/app/posthog.ts"

    %% Legend
    subgraph Legend
        direction TB
        L1[Frontend]:::frontend
        L2[Components]:::component
        L3[Content]:::content
        L4[State]:::state
        L5[Assets]:::assets
    end
```
