# nandichi/portfolio-website architecture

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

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

## Overview

##### Project Type and Purpose
- This project is a portfolio website built to showcase professional work, skills, and projects. It’s a full-stack web application with a PHP backend (using PHPMailer for contact functionality) and a modern frontend leveraging HTML, CSS (including Tailwind CSS as indicated by tailwind.config.js), and JavaScript.
- The README emphasizes creating an online professional presence with features such as a portfolio showcase, skills overview, “About” section, and a functional contact form.

##### Analysis of the File Structure
- Top-level PHP files: index.php, about.php, contact.php, projects.php, skills.php indicate that PHP is used to render dynamic content.
- The “includes” directory holds common components like header.php and footer.php, suggesting a modular approach where views share common layout elements.
- “assets”, “css”, “js”, and “images” directories indicate that the presentation layer (frontend assets) is well-structured.
- The “pages” directory contains JavaScript files (pages/about.js and pages/index.js) – possibly for client-side routing or interactive behaviours.
- Presence of “locales” (with language-specific translation JSON files) suggests planned or implemented internationalization support.
- Supporting files such as composer.json, package.json, tailwind.config.js, and node_modules show that dependencies are managed for both PHP (server-side) and Node (client-side build processes).

##### Main Architectural Components
a. Frontend:
- HTML/CSS/JS files, including responsive design styles and Tailwind CSS configuration. This layer forms the user interface.
- Assets such as images and fonts that support the visual presentation.
- JavaScript files and localization files support dynamic interactions and i18n.
b. Backend:
- PHP-based business logic that handles page routing, rendering, and server-side processing. It uses reusable components (e.g., header.php and footer.php).
- Contact form functionality leveraging PHP and PHPMailer for handling email communication.
c. External Dependencies and Integrations:
- Composer-managed PHP dependencies such as PHPMailer.
- Node-managed packages, likely involved in building or processing frontend assets (e.g., Tailwind CSS).
d. Static and Dynamic Content:
- Static HTML portions alongside dynamic PHP rendering to generate pages.
- Integration of external configuration (e.g., .htaccess, sitemap.xml, robots.txt) ensures proper routing, SEO, and security.

##### Relationships and Interactions
- The frontend and backend interact where PHP renders pages by including common components from the includes folder.
- PHP pages (like contact.php) receive input from the user and interact with PHPMailer to send emails.
- Static assets (CSS, JS, images) are loaded by the web pages to enhance the user experience.
- Localization (via the locales directory) can be integrated with both the PHP templates and the client-side JavaScript to provide language-specific content.

