# isd-sgcu/oph-67-frontend architecture

> Architecture diagram of the GitHub repository isd-sgcu/oph-67-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/isd-sgcu/oph-67-frontend
- Repository: https://github.com/isd-sgcu/oph-67-frontend

## Overview

##### Main Components
- UI (Presentation) Layer:
- Next.js “app” directory structures: Notice the segregation into (admin) and (app) directories. The admin section includes routes like profile, role, and QR-code scanning, while the app section provides pages for faculties, events, registers, workshops, etc.
- Public Assets and Fonts: The “public” directory holds images and fonts that the UI consumes.
- Business Logic / Actions Layer:
- The “src/app/actions” folder clearly defines business functions such as authentication, profile editing, login, register, and more. These actions likely coordinate with external backend APIs (even if not directly part of this frontend repo).
- Integration Layer:
- The “src/lib/liff” files and the “components/liff” folder imply integration with the LIFF framework, enabling authentication or additional linking with external services (possibly related to the LINE ecosystem).
- Configuration & Utility Layer:
- Configuration files like next.config.ts, tailwind.config.ts, tsconfig.json, and various utility files in “src/utils” provide essential support, styling, and type-checks.
- Data Handling:
- The “data” folder holds an Excel file and a script to extract data. Even though minor, it indicates some pre-processing to be used within the app.

##### Relationships and Interactions
- Next.js routing orchestrates rendering layouts and pages. Show the flow from the global layout (src/app/layout.tsx) to individual route groups ((admin) and (app)).
- Data flow goes from public assets and constants (in “src/const”) into UI components. Similarly, configuration files (next.config.ts, tailwind.config.ts) influence the entire system behavior.

##### Architectural Patterns
- The use of a modularized folder structure is typical of modern Next.js applications following the App Router approach. Note the separation between presentation (pages, components) and business logic (actions).

##### Relevant Technologies and Frameworks
- Next.js for application routing and rendering.
- TypeScript for type safety.
- Tailwind CSS (configured in tailwind.config.ts) for styling.
- ESLint, Prettier, Husky, and Conventional Commits for code quality and developer workflows.
- LIFF for integrating with LINE services.
- Node.js and pnpm for the runtime and package management.

##### Elements
- UI components to actions (user interactions triggering business logic).
- Actions calling external APIs or interacting with helper modules.
- Global layout components passing data to sub-pages.
- LIFF modules interfacing between external services and your application.
- Pages (e.g., rounded rectangles),
- Components (e.g., squares),

##### Putting It All Together
- Top-level layout divided into “(admin)” and “(app)” branches.
- UI components connected with their respective pages.
- Link the “actions” with utility libraries (under “lib”, “hooks”, “utils”) which assist in data validation, date manipulation, etc.
- External integrations (such as LIFF) outside the core but with connections to both the UI and the business logic.
- Finally, include configuration nodes (like next.config.ts and tailwind.config.ts) and static resources (from /public and /data) on the periphery or as supporting systems.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        A1["Admin Pages (Next.js)"]:::page
        A2["End-User Pages (Next.js)"]:::page
        U1["Reusable UI Components"]:::component
        P1["Public Assets & Fonts"]:::asset
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        BL["Business Logic / Actions"]:::action
    end

    %% Integration Layer
    subgraph "Integration"
        LIFF_Lib["LIFF Lib"]:::integration
        LIFF_UI["LIFF Components"]:::integration
    end

    %% Configuration and Utility Layer
    subgraph "Configuration & Utilities"
        CONF["Configuration Files"]:::config
        UTIL["Utility Modules"]:::util
    end

    %% Data Handling
    D["Data Handling"]:::data

    %% Relationships
    A1 -->|"triggers"| U1
    A2 -->|"triggers"| U1
    U1 -->|"calls"| BL
    BL -->|"uses"| UTIL
    BL -->|"integrates"| LIFF_Lib
    LIFF_UI -->|"supports"| U1
    LIFF_Lib -->|"supports"| BL
    CONF -->|"configures"| U1
    CONF -->|"configures"| BL
    UTIL -->|"supports"| U1
    UTIL -->|"supports"| BL
    P1 -->|"assetsFor"| U1
    D  -->|"dataFeeds"| U1

    %% Click Events
    click A1 "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/app/(admin)"
    click A2 "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/app/(app)"
    click U1 "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/components"
    click P1 "https://github.com/isd-sgcu/oph-67-frontend/tree/main/public"
    click BL "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/app/actions"
    click LIFF_Lib "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/lib/liff"
    click LIFF_UI "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/components/liff"
    click CONF "https://github.com/isd-sgcu/oph-67-frontend/blob/main/next.config.ts"
    click UTIL "https://github.com/isd-sgcu/oph-67-frontend/tree/main/src/utils"
    click D "https://github.com/isd-sgcu/oph-67-frontend/tree/main/data"

    %% Styles
    classDef page fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef component fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef asset fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef action fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef integration fill:#d1ecf1,stroke:#333,stroke-width:2px;
    classDef config fill:#e2e3e5,stroke:#333,stroke-width:2px;
    classDef util fill:#fefefe,stroke:#333,stroke-width:2px;
    classDef data fill:#f0f0f0,stroke:#333,stroke-width:2px;
```
