# chmpy/chmpy-dot-com architecture

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

- Interactive diagram: https://gitdiagram.com/chmpy/chmpy-dot-com
- Repository: https://github.com/chmpy/chmpy-dot-com

## Overview

##### Project Type and Purpose
- The project appears to be a modern, component-based website built using Astro (as indicated by astro.config.mjs and *.astro files) with TypeScript (.ts, .tsx) and Tailwind CSS (tailwind.config.mjs, postcss.config.cjs).
- The purpose is to deliver a personal or portfolio website (“Chmpy Dot Com”) with sections like About, Contact, Hero, Footer, and Header.

##### Analyzing the File Structure
- Top-level directories/files include configuration files (astro.config.mjs, tailwind.config.mjs, tsconfig.json, package.json) that define the build and development environment.
- The src directory is subdivided into:
- components: Contains UI components organized into subdirectories (about, contact, footer, header, hero, nav, ui). These represent discrete widgets and UI parts.
- layouts: Contains overall page layout components.
- pages: Contains the entry points (about.astro, contact.astro, index.astro) which correspond to different website routes.
- lib and utils: Provide utility functions and abstraction layers.
- styles: Contains global style definitions.
- This organization follows a modular design where UI elements are encapsulated in reusable components.

##### Insights from the README
- Though the README is minimal, the project name indicates that the site likely represents an online portfolio or personal website.
- Absence of backend-specific directories (like “server” or “api”) emphasizes a front-end focused, possibly static site or JAMstack architecture.

a. Main Components:
- Frontend Framework: Astro for component-based page rendering.
- Pages/Routes: index.astro, about.astro, contact.astro represent main pages.
- Layouts: The universal layout(s) found in src/layouts/Layout.astro ensuring consistent structure.
- UI Components: Divided into groups such as Header (with subcomponents like ModeToggle, Terminal, TerminalButton), Footer, Navigation (src/components/nav/NavigationBar.tsx), Hero, About, Contact (including form handling and notifications) and various UI helper components in src/components/ui.
- Utility Libraries: src/lib and src/utils provide helper functions.

b. Relationships and Interactions:
- The Pages layer uses Layout components to embed and arrange the individual UI components.
- Navigation is a key connector, allowing users to jump between the different sections (Home, About, Contact).
- The Header and Footer are shared across multiple pages, ensuring a consistent global experience.
- Components communicate mainly through props and possibly shared state or context definitions (if used within Astro).
- Utility functions in src/lib/utils.ts and src/utils/cn.ts provide shared logic and CSS class manipulation across components.

c. Architectural Patterns and Design Principles:
- Component-based architecture: Emphasize reusability and encapsulation.
- Separation of concerns: Differentiation between layout, page content, UI interaction, and styling.
- Static site generation / JAMstack principles if dynamic content is not fetched at runtime (not evident from file tree).
- Consistent naming conventions and directory structures indicate a well-organized codebase that leverages both Astro’s and React/TypeScript’s component paradigms.

