# stclab-inc/nf4-demo architecture

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

- Interactive diagram: https://gitdiagram.com/stclab-inc/nf4-demo
- Repository: https://github.com/stclab-inc/nf4-demo

## Overview

##### Main Components

a. Client-Side Architecture:
- Next.js Application (App Router)
- NetFunnel Agent Integration
- Page Components Structure
- Client-Side Routing System

**┌─ Next.js Application ─────────────────────┐**

- ┌─ Pages & Routing ──────────────────┐  │
- Install Route                    │  │
- Segment Routes (Dynamic/Static)  │  │
- Target Pages                     │  │
- ┘ │

- ┌─ Components ─────────────────────┐    │
- GNB (Global Navigation)        │    │
- InitializeNFScript            │    │
- ┘      │

- ┌─ NetFunnel Integration ──────────┐    │
- Agent Configuration            │    │
- Queue Management               │    │
- ┘      │
- ┘

##### Key Relationships to Highlight

a. Route Structure:
- Hierarchical relationship between routes:
- Main routes (/install, /segment)
- Sub-routes (static/dynamic segments)
- Target pages

b. Component Integration:
- How InitializeNFScript component interfaces with the NetFunnel system
- GNB component's relationship with the routing system

##### Additional Elements

a. Configuration Layer:
- next.config.ts settings
- TypeScript configuration (tsconfig.json)
- Global types (global.d.ts)

b. Static Assets:
- Public directory structure
- Style modules organization

##### Implementation Notes

- Version information and date of last update
- Creating separate views for different levels of detail

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph NextApp["Next.js Application"]
        direction TB
        
        subgraph Config["Configuration Layer"]
            direction TB
            NextConfig["Next.js Config"]:::config
            TSConfig["TypeScript Config"]:::config
            GlobalTypes["Global Types"]:::config
        end

        subgraph Layout["Layout Structure"]
            direction TB
            RootLayout["Root Layout"]:::layout
            RootPage["Root Page"]:::layout
        end

        subgraph Components["Core Components"]
            direction TB
            GNB["Global Navigation"]:::component
            NFInit["InitializeNFScript"]:::component
        end

        subgraph Routes["Routes & Pages"]
            direction TB
            Install["Install Route"]:::route
            
            subgraph SegmentRoutes["Segment Routes"]
                direction TB
                SegmentBase["Segment Base"]:::route
                
                subgraph Dynamic["Dynamic"]
                    direction TB
                    DynamicSegment["Dynamic Segment"]:::route
                    DynamicTarget["Dynamic Target"]:::route
                end
                
                subgraph Static["Static"]
                    direction TB
                    StaticSegment["Static Segment"]:::route
                    StaticBasicTarget["Static Basic Target"]:::route
                    StaticSectionTarget["Static Section Target"]:::route
                end
            end
        end

        subgraph Assets["Static Assets"]
            direction TB
            Styles["Styles"]:::asset
            PublicDir["Public Directory"]:::asset
        end
    end

    %% Relationships
    RootLayout --> GNB
    RootLayout --> NFInit
    RootLayout --> RootPage
    SegmentBase --> DynamicSegment
    SegmentBase --> StaticSegment
    DynamicSegment --> DynamicTarget
    StaticSegment --> StaticBasicTarget
    StaticSegment --> StaticSectionTarget

    %% Click Events
    click NextConfig "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/next.config.ts"
    click TSConfig "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/tsconfig.json"
    click GlobalTypes "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/global.d.ts"
    click RootLayout "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/layout.tsx"
    click RootPage "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/page.tsx"
    click GNB "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/components/GNB.tsx"
    click NFInit "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/components/InitializeNFScript.tsx"
    click Install "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/install/page.tsx"
    click SegmentBase "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/page.tsx"
    click DynamicSegment "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/dynamic/page.tsx"
    click StaticSegment "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/static/page.tsx"
    click DynamicTarget "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/dynamic/target/page.tsx"
    click StaticBasicTarget "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/static/basic/target/page.tsx"
    click StaticSectionTarget "https://github.com/STCLab-Inc/NF4-demo/blob/main/client/next-app/src/app/segment/static/section/target/page.tsx"
    click Styles "https://github.com/STCLab-Inc/NF4-demo/tree/main/client/next-app/src/styles"
    click PublicDir "https://github.com/STCLab-Inc/NF4-demo/tree/main/client/next-app/public/images"

    %% Styles
    classDef config fill:#f9f,stroke:#333
    classDef layout fill:#ffd700,stroke:#333
    classDef component fill:#90EE90,stroke:#333
    classDef route fill:#87CEEB,stroke:#333
    classDef asset fill:#D3D3D3,stroke:#333

    %% Legend
    subgraph Legend
        direction TB
        ConfigL["Configuration"]:::config
        LayoutL["Layout"]:::layout
        ComponentL["Component"]:::component
        RouteL["Route"]:::route
        AssetL["Asset"]:::asset
    end
```
