# kunalagra/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/kunalagra/portfolio
- Repository: https://github.com/kunalagra/portfolio

## Overview

##### Project Overview
- It’s a front-end portfolio website built using Next.js and Chakra UI.
- The application is structured as a static/dynamic website with separate pages for the homepage, projects archive, and links, alongside a number of reusable UI components.

##### Main Components
- Client/Browser: Where the portfolio is rendered.
- Next.js Layer: The core framework that handles routing, SSR (if applicable), and static site generation.
- Pages: Found in the “pages” directory – these include _app.js, _document.js, index.js (homepage), projects/index.js, and links/index.js.
- Components: Reusable UI elements from the “components” folder (AboutMe, Card, Certificates, ContactMe, Navbar, etc.) that build the different sections of the pages.
- Assets & Public Files: Static resources such as “assets/data.js”, “public/robots.txt”, “public/site.webmanifest”, and sitemaps that are involved during the build and when rendering the site.
- Hooks: Custom React hooks under “hook” (such as useMediaQuery) which add functionality across components.
- Configuration & Build: Files like next.config.js, next-sitemap.config.js, package.json, and environment examples that define project settings, dependencies, and build options.
- GitHub Workflows & CI/CD: Under .github/workflows, you have automation scripts for deployments (likely integrated with Vercel as mentioned in the README).

