# pedrojose06/portifolio architecture

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

- Interactive diagram: https://gitdiagram.com/pedrojose06/portifolio
- Repository: https://github.com/pedrojose06/portifolio

## Overview

##### Project type and purpose
- This is a Next.js “App Router” web application that serves a multi-language static/SSR website (no custom backend or database).
- It uses React components, the Next.js middleware for locale detection, Tailwind CSS, and a simple i18n layer.

##### File structure
- Top-level artifacts:
– next.config.ts, middleware.ts → Next.js config & middleware
– postcss.config.mjs, tailwind.config.ts → CSS build pipeline
– public/ → static assets (images)
– src/app/ → React pages and layouts (App Router)
– src/i18n/ → internationalization utilities
- src/app/[locale]/… → dynamic locale-based routing
- src/app/components/… → reusable UI components
- src/app/hooks/useDevice.ts → custom React hook

##### Key README insights
- Bootstrapped with create-next-app
- Uses next/font, auto-optimized by Next.js
- Deployed via Vercel (CDN + SSR edge functions)

##### Main components
a. Users & Browsers
b. CDN / Vercel Edge Network
c. Next.js Server (Edge Functions)
– Middleware (locale detection)
– App Router (page.tsx, layout.tsx)
d. React Client (hydration, client components)
e. Static Assets (public/images, fonts)
f. i18n Service (src/i18n/request.ts, routing.ts)
g. Build Tools (Tailwind/PostCSS pipeline)

##### Relationships & data flow
1. Browser request → CDN / Edge → middleware.ts
2. Middleware extracts  locale from URL → forwards to App Router
3. App Router loads layout.tsx + [locale] pages + components → Next.js SSR at edge
4. SSR HTML + CSS + JS blobs returned to client
5. Browser hydrates React client components (e.g., Button, NavBar)
6. Client may call i18n/request.ts for translation data (en.json, pt.json)
7. Static assets (images, fonts) served from public/ or next/font CDN

##### Architectural patterns & design principles
- File-system routing (Next.js App Router)
- Separation of concerns: layout vs pages vs components
- Edge rendering (middleware + SSR at edge)
- i18n abstraction layer decoupled from UI
- Tailwind utility-first CSS build pipeline

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Tools
    subgraph "Build Tools"
        tailwind["Tailwind Config"]:::build
        postcss["PostCSS Config"]:::build
    end

    %% Deployment / CDN
    User["User Browser"]:::client
    CDN["Vercel Edge/CDN"]:::infra

    %% Server-side
    subgraph "Server-side"
        middleware["Next.js Middleware\n(locale detection)"]:::server
        nextConfig["Next.js Config"]:::server
        appRouter["Next.js App Router\n(SSR/SSG)"]:::server
        i18nService["i18n Service"]:::server
    end

    %% Client-side
    subgraph "Client-side"
        clientComponents["React Client Components"]:::client
        hook["useDevice Hook"]:::client
        globals["Global Styles"]:::client
    end

    %% Static Assets
    subgraph "Static Assets"
        staticAssets["Public Images"]:::static
        i18nJSON["Translation JSON Files"]:::static
    end

    %% Flows
    User -->|"HTTP Request"| CDN
    CDN -->|"Edge Function"| middleware
    middleware -->|"Locale Header"| appRouter
    appRouter -->|"Rendered HTML/JS/CSS"| User
    User -->|"Hydration"| clientComponents
    clientComponents -->|"Calls Hook"| hook
    clientComponents -->|"Uses Styles"| globals
    clientComponents -->|"Translation Fetch"| i18nService
    i18nService -->|"Reads"| i18nJSON
    User -->|"Requests Assets"| staticAssets

    %% Click Events
    click middleware "https://github.com/pedrojose06/portifolio/blob/main/middleware.ts"
    click nextConfig "https://github.com/pedrojose06/portifolio/blob/main/next.config.ts"
    click tailwind "https://github.com/pedrojose06/portifolio/blob/main/tailwind.config.ts"
    click postcss "https://github.com/pedrojose06/portifolio/blob/main/postcss.config.mjs"
    click staticAssets "https://github.com/pedrojose06/portifolio/tree/main/public/images/"
    click i18nJSON "https://github.com/pedrojose06/portifolio/blob/main/langs/en.json"
    click layout "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/layout.tsx"
    click pageRoot "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/page.tsx"
    click pageAbout "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/about/page.tsx"
    click pageContact "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/contact/page.tsx"
    click pageHero "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/hero/page.tsx"
    click pageHome "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/homePage/page.tsx"
    click pageExp "https://github.com/pedrojose06/portifolio/blob/main/src/app/[locale]/myExperience/page.tsx"
    click btn "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/Button/Button.tsx"
    click divi "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/Divider/Divider.tsx"
    click footer "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/Footer/Footer.tsx"
    click nav "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/NavBar/NavBar.tsx"
    click navItem "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/NavBar/NavBarItem.tsx"
    click navLogo "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/NavBar/NavBarLogo.tsx"
    click navAtoms "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/NavBar/atoms/navbar.ts"
    click rot "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/RotatingText/RotatingText.tsx"
    click scroll "https://github.com/pedrojose06/portifolio/blob/main/src/app/components/ScrollFloat/ScrollFloat.tsx"
    click hook "https://github.com/pedrojose06/portifolio/blob/main/src/app/hooks/useDevice.ts"
    click req "https://github.com/pedrojose06/portifolio/blob/main/src/i18n/request.ts"
    click routing "https://github.com/pedrojose06/portifolio/blob/main/src/i18n/routing.ts"
    click globals "https://github.com/pedrojose06/portifolio/blob/main/src/app/globals.css"

    %% Styles
    classDef server fill:#B3CDE3,stroke:#000
    classDef client fill:#C7E9C0,stroke:#000
    classDef static fill:#FDD0A2,stroke:#000
    classDef build fill:#D9D9D9,stroke:#000
    classDef infra fill:#80B1D3,stroke:#000
```
