# bettinasosa/portfolio architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack, server-side rendered (SSR) / statically-generated portfolio website built with Next.js and deployed on Vercel.
- It serves marketing-style pages (home, about, blog, projects, contact) along with lightweight API endpoints that fetch GitHub activity and Spotify data.

##### File structure
- Top-level: next.config.js, package.json, Tailwind and PostCSS configs, tsconfig.json → build & toolchain
- public/ → static assets (images, fonts, robots.txt, etc.)
- src/app/ → Next.js App Router: page.tsx files define routes, plus server/client components.
- api/ → serverless API routes for GitHub & Spotify integrations
- app/about, blog, contact, gallery, projects, page.tsx → page entrypoints
- layout.tsx, template.tsx, globals.css → shared layout & styling
- src/components/ → reusable UI and animation primitives
- src/hooks/, src/lib/ → custom React hooks and utilities
- components.json & OldHtmlFiles/ → legacy content (not part of core runtime)

##### README for insights
- Confirms Next.js framework, deployed on Vercel
- Highlights performance, SEO, responsiveness → implies use of SSG/SSR, image optimization, responsive CSS (Tailwind)

##### Main components & their relationships
a. Browser (client)
b. CDN / Vercel Edge Network
c. Next.js Application (hosted on Vercel)
– Static page generator (SSG) for public pages
– SSR entrypoint (app folder routing)
– Serverless Functions for API routes (github-activity, spotify-*)
d. Static Asset Store (public/images, CSS, JS bundles)
e. External Services
– GitHub API
– Spotify OAuth & Data API
f. CI/CD (Vercel) – GitHub → Vercel deploy triggers

##### Architectural patterns & principles
- Folder-based routing (Next.js App Router)
- Hybrid rendering: static generation for unchanging pages, SSR for dynamic data
- Serverless micro-endpoints for external API calls
- Component-driven UI with reusable primitives (atoms/molecules)
- Utility hooks for common data fetching

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        GitHubRepo["GitHub Repo"]:::pipeline
        VercelBuild["Vercel Build & Deploy"]:::pipeline
    end

    %% User and CDN
    Browser["Browser"]:::frontend
    CDN["CDN / Vercel Edge"]:::runtime

    %% Core Application
    NextApp["Next.js App"]:::runtime
    Assets["Static Assets (public/)"]:::assets

    subgraph "Next.js App"
        Router["App Router (SSG/SSR)"]:::runtime
        API["Serverless API Routes"]:::runtime
        UI["UI & Animation Primitives"]:::frontend
        Hooks["Custom Hooks & Utils"]:::runtime
    end

    subgraph "API Routes"
        GH["GitHub Activity API"]:::runtime
        SA["Spotify Auth API"]:::runtime
        SC["Spotify Callback API"]:::runtime
        SP["Spotify Playlists API"]:::runtime
        ST["Spotify Top Tracks API"]:::runtime
    end

    subgraph "External Services"
        GitHubAPI["GitHub API"]:::external
        SpotifyAPI["Spotify API"]:::external
    end

    %% Connections
    GitHubRepo --> VercelBuild
    VercelBuild --> NextApp

    Browser --> CDN
    CDN --> NextApp
    CDN --> Assets

    NextApp --> Router
    NextApp --> API
    NextApp --> UI
    NextApp --> Hooks

    Router --> UI
    Router --> Browser

    API --> GH
    API --> SA
    API --> SC
    API --> SP
    API --> ST

    GH --> GitHubAPI
    SA --> SpotifyAPI
    SC --> SpotifyAPI
    SP --> SpotifyAPI
    ST --> SpotifyAPI

    %% Click Events
    click Router "https://github.com/bettinasosa/portfolio/tree/master/src/app"
    click GH "https://github.com/bettinasosa/portfolio/blob/master/src/app/api/github-activity/route.ts"
    click SA "https://github.com/bettinasosa/portfolio/blob/master/src/app/api/spotify-auth/route.ts"
    click SC "https://github.com/bettinasosa/portfolio/blob/master/src/app/api/spotify-callback/route.tsx"
    click SP "https://github.com/bettinasosa/portfolio/blob/master/src/app/api/spotify-playlists/route.ts"
    click ST "https://github.com/bettinasosa/portfolio/blob/master/src/app/api/spotify-top-tracks/route.ts"
    click Assets "https://github.com/bettinasosa/portfolio/tree/master/public/images/"
    click UI "https://github.com/bettinasosa/portfolio/tree/master/src/components/"
    click Hooks "https://github.com/bettinasosa/portfolio/blob/master/src/hooks/useGithub.tsx"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#036B91,color:#000;
    classDef runtime fill:#C8E6C9,stroke:#256028,color:#000;
    classDef external fill:#FFD59E,stroke:#B26A00,color:#000;
    classDef pipeline fill:#E1C9FF,stroke:#602D91,color:#000;
    classDef assets fill:#FFF3B0,stroke:#998700,color:#000
```