##### Relationships and Interactions
- The Client (browser) makes requests to specific routes (Pages) managed by Next.js.
- Each Page composes multiple UI Components which are imported from the “components” directory.
- The custom Hooks are used by these Components to manage animations, responsiveness, or any custom behavior.
- The “public” folder content and static assets are directly served at runtime.
- Configuration files (next.config.js, package.json) govern build behavior, while GitHub workflows automate tests, integrations, and deployment to services like Vercel.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: All pages are modularly built from several smaller components.
- File-Based Routing: Next.js conventions allow pages to be automatically routed based on their file structure.
- Separation of Concerns: Configuration, assets, components, and hooks are kept in separate directories.
- CI/CD and GitHub Actions: Deployment automation and dependency management are integrated into the project’s lifecycle.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    ClientBrowser("Client/Browser"):::client
    DeploymentEnv("Vercel Deployment"):::deployment
    Nextjs("Next.js Application Layer"):::nextjs
    AssetsPublic("Assets & Public Files"):::assets
    Config("Configuration & Build"):::config
    GitHubCI("GitHub Workflows & CI/CD"):::github

    %% Subgraph for Pages
    subgraph "Pages"
        HomePage("Home Page (_pages/index.js_)"):::pages
        ProjectsPage("Projects Archive (pages/projects/index.js)"):::pages
        Links("Links (pages/links/index.js)"):::pages
        AppConfig("Global App Config (_pages/_app.js_)"):::pages
        Document("Global Document (_pages/_document.js_)"):::pages
    end

    %% Subgraph for Components
    subgraph "Components"
        AboutMe("AboutMe (components/AboutMe.js)"):::components
        Card("Card (components/Card.js)"):::components
        Certificates("Certificates (components/Certificates.js)"):::components
        ChakraNextImage("ChakraNextImage (components/ChakraNextImage.js)"):::components
        ContactMe("ContactMe (components/ContactMe.js)"):::components
        Container("Container (components/Container.js)"):::components
        FeaturedProjects("FeaturedProjects (components/FeaturedProjects.js)"):::components
        Introduction("Introduction (components/Introduction.js)"):::components
        Navbar("Navbar (components/Navbar.js)"):::components
        Timeline("Timeline (components/Timeline.js)"):::components
    end

    %% Subgraph for Hooks
    subgraph "Hooks"
        SlideUp("SlideUpWhenVisible (hook/SlideUpWhenVisible.js)"):::hooks
        MediaQuery("useMediaQuery (hook/useMediaQuery.js)"):::hooks
    end

    %% Subgraph for Assets & Public Files
    subgraph "Static Assets"
        DataAsset("Data Asset (assets/data.js)"):::assets
        PublicFolder("Public Folder"):::assets
    end

    %% Subgraph for Configuration & Build
    subgraph "Configuration & Build"
        NextConfig("Next.js Config (next.config.js)"):::config
        SitemapConfig("Sitemap Config (next-sitemap.config.js)"):::config
        Package("Package.json (package.json)"):::config
        PackageLock("Package-lock.json (package-lock.json)"):::config
        EnvExample("Environment Example (.env.example)"):::config
        Prettier("Prettier Config (.prettierrc.js)"):::config
    end

    %% Subgraph for GitHub Workflows & CI/CD
    subgraph "CI/CD"
        GitHubActions("GitHub Workflow (automerge.yml)"):::github
        Dependabot("Dependabot (.github/dependabot.yml)"):::github
    end

    %% Connections
    ClientBrowser -->|"Requests"| Nextjs
    Nextjs -->|"Renders"| HomePage
    Nextjs -->|"Renders"| ProjectsPage
    Nextjs -->|"Renders"| Links
    Nextjs -->|"Applies"| AppConfig
    Nextjs -->|"Applies"| Document
    HomePage -->|"Uses"| AboutMe
    HomePage -->|"Uses"| Card
    HomePage -->|"Uses"| Certificates
    HomePage -->|"Uses"| ChakraNextImage
    ProjectsPage -->|"Uses"| FeaturedProjects
    ProjectsPage -->|"Uses"| Card
    Links -->|"Uses"| Navbar
    %% Components using hooks
    AboutMe -->|"EnhancesWith"| SlideUp
    Card -->|"EnhancesWith"| MediaQuery
    Certificates -->|"EnhancesWith"| SlideUp
    ContactMe -->|"EnhancesWith"| MediaQuery
    Container -->|"Structures"| Introduction
    Navbar -->|"InteractsWith"| Timeline
    %% Assets influencing Next.js and Client
    AssetsPublic -->|"ServedTo"| ClientBrowser
    DataAsset -->|"ProvidesData"| Nextjs
    PublicFolder -->|"ServedAsIs"| ClientBrowser
    %% Configuration influences Build and Next.js behavior
    Config -->|"Configures"| Nextjs
    %% CI/CD triggers deployment
    GitHubCI -->|"DeploysTo"| DeploymentEnv
    DeploymentEnv -->|"Serves"| ClientBrowser

    %% Click Events for Pages
    click HomePage "https://github.com/kunalagra/portfolio/blob/main/pages/index.js"
    click ProjectsPage "https://github.com/kunalagra/portfolio/blob/main/pages/projects/index.js"
    click Links "https://github.com/kunalagra/portfolio/blob/main/pages/links/index.js"
    click AppConfig "https://github.com/kunalagra/portfolio/blob/main/pages/_app.js"
    click Document "https://github.com/kunalagra/portfolio/blob/main/pages/_document.js"

    %% Click Events for Components
    click AboutMe "https://github.com/kunalagra/portfolio/blob/main/components/AboutMe.js"
    click Card "https://github.com/kunalagra/portfolio/blob/main/components/Card.js"
    click Certificates "https://github.com/kunalagra/portfolio/blob/main/components/Certificates.js"
    click ChakraNextImage "https://github.com/kunalagra/portfolio/blob/main/components/ChakraNextImage.js"
    click ContactMe "https://github.com/kunalagra/portfolio/blob/main/components/ContactMe.js"
    click Container "https://github.com/kunalagra/portfolio/blob/main/components/Container.js"
    click FeaturedProjects "https://github.com/kunalagra/portfolio/blob/main/components/FeaturedProjects.js"
    click Introduction "https://github.com/kunalagra/portfolio/blob/main/components/Introduction.js"
    click Navbar "https://github.com/kunalagra/portfolio/blob/main/components/Navbar.js"
    click Timeline "https://github.com/kunalagra/portfolio/blob/main/components/Timeline.js"

    %% Click Events for Assets & Public Files
    click DataAsset "https://github.com/kunalagra/portfolio/blob/main/assets/data.js"
    click PublicFolder "https://github.com/kunalagra/portfolio/tree/main/public"

    %% Click Events for Hooks
    click SlideUp "https://github.com/kunalagra/portfolio/blob/main/hook/SlideUpWhenVisible.js"
    click MediaQuery "https://github.com/kunalagra/portfolio/blob/main/hook/useMediaQuery.js"

    %% Click Events for Configuration & Build
    click NextConfig "https://github.com/kunalagra/portfolio/blob/main/next.config.js"
    click SitemapConfig "https://github.com/kunalagra/portfolio/blob/main/next-sitemap.config.js"
    click Package "https://github.com/kunalagra/portfolio/blob/main/package.json"
    click PackageLock "https://github.com/kunalagra/portfolio/blob/main/package-lock.json"
    click EnvExample "https://github.com/kunalagra/portfolio/blob/main/.env.example"
    click Prettier "https://github.com/kunalagra/portfolio/blob/main/.prettierrc.js"

    %% Click Events for GitHub Workflows & CI/CD
    click GitHubActions "https://github.com/kunalagra/portfolio/blob/main/.github/workflows/automerge.yml"
    click Dependabot "https://github.com/kunalagra/portfolio/blob/main/.github/dependabot.yml"

    %% Styling Classes
    classDef client fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef nextjs fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef pages fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef components fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef hooks fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef assets fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
    classDef config fill:#fefefe,stroke:#6c757d,stroke-width:2px;
    classDef github fill:#d6d8d9,stroke:#343a40,stroke-width:2px;
    classDef deployment fill:#d4d4f9,stroke:#00008b,stroke-width:2px;
```
