# eduardoooxd/portfolio architecture

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

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

## Overview

##### Main Components
- Frontend Application: Representing the Next.js app that handles server-side rendering and static generation. This includes the components under /src/app, which define pages, layouts, sitemap, robots file, etc.
- Global State & Domain Logic: Highlight the /src/context (for global state management) and /src/domain (defining contact form models, experience, screen-size, and theme definitions).
- Utility Libraries: Indicate /src/lib which provides hooks, MDX parsing, helper functions, and common types. This supports the orchestration of data flow and component interactions.
- Email Handling: Point out /src/email where Resend-powered email templates or functionalities reside.
- External Dependencies/Services: Include external services like Resend for email and PostHog (as hinted by the provider in /src/providers/posthog.tsx) for analytics, along with public assets in /public and the integration of third-party libraries like Framer Motion.

##### Relationships and Data Flow
- Utility & Domain Contributions: Show that both UI components and server actions rely on utility functions (/src/lib) and domain models (/src/domain) to perform validations, data formatting, and business logic operations.

##### Architectural Patterns and Design Principles
- Modular Architecture: Emphasize the separation of concerns (UI, business logic, global state, and utility functions).
- Server-side Rendering and Static Site Generation: Point out that Next.js app structure supports these features, optimizing for SEO and performance.
- Component Reusability: Note that the portfolio is built with reusable React components, which improves maintainability and scalability.
- Responsive Design & Animations: Indicate that visual presentation is enhanced with media queries and Framer Motion animations.

##### Relevant Technologies and Frameworks
- Next.js 14, React, Framer Motion, and Resend are core to the functionality.
- Integration with PostHog (analytics) and the use of TypeScript (notice the .ts/.tsx files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client-Side Layer
    subgraph "Client-Side Layer"
        Browser["User Browser"]:::client
    end

    %% Next.js & Server-Side Layer
    subgraph "Next.js & Server-Side Layer"
        NextApp["Next.js App Directory"]:::server
        Pages["Pages & Layouts"]:::server
    end

    %% UI Components Layer
    subgraph "UI Components Layer"
        UIComponents["UI Components (Presentational)"]:::ui
        ContactForm["Contact Form Component"]:::ui
        OtherComponents["Other UI Components"]:::ui
    end

    %% Logic & State Management
    subgraph "Logic & State Management"
        Context["Global State & Context"]:::logic
        Domain["Domain Models & Logic"]:::logic
        Utilities["Utility Libraries"]:::lib
        ServerAction["Server Action (Contact Form)"]:::logic
    end

    %% External Services
    subgraph "External Services"
        EmailHandling["Email Handling (Resend)"]:::external
        Analytics["Analytics (PostHog)"]:::external
        ExternalLibs["Third-Party Libraries (Framer Motion)"]:::external
    end

    %% Data Flow Connections
    Browser -->|"HTTP_Request"| NextApp
    NextApp -->|"Renders"| Pages
    Pages -->|"Contains"| ContactForm
    Pages -->|"Imports"| UIComponents
    UIComponents -->|"Uses"| Context
    UIComponents -->|"Validates_with"| Domain
    UIComponents -->|"Helpers_from"| Utilities
    ContactForm -->|"Submits_to"| ServerAction
    ServerAction -->|"Routes_to"| EmailHandling
    NextApp -->|"Integrates"| Analytics
    NextApp -->|"Animates_with"| ExternalLibs

    %% Click Events (Paths for Development Navigation)
    click NextApp "https://github.com/eduardoooxd/portfolio/tree/main/src/app"
    click UIComponents "https://github.com/eduardoooxd/portfolio/tree/main/src/components"
    click Context "https://github.com/eduardoooxd/portfolio/tree/main/src/context"
    click Domain "https://github.com/eduardoooxd/portfolio/tree/main/src/domain"
    click Utilities "https://github.com/eduardoooxd/portfolio/tree/main/src/lib"
    click EmailHandling "https://github.com/eduardoooxd/portfolio/tree/main/src/email"
    click Analytics "https://github.com/eduardoooxd/portfolio/blob/main/src/providers/posthog.tsx"

    %% Styles
    classDef client fill:#ffdead,stroke:#663300,stroke-width:2px;
    classDef server fill:#cde,stroke:#036,stroke-width:2px;
    classDef ui fill:#dff,stroke:#00f,stroke-width:2px;
    classDef logic fill:#dfd,stroke:#090,stroke-width:2px;
    classDef lib fill:#ffe,stroke:#cc0,stroke-width:2px;
    classDef external fill:#fdd,stroke:#900,stroke-width:2px;
```
