# mark-fender/mark-fender-portfolio architecture

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

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

## Overview

##### Project Type and Purpose
- This is a full-stack, server-side rendered (SSR) personal portfolio built with Next.js and TypeScript.
- It serves HTML/CSS/JS to browsers, uses a serverless function to handle contact-form submissions, and is optimized for static and dynamic rendering.

##### File Structure
- “src/app”: Next.js app directory with the layout, global styles, fonts, and root page (app/layout.tsx, app/page.tsx).
- “src/components”: React UI components (Header, About, Skills, etc.) organized by feature, each with custom hooks for data or behavior.
- “src/actions/sendEmail.ts”: A serverless API route (Next.js API function) to process form submissions.
- “src/context” & “src/hooks”: Context providers and shared hooks for app-wide state (e.g. active section, theme).
- “src/lib” & “src/utils”: Data definitions and pure utility functions (error handling, validation).
- “public/assets”: Static images/fonts served directly.
- Configuration files: next.config.js, tsconfig.json, ESLint, Prettier, postcss.config.js.

##### README for Additional Insights
- Confirms this is your personal developer portfolio.

##### Main Components & Their Relationships
a. Client (Browser)
– Renders HTML, CSS, JS shipped by Next.js.
– Interacts with the UI (components in src/components) and triggers API calls.
b. Next.js Server / Hosting Environment (e.g., Vercel)
– Performs SSR/SSG on requests to pages under src/app.
– Serves static files from /public via CDN.
– Exposes API endpoints (src/actions/sendEmail.ts) as serverless functions.
c. Serverless Function: sendEmail
– Receives POST requests from the ContactFormEmail component.
– Validates input (via src/utils/validation) and dispatches email via an external SMTP or Email API.
d. External Email Service
– SMTP provider or API (e.g., SendGrid, Mailgun).
– Receives mail requests from sendEmail function.
e. Data & State Layers
– Context Providers: manage UI state (active section, theme) across the component tree.
– Hooks: encapsulate logic for data fetching (Intro, Experience, Projects) and UI behavior.
– Static Data: src/lib/data.tsx serves as a mock data source for projects/experience.

##### Architectural Patterns & Design Principles
- Component-based UI (React functional components + hooks).
- Separation of concerns:
– UI vs. state (components vs. context/hooks).
– Front-end vs. business logic (components vs. utils/actions).
– SSR/SSG pages vs. client-only components.
- Serverless microservice for email—keeps form handling decoupled from UI.

##### Checklist
[ ] Clear labels for: Browser, Next.js Server, API functions, External Services
[ ] Boundaries: Front-end vs. Back-end vs. External
[ ] All major file-tree sections represented:
- src/app (pages/layout)
- src/components (UI modules)
- src/context & src/hooks (state management)
- src/actions (serverless API)
- src/lib/utils (data/logic)
- public/assets (static files)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Browser["Browser"]:::external

    %% Infrastructure
    GitHub["GitHub (Version Control)"]:::infra
    CI["CI/CD Pipeline"]:::infra
    Hosting["Hosting (Vercel)"]:::infra

    %% Next.js Server
    NextJS_Server["Next.js Server / Hosting Env"]:::infra

    %% CDN
    CDN["CDN (public/assets)"]:::external

    %% Serverless
    sendEmail["sendEmail API Function"]:::infra
    EmailService["External Email Service"]:::external

    %% Front-end Layers
    subgraph "UI Layer"
        UI_Layer["React Components"]:::frontend
    end

    subgraph "State & Data Layer"
        Context["Context Providers"]:::logic
        Hooks["Shared Hooks"]:::logic
        FeatureHooks["Feature-Level Hooks"]:::logic
        Data["Static Data Source"]:::logic
        Utils["Utility Functions"]:::logic
    end

    subgraph "Next.js Pages"
        Layout["App Layout & Pages"]:::frontend
        Providers["App Providers"]:::logic
        Globals["Global Styles & Fonts"]:::frontend
    end

    %% Connections
    Browser -->|"HTTPS GET"| NextJS_Server
    Browser -->|"HTTPS GET (static)"| CDN
    Browser -->|"HTTPS POST (contact)"| sendEmail
    NextJS_Server -->|"SSR/SSG response"| Browser
    NextJS_Server -->|"serves static"| CDN
    NextJS_Server -->|"renders pages"| Layout
    NextJS_Server -->|"applies providers"| Providers
    NextJS_Server -->|"loads styles/fonts"| Globals

    UI_Layer -->|uses| Context
    UI_Layer -->|uses| Hooks
    UI_Layer -->|uses| FeatureHooks
    UI_Layer -->|fetches static| Data
    UI_Layer -->|handles errors/validation| Utils

    sendEmail -->|"HTTPS call"| EmailService

    GitHub --> CI
    CI --> Hosting
    Hosting --> NextJS_Server
    Hosting --> sendEmail
    Hosting --> CDN

    %% Click Events
    click UI_Layer "https://github.com/mark-fender/mark-fender-portfolio/tree/main/src/components"
    click Layout "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/app/layout.tsx"
    click Providers "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/app/providers.tsx"
    click Globals "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/app/globals.css"
    click Globals "https://github.com/mark-fender/mark-fender-portfolio/tree/main/src/app/fonts"
    click sendEmail "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/actions/sendEmail.ts"
    click Context "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/context/activeSectionContext.tsx"
    click Hooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/hooks/useActiveSection.ts"
    click Hooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/hooks/useIsMobile.ts"
    click Hooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/hooks/useSectionInView.ts"
    click FeatureHooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/components/intro/hooks/useIntro.ts"
    click FeatureHooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/components/experience/hooks/useExperience.ts"
    click FeatureHooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/components/projects/hooks/useProjectList.ts"
    click FeatureHooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/components/contact/hooks/useContact.tsx"
    click FeatureHooks "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/components/themeSwitcher/hooks/useThemeSwitcher.ts"
    click Data "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/lib/data.tsx"
    click Utils "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/utils/errorHandling.ts"
    click Utils "https://github.com/mark-fender/mark-fender-portfolio/blob/main/src/utils/validation.ts"
    click CDN "https://github.com/mark-fender/mark-fender-portfolio/tree/main/public/assets"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef logic fill:#E8F5D4,stroke:#2E7D32,stroke-width:1px
    classDef infra fill:#FFE8D0,stroke:#D2691E,stroke-width:1px
    classDef external fill:#F0F0F0,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5
```
