# minhphuc010194/numerologywebapp architecture

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

- Interactive diagram: https://gitdiagram.com/minhphuc010194/numerologywebapp
- Repository: https://github.com/minhphuc010194/numerologywebapp

## Overview

##### Project Type and Purpose
- The project is a full-stack web application built using Next.js (as indicated by next.config.js, app/ directory, and tsconfig.json). Its primary purpose is to offer numerological insights – essentially, calculations and interpretations related to numerology, as evidenced by the extensive Functions/Numerology folder.
- The application also includes components for user interaction (e.g., a chat API endpoint and mailing functionality) and features a rich, component-based UI (Components folder) that reflects modern React practices.

##### Analyzing the File Structure to Identify Architecture Components
- Frontend/UI Layer:
- The Components directory houses various UI elements (CustomCard, Donate, FeedBack, Footer, Header, InputDate, Layout, and Numerology-specific components).
- The app directory contains page files (e.g., app/chat/page.tsx, app/page.tsx) and a global layout, which set up the user interface and page structure.
- Styles and public assets (images, CSS files) further support the visual aspect of the application.
- Business Logic Layer:
- The Functions directory contains numerous numerology calculation functions (getBalance, getMissingNumbers, getMission, etc.) that indicate the core business logic for numerology processing.
- The Hooks directory (including useProcessNumerology) suggests client-side logic that encapsulates stateful behavior and potentially interacts with these business functions.
- Utilities (Utils/constraints.ts, themes.ts, types.ts) supply shared constants, theme definitions, and TypeScript types to ensure consistency.
- API / Backend Layer:
- The app/api directory defines server-side endpoints like /chat and /mailer. These endpoints likely facilitate external communications, such as interacting with a chat service or sending emails.
- Configuration and Tooling:
- Files like .env.local, next.config.js, package.json, and the presence of GitHub configurations and pre-commit hooks detail the supporting infrastructure for deployment, testing, and continuous integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Header("Header"):::presentation
        Footer("Footer"):::presentation
        Layout("Layout"):::presentation
        CustomCard("CustomCard"):::presentation
        NumerologyComponents("Numerology Components"):::presentation
        AppPage("Home Page"):::presentation
        ChatPage("Chat Page"):::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        ProcessHook("useProcessNumerology Hook"):::business
        HooksIndex("Hooks Index"):::business
        NumerologyFunctions("Numerology Functions"):::business
        SharedUtilities("Shared Utilities"):::business
        RemoveAccents("removeAccents"):::business
    end

    %% API / Integration Layer
    subgraph "API / Integration Layer"
        ChatAPI("Chat API Endpoint"):::api
        MailerAPI("Mailer API Endpoint"):::api
    end

    %% Infrastructure and Configuration
    subgraph "Infrastructure Layer"
        NextConfig("next.config.js"):::infra
        EnvLocal(".env.local"):::infra
        PackageJSON("package.json"):::infra
        DevTools("Dev Tools (.github, .husky, .vscode)"):::infra
    end

    %% Connections between Layers
    AppPage -->|"triggers"| ProcessHook
    ProcessHook -->|"calls"| NumerologyFunctions
    NumerologyFunctions -->|"returns"| AppPage
    NumerologyFunctions -->|"uses"| SharedUtilities
    ProcessHook -->|"uses"| SharedUtilities

    %% UI Components interconnected (representing component tree)
    CustomCard --> AppPage
    Header --> AppPage
    Footer --> AppPage
    Layout --> AppPage
    NumerologyComponents --> AppPage

    %% API interactions from UI
    AppPage -->|"sendsRequest"| ChatAPI
    AppPage -->|"sendsRequest"| MailerAPI
    ChatPage -->|"sendsRequest"| ChatAPI
    ChatPage -->|"sendsRequest"| MailerAPI

    %% Infrastructure influence arrows (dashed for configuration dependencies)
    NextConfig ---|"configures"| AppPage
    EnvLocal ---|"configures"| ProcessHook
    PackageJSON ---|"builds"| ProcessHook
    DevTools ---|"manages"| Layout

    %% Styles for each layer
    classDef presentation fill:#F7DAD9,stroke:#AD3E2B,stroke-width:2px;
    classDef business fill:#D9F7DA,stroke:#2BAD3E,stroke-width:2px;
    classDef api fill:#D9E6F7,stroke:#2B3EAD,stroke-width:2px;
    classDef infra fill:#FFF2CC,stroke:#AD8B2B,stroke-width:2px;

    %% Click Events for UI Components
    click Header "https://github.com/minhphuc010194/numerologywebapp/blob/main/Components/Header.tsx"
    click Footer "https://github.com/minhphuc010194/numerologywebapp/blob/main/Components/Footer.tsx"
    click Layout "https://github.com/minhphuc010194/numerologywebapp/blob/main/Components/Layout.tsx"
    click CustomCard "https://github.com/minhphuc010194/numerologywebapp/blob/main/Components/CustomCard.tsx"
    click NumerologyComponents "https://github.com/minhphuc010194/numerologywebapp/tree/main/Components/Numerology"
    click AppPage "https://github.com/minhphuc010194/numerologywebapp/blob/main/app/page.tsx"
    click ChatPage "https://github.com/minhphuc010194/numerologywebapp/blob/main/app/chat/page.tsx"

    %% Click Events for Business Logic Components
    click ProcessHook "https://github.com/minhphuc010194/numerologywebapp/blob/main/Hooks/useProcessNumerology.tsx"
    click HooksIndex "https://github.com/minhphuc010194/numerologywebapp/blob/main/Hooks/index.ts"
    click NumerologyFunctions "https://github.com/minhphuc010194/numerologywebapp/tree/main/Functions/Numerology"
    click SharedUtilities "https://github.com/minhphuc010194/numerologywebapp/tree/main/Utils"
    click RemoveAccents "https://github.com/minhphuc010194/numerologywebapp/blob/main/Functions/removeAccents.ts"

    %% Click Events for API Endpoints
    click ChatAPI "https://github.com/minhphuc010194/numerologywebapp/blob/main/app/api/chat/route.ts"
    click MailerAPI "https://github.com/minhphuc010194/numerologywebapp/blob/main/app/api/mailer/route.ts"

    %% Click Events for Infrastructure
    click NextConfig "https://github.com/minhphuc010194/numerologywebapp/blob/main/next.config.js"
    click EnvLocal "https://github.com/minhphuc010194/numerologywebapp/blob/main/.env.local"
    click PackageJSON "https://github.com/minhphuc010194/numerologywebapp/blob/main/package.json"
    click DevTools "https://github.com/minhphuc010194/numerologywebapp/blob/main/.github"
```