##### Architectural Patterns and Design Principles
- Separation of concerns: The project clearly separates presentation (HTML/CSS/JS), business logic (PHP scripts), and shared components (includes).
- Modular design: The use of includes for header/footer and the segregation of asset folders facilitate maintainability.
- Responsive and modern design practices are applied, as seen by Tailwind CSS and mobile-first design considerations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Client"
        FP1["index.php"]
        FP2["about.php"]
        FP3["contact.php"]
        FP4["projects.php"]
        FP5["skills.php"]
        FP6["js/main.js"]
        FP7["pages/index.js"]
        FP8["pages/about.js"]
        FP9["css/style.css"]
        FP10["styles/About.module.css"]
        FP11["styles/Home.module.css"]
        FP12["locales/en/translation.json"]
        FP13["assets"]
        FP14["images"]
    end

    subgraph "Backend Server"
        B1["PHP Pages"]
        B2["includes/header.php"]
        B3["includes/footer.php"]
        B4["PHPMailer (via composer.json)"]
    end

    subgraph "External Dependencies & Build Tools"
        ED1["composer.json"]
        ED2["package.json"]
        ED3["tailwind.config.js"]
        ED4["node_modules"]
        ED5[".htaccess"]
        ED6["sitemap.xml"]
        ED7["robots.txt"]
        ED8["browserconfig.xml"]
        ED9["site.webmanifest"]
        ED10["favicon-generator.html"]
        ED11["favicon-template.html"]
        ED12["generate-favicons.sh"]
    end

    %% Relationships: Frontend requests to Backend processing
    FP1 -->|"requests"| B1
    FP2 -->|"requests"| B1
    FP3 -->|"requests"| B1
    FP4 -->|"requests"| B1
    FP5 -->|"requests"| B1

    %% Backend PHP Pages include shared components
    B1 -->|"includes"| B2
    B1 -->|"includes"| B3

    %% Contact page sends email via PHPMailer integration
    FP3 -->|"sendsEmail"| B4
    B4 -->|"managedBy"| ED1

    %% Additional dependency connections (build tools support backend logic)
    B1 -->|"buildWith"| ED2
    B1 -->|"buildWith"| ED3
    B1 -->|"buildWith"| ED4

    %% Styling Classes
    class FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9,FP10,FP11,FP12,FP13,FP14 frontend
    class B1,B2,B3,B4 backend
    class ED1,ED2,ED3,ED4,ED5,ED6,ED7,ED8,ED9,ED10,ED11,ED12 external

    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#333,stroke-width:2px;

    %% Click Events for Frontend Client components
    click FP1 "https://github.com/nandichi/portfolio-website/blob/main/index.php"
    click FP2 "https://github.com/nandichi/portfolio-website/blob/main/about.php"
    click FP3 "https://github.com/nandichi/portfolio-website/blob/main/contact.php"
    click FP4 "https://github.com/nandichi/portfolio-website/blob/main/projects.php"
    click FP5 "https://github.com/nandichi/portfolio-website/blob/main/skills.php"
    click FP6 "https://github.com/nandichi/portfolio-website/blob/main/js/main.js"
    click FP7 "https://github.com/nandichi/portfolio-website/blob/main/pages/index.js"
    click FP8 "https://github.com/nandichi/portfolio-website/blob/main/pages/about.js"
    click FP9 "https://github.com/nandichi/portfolio-website/blob/main/css/style.css"
    click FP10 "https://github.com/nandichi/portfolio-website/blob/main/styles/About.module.css"
    click FP11 "https://github.com/nandichi/portfolio-website/blob/main/styles/Home.module.css"
    click FP12 "https://github.com/nandichi/portfolio-website/blob/main/locales/en/translation.json"
    click FP13 "https://github.com/nandichi/portfolio-website/tree/main/assets"
    click FP14 "https://github.com/nandichi/portfolio-website/tree/main/images"

    %% Click Events for Backend Server components
    click B2 "https://github.com/nandichi/portfolio-website/blob/main/includes/header.php"
    click B3 "https://github.com/nandichi/portfolio-website/blob/main/includes/footer.php"
    click B4 "https://github.com/nandichi/portfolio-website/blob/main/composer.json"

    %% Click Events for External Dependencies & Build Tools
    click ED1 "https://github.com/nandichi/portfolio-website/blob/main/composer.json"
    click ED2 "https://github.com/nandichi/portfolio-website/blob/main/package.json"
    click ED3 "https://github.com/nandichi/portfolio-website/blob/main/tailwind.config.js"
    click ED4 "https://github.com/nandichi/portfolio-website/tree/main/node_modules"
    click ED5 "https://github.com/nandichi/portfolio-website/blob/main/.htaccess"
    click ED6 "https://github.com/nandichi/portfolio-website/blob/main/sitemap.xml"
    click ED7 "https://github.com/nandichi/portfolio-website/blob/main/robots.txt"
    click ED8 "https://github.com/nandichi/portfolio-website/blob/main/browserconfig.xml"
    click ED9 "https://github.com/nandichi/portfolio-website/blob/main/site.webmanifest"
    click ED10 "https://github.com/nandichi/portfolio-website/blob/main/favicon-generator.html"
    click ED11 "https://github.com/nandichi/portfolio-website/blob/main/favicon-template.html"
    click ED12 "https://github.com/nandichi/portfolio-website/blob/main/generate-favicons.sh"
```