d. Relevant Technologies:
- Astro as the primary framework.
- React/TypeScript for building interactive components (e.g., .tsx files).
- Tailwind CSS/PostCSS for styling.
- Possibly additional npm packages as seen in package.json.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Pages Layer
    subgraph "Pages Layer"
        HP("Home Page"):::pages
        AP("About Page"):::pages
        CP("Contact Page"):::pages
    end

    %% Layout & UI Components Layer
    subgraph "Layout & UI Components Layer"
        UL("Universal Layout"):::layout
        H("Header"):::layout
        NB("Navigation Bar"):::layout
        HS("Hero Section"):::layout
        AS("About Section"):::layout
        CS("Contact Section"):::layout
        F("Footer"):::layout
        UI("UI/Helper Components"):::layout

        %% Header Subcomponents
        subgraph "Header Subcomponents"
            MT("ModeToggle"):::layout
            T("Terminal"):::layout
            TB("TerminalButton"):::layout
        end

        %% Hero Subcomponents
        subgraph "Hero Subcomponents"
            HComp("Hero"):::layout
            Title("Title"):::layout
        end

        %% About Subcomponents
        subgraph "About Subcomponents"
            AM("About Me"):::layout
            CL("Command List"):::layout
            EL("Edu List"):::layout
            Exp("Experience"):::layout
            S("Skills"):::layout
            WI("Who Am I"):::layout
        end

        %% Contact Subcomponents
        subgraph "Contact Subcomponents"
            CD("Contact Display"):::layout
            CF("Contact Form"):::layout
            NP("Notification Popup"):::layout
        end
    end

    %% Utility Layer
    subgraph "Utility Layer"
        SU("Shared Utils"):::utility
        CH("CSS Helper"):::utility
    end

    %% Configuration Layer
    subgraph "Configuration Layer"
        AC("Astro Config"):::config
        TC("TS Config"):::config
        PF("Package Files"):::config
        TPC("Tailwind & PostCSS"):::config
        GS("Global Styles"):::config
        PA("Static Assets"):::config
    end

    %% Connections between Layers
    %% Pages use the Universal Layout
    HP -->|"uses"| UL
    AP -->|"uses"| UL
    CP -->|"uses"| UL

    %% Universal Layout composes UI components
    UL -->|"includes"| H
    UL -->|"includes"| NB
    UL -->|"includes"| HS
    UL -->|"includes"| AS
    UL -->|"includes"| CS
    UL -->|"includes"| F
    UL -->|"includes"| UI

    %% Header composition
    H -->|"comprises"| MT
    H -->|"comprises"| T
    H -->|"comprises"| TB

    %% Hero Section composition
    HS -->|"contains"| HComp
    HS -->|"contains"| Title

    %% About Section composition
    AS -->|"contains"| AM
    AS -->|"contains"| CL
    AS -->|"contains"| EL
    AS -->|"contains"| Exp
    AS -->|"contains"| S
    AS -->|"contains"| WI

    %% Contact Section composition
    CS -->|"contains"| CD
    CS -->|"contains"| CF
    CS -->|"contains"| NP

    %% Layout utilizes utility functions
    UL ---|"uses"| SU
    UL ---|"uses"| CH

    %% Styling and static asset relationship (configuration supports overall project)
    SU ---|"configured_by"| AC
    CH ---|"configured_by"| TC
    PF ---|"provides"| UL
    TPC ---|"provides"| UL
    GS ---|"styles"| UL
    PA ---|"assets_for"| UL

    %% Click Events for Pages/Routes
    click HP "https://github.com/chmpy/chmpy-dot-com/blob/main/src/pages/index.astro"
    click AP "https://github.com/chmpy/chmpy-dot-com/blob/main/src/pages/about.astro"
    click CP "https://github.com/chmpy/chmpy-dot-com/blob/main/src/pages/contact.astro"

    %% Click Events for Layout Component
    click UL "https://github.com/chmpy/chmpy-dot-com/blob/main/src/layouts/Layout.astro"

    %% Click Events for Header and its Subcomponents
    click H "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/header/Header.astro"
    click MT "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/header/ModeToggle.tsx"
    click T "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/header/Terminal.tsx"
    click TB "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/header/TerminalButton.tsx"

    %% Click Event for Navigation
    click NB "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/nav/NavigationBar.tsx"

    %% Click Events for Hero Section Subcomponents
    click HComp "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/hero/Hero.tsx"
    click Title "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/hero/Title.tsx"

    %% Click Events for About Section Subcomponents
    click AM "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/AboutMe.tsx"
    click CL "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/CommandList.tsx"
    click EL "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/EduList.tsx"
    click Exp "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/Experience.tsx"
    click S "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/Skills.tsx"
    click WI "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/about/WhoAmI.tsx"

    %% Click Events for Contact Section Subcomponents
    click CD "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/contact/Contact.tsx"
    click CF "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/contact/ContactForm.tsx"
    click NP "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/contact/NotificationPopup.tsx"

    %% Click Event for Footer
    click F "https://github.com/chmpy/chmpy-dot-com/blob/main/src/components/footer/Footer.astro"

    %% Click Event for UI/Helper Components
    click UI "https://github.com/chmpy/chmpy-dot-com/tree/main/src/components/ui"

    %% Click Events for Utility Libraries
    click SU "https://github.com/chmpy/chmpy-dot-com/blob/main/src/lib/utils.ts"
    click CH "https://github.com/chmpy/chmpy-dot-com/blob/main/src/utils/cn.ts"

    %% Click Events for Configuration Files
    click AC "https://github.com/chmpy/chmpy-dot-com/blob/main/astro.config.mjs"
    click TC "https://github.com/chmpy/chmpy-dot-com/blob/main/tsconfig.json"
    click PF "https://github.com/chmpy/chmpy-dot-com/blob/main/package.json"
    click TPC "https://github.com/chmpy/chmpy-dot-com/blob/main/tailwind.config.mjs"
    click GS "https://github.com/chmpy/chmpy-dot-com/blob/main/src/styles/globals.css"
    click PA "https://github.com/chmpy/chmpy-dot-com/tree/main/public"

    %% Styles
    classDef pages fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef layout fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef utility fill:#ffeb99,stroke:#333,stroke-width:2px;
    classDef config fill:#f4cccc,stroke:#333,stroke-width:2px;
```
