# thimirasadeesha/myportfolio architecture

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

- Interactive diagram: https://gitdiagram.com/thimirasadeesha/myportfolio
- Repository: https://github.com/thimirasadeesha/myportfolio

## Overview

##### Main Components
- Next.js Application: This is the core of the project, responsible for rendering pages and handling routing. Key files like _app.tsx and _document.tsx set the stage for the app’s global behavior.
- UI & Components Layer: This includes all the React components found in the “src/components” directory (such as about-hero, landing-hero, experience showcase, projects, skills, and utility components). Also include the animation components (in “src/animation”) that integrate Framer Motion to create smooth transitions.
- API Backend: The “src/pages/api/sendmail.ts” file represents the backend part of the portfolio that uses Nodemailer to process outgoing emails from the contact form.
- Data & Content: The “src/data” folder contains JSON-like files for education, experience, projects, navigation routes, and site metadata. They provide the content that populates your UI components.
- Custom Hooks & Utilities: The “src/hooks” and “src/utility” directories encapsulate application-level logic (for example, auto-sizing text areas, debouncing, or rate-limiting) — important to illustrate how behavior is abstracted away from the UI.
- Layout & Styling: The “src/layout” contains key layout components like the navbar, footer, and main layout container. Also, the “src/styles” and Tailwind configurations define the look and feel.

##### Relationships and Interactions Between Components
- The Next.js framework organizes page rendering: the “src/pages” directory contains all rendered pages, each of which combines multiple UI components.
- Pages (like index.tsx, about.tsx, projects.tsx) leverage layout components (navbar, footer, main-layout) and integrate various component subsets (like animations, project cards, and testimonials).
- The API endpoint (sendmail.ts) is triggered by actions within the contact form (components in “src/components/contact-form”) and makes use of Nodemailer.
- Data files supply static content to these components and are imported as needed.
- Global styles and Tailwind CSS ensure the presentation stays consistent across the application.
- Utility files and hooks provide cross-cutting functionalities (e.g., debouncing input, managing screen breakpoints) that other components depend on.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The UI is built in a modular way with reusable, isolated React components.
- Separation of Concerns: There’s a clear partition between UI (pages, components, layout), business logic (custom hooks and utilities), content (data), and API interactions.
- Single-Page Application (SPA) Routing: Next.js handles both client-side and server-side rendering through its built-in routing system.
- Incremental Static Regeneration and API Endpoints: Though primarily a front-end portfolio, there is a built-in API layer to support interactivity (sending emails).

##### Relevant Technologies
- For the frontend: Next.js, React, TypeScript, Tailwind CSS, and Framer Motion.
- For the backend/API: A simple Node.js-based endpoint using Nodemailer.
- Utility libraries or custom solutions used in hooks and custom utilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Next.js Core
    subgraph "Next.js Core"
        A["Next.js Application"]
    end

    %% Layout & Styling
    subgraph "Layout & Styling"
        B["Layout Components"]
        C["Styles & Tailwind"]
    end

    %% UI Components Layer
    subgraph "UI Components Layer"
        D["UI Components"]
        E["Animation Components"]
    end

    %% Supporting Data & Logic
    subgraph "Supporting Data & Logic"
        F["Data & Content"]
        G["Custom Hooks"]
        H["Utilities"]
    end

    %% Backend and Email Service
    subgraph "Backend"
        I["API Endpoint (sendMail)"]
        J["Email Service (Nodemailer)"]
    end

    %% Connections between components
    A -->|"renders"| B
    A -->|"renders"| D
    B -->|"composes"| D
    C -->|"styles"| B
    C -->|"styles"| D
    F -->|"provides data"| D
    G -->|"supports"| D
    H -->|"supports"| D
    D -->|"triggers"| I
    I -->|"sends mail via"| J
    D -->|"integrates"| E

    %% Styling for nodes
    class A,B,C,D,E frontend
    class F data
    class G,H utility
    class I,J backend

    %% Class definitions with colors
    classDef frontend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef backend fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef data fill:#98fb98,stroke:#000,stroke-width:2px;
    classDef utility fill:#ffa07a,stroke:#000,stroke-width:2px;

    %% Click Events for component mappings
    click A "https://github.com/thimirasadeesha/myportfolio/tree/main/src/pages"
    click B "https://github.com/thimirasadeesha/myportfolio/tree/main/src/layout"
    click C "https://github.com/thimirasadeesha/myportfolio/tree/main/src/styles"
    click D "https://github.com/thimirasadeesha/myportfolio/tree/main/src/components"
    click E "https://github.com/thimirasadeesha/myportfolio/tree/main/src/animation"
    click I "https://github.com/thimirasadeesha/myportfolio/blob/main/src/pages/api/sendmail.ts"
    click F "https://github.com/thimirasadeesha/myportfolio/tree/main/src/data"
    click G "https://github.com/thimirasadeesha/myportfolio/tree/main/src/hooks"
    click H "https://github.com/thimirasadeesha/myportfolio/tree/main/src/utility"
```
