# aksel26/intranet-v2-user architecture

> Architecture diagram of the GitHub repository aksel26/intranet-v2-user, 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/aksel26/intranet-v2-user
- Repository: https://github.com/aksel26/intranet-v2-user

## Overview

##### Main System Components

a) Client-Side (Frontend):
- Auth Layer (from src/app/(auth))
- Content Layer (from src/app/(content))
- Global Components (from src/components/Global)
- API Integration Layer (from src/app/api)

b) Feature Modules:
- Attendance Management
- Welfare Management
- Notice System
- Survey System
- Meal Management
- User Management

##### Architectural Patterns

Following architectural patterns:
- Next.js App Router Structure (using nested rectangles)
- Client-Side State Management (using Zustand, as evident from src/lib/store)
- API Integration Layer (showing GET/POST operations)

##### Data Flow Representation

- User Authentication Flow
- API Request/Response Patterns
- State Management Flow
- Component Hierarchy

##### Specific Implementation Details

- Custom Hooks Layer (from src/hooks)
- Utility Functions (from src/utils)
- Type Definitions (from src/lib/types)
- Global Stores (from src/lib/store)

##### Component Relationships

Relationships between:
- Pages and their corresponding components
- Global state and consuming components
- API endpoints and their consumers
- Auth layer and protected routes

##### Technical Stack Indicators

- Next.js
- TypeScript
- Tailwind CSS
- Zustand (State Management)

**┌─ Presentation Layer ─────────────────────┐**
- Components | Pages | Layouts             │
- Feature Modules ──────────────────────┐ │
- Attendance | Welfare | Notice | etc.   │ │
- State Management ────────────────────┐│ │
- Zustand Stores                       ││ │
- API Integration ───────────────────┐│││
- GET/POST APIs                      ││││
- Utilities & Helpers ─────────────┐││││
- Utils | Hooks | Types            │││││
- ┘└└└└┘

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NextFrontend["Next.js Frontend"]
        
        subgraph AuthLayer["Authentication Layer"]
            Login["Login Page"]:::auth
            AuthComp["Auth Components"]:::auth
        end

        subgraph ContentLayer["Content Layer"]
            MainLayout["Main Layout"]:::content
            Dashboard["Dashboard"]:::content
        end

        subgraph FeatureModules["Feature Modules"]
            direction TB
            
            AttendanceModule["Attendance Management"]:::feature
            WelfareModule["Welfare Management"]:::feature
            NoticeModule["Notice System"]:::feature
            SurveyModule["Survey System"]:::feature
            MealModule["Meal Management"]:::feature
        end

        subgraph Components["Global Components"]
            GlobalContainer["Global Container"]:::component
            Navigation["Navigation"]:::component
        end

        subgraph StateManagement["State Management"]
            CombinedStore["Combined Store"]:::state
            ActivityStore["Activity Store"]:::state
            MealStore["Meal Store"]:::state
            WelfareStore["Welfare Store"]:::state
        end

        subgraph Integration["API Integration"]
            APIClient["API Client"]:::api
            GetOps["GET Operations"]:::api
            PostOps["POST Operations"]:::api
        end

        subgraph Utils["Utilities & Helpers"]
            CustomHooks["Custom Hooks"]:::util
            DateUtils["Date Utilities"]:::util
            CalendarUtils["Calendar Utilities"]:::util
            ValidationUtils["Validation Utils"]:::util
        end

        subgraph Types["Type Definitions"]
            ActivityTypes["Activity Types"]:::type
            MealTypes["Meal Types"]:::type
            WelfareTypes["Welfare Types"]:::type
        end
    end

    %% Relationships
    Login --> MainLayout
    AuthComp --> Login
    MainLayout --> Dashboard
    Dashboard --> FeatureModules
    
    CombinedStore --> ActivityStore
    CombinedStore --> MealStore
    CombinedStore --> WelfareStore
    
    Integration --> FeatureModules
    APIClient --> GetOps
    APIClient --> PostOps
    
    FeatureModules --> StateManagement
    FeatureModules --> Integration
    
    Utils --> FeatureModules
    Types --> FeatureModules

    %% Styling
    classDef auth fill:#e6f3ff,stroke:#4a90e2
    classDef content fill:#f5f5f5,stroke:#333
    classDef feature fill:#e6ffe6,stroke:#2ecc71
    classDef component fill:#fff3e6,stroke:#f39c12
    classDef state fill:#ffe6f3,stroke:#e91e63
    classDef api fill:#e6e6ff,stroke:#3498db
    classDef util fill:#fff7e6,stroke:#f1c40f
    classDef type fill:#f2f2f2,stroke:#95a5a6

    %% Click Events
    click Login "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(auth)/login"
    click AuthComp "https://github.com/aksel26/Intranet-v2-user/tree/main/src/components/login"
    click MainLayout "https://github.com/aksel26/Intranet-v2-user/blob/main/src/app/(content)/layout.tsx"
    click Dashboard "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/main"
    click AttendanceModule "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/attendance"
    click WelfareModule "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/welfare"
    click NoticeModule "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/notice"
    click SurveyModule "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/survey"
    click MealModule "https://github.com/aksel26/Intranet-v2-user/tree/main/src/app/(content)/welfare/meal"
    click APIClient "https://github.com/aksel26/Intranet-v2-user/blob/main/src/app/api/clientConfig.ts"
    click GetOps "https://github.com/aksel26/Intranet-v2-user/blob/main/src/app/api/get/getApi.ts"
    click PostOps "https://github.com/aksel26/Intranet-v2-user/blob/main/src/app/api/post/postApi.ts"
    click GlobalContainer "https://github.com/aksel26/Intranet-v2-user/blob/main/src/components/Global/GlobalContainer.tsx"
    click Navigation "https://github.com/aksel26/Intranet-v2-user/tree/main/src/components/GNB"
    click CombinedStore "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/store/CombinedStore.ts"
    click ActivityStore "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/store/activityStore.ts"
    click MealStore "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/store/mealStore.ts"
    click WelfareStore "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/store/welfareStore.ts"
    click CustomHooks "https://github.com/aksel26/Intranet-v2-user/tree/main/src/hooks"
    click DateUtils "https://github.com/aksel26/Intranet-v2-user/blob/main/src/utils/dateFomat.ts"
    click CalendarUtils "https://github.com/aksel26/Intranet-v2-user/blob/main/src/utils/calendarFetch.ts"
    click ValidationUtils "https://github.com/aksel26/Intranet-v2-user/blob/main/src/utils/checkOutTimeValidation.ts"
    click ActivityTypes "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/types/activity.ts"
    click MealTypes "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/types/meal.ts"
    click WelfareTypes "https://github.com/aksel26/Intranet-v2-user/blob/main/src/lib/types/welfare.ts"
```
