# cr3wcr3w/the-portfolio architecture

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

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

## Overview

##### Primary Components
a. Frontend:
- Next.js Pages: Represent the entry points (pages/index.tsx, pages/blogs.tsx, pages/blogs/[slug].tsx, pages/_app.tsx, pages/_document.tsx).
- Feature Modules: Separate areas such as “home” and “blogs” that contain dedicated components and helper functions.
- Shared Components: Layout, Header, Footer, Loading states, and custom styling under src/shared.
- Static/Public files: All assets like the public folder content and configuration files (next.config.ts, postcss.config.mjs, etc.).
b. Backend / Data Layer:
- Database Scripts: schema.sql and seed.sql denote the external database schema and sample data.
- Data Access Files: Under src/features/blogs/database, there are files (getBlogs.ts, getBlogById.ts) that fetch data from the DB.
- Supabase Utility: A shared utility file (src/shared/utils/supabase.ts) indicates integration with the Supabase service as part of the data layer.
c. DevOps & Configuration:
- GitHub Workflows (.github/workflows/main.yml) for CI/CD.
- Environment configuration file (env.local).
- ESLint and TypeScript configurations (eslint.config.mjs, tsconfig.json).

- Next.js Frontend as the central “UI Layer” that receives user requests via pages.
- That the Pages connect to various feature components (blogs & home) that encapsulate UI logic.
- That the data-access layer interacts with an external database, using SQL scripts for schema/seed information.
- Supabase integration as an intermediary service that facilitates queries between the application and the database.
- CI/CD pipeline with GitHub Workflows, showing that they deploy/build the application which ultimately reaches a hosting platform (most likely Vercel, as suggested in the README).

##### Architectural Patterns & Design Principles
- Component-based Architecture: Emphasize how feature-based folders (blogs, home) encapsulate their own components, helpers, and even database interactions.
- Separation of Concerns: Note the clean separation between presentation (React components/pages), shared utility code (e.g., Supabase integration), and the data access layer.
- Modern Web Paradigm: As a Next.js app, it's structured to support server-side rendering as well as static site generation if needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Nodes
    n["Browser/Web Client"]:::ui
    R["Repository"]:::config

    %% Project Repository Subgraph
    subgraph "Project Repository"
        direction TB
        a["Next.js Pages"]:::ui
        b["Feature Module - Blogs"]:::ui
        c["Feature Module - Home"]:::ui
        d["Shared Components & Utilities"]:::ui
        i["Env Config"]:::config
        j["Configuration Files"]:::config
        k["Public Assets"]:::config
        subgraph "Blogs Data Access"
            direction TB
            e["Blogs DB Access"]:::data
        end
        f["Supabase Utility"]:::data
        g["Schema SQL"]:::data
        h["Seed SQL"]:::data
    end

    %% CI/CD and Deployment Nodes
    l["CI/CD Pipeline"]:::config
    m["Vercel Hosting"]:::deploy

    %% Connections between External and Project Repository
    n -->|"requests"| a
    R -->|"contains"| a

    %% Frontend flow within Project Repository
    a -->|"loads"| b
    a -->|"loads"| c
    a -->|"uses"| d

    %% Feature Module - Blogs data flow
    b -->|"calls"| e
    e -->|"queries via"| f
    f -->|"executes"| g
    f -->|"executes"| h

    %% Shared Components dependencies
    d -->|"configured by"| i
    d -->|"configured by"| j
    d -->|"serves"| k

    %% CI/CD and Deployment flow
    R -->|"builds and deploys"| l
    l -->|"deploys to"| m

    %% Styles
    classDef ui fill:#D0E6FF,stroke:#1F78C1,stroke-width:2px;
    classDef data fill:#C6F9C6,stroke:#006400,stroke-width:2px;
    classDef config fill:#F0F0F0,stroke:#808080,stroke-width:2px;
    classDef deploy fill:#FFE4B5,stroke:#FF8C00,stroke-width:2px;

    %% Click Events
    click a "https://github.com/cr3wcr3w/the-portfolio/tree/main/src/pages"
    click b "https://github.com/cr3wcr3w/the-portfolio/tree/main/src/features/blogs"
    click c "https://github.com/cr3wcr3w/the-portfolio/tree/main/src/features/home"
    click d "https://github.com/cr3wcr3w/the-portfolio/tree/main/src/shared"
    click e "https://github.com/cr3wcr3w/the-portfolio/tree/main/src/features/blogs/database"
    click f "https://github.com/cr3wcr3w/the-portfolio/blob/main/src/shared/utils/supabase.ts"
    click g "https://github.com/cr3wcr3w/the-portfolio/blob/main/schema.sql"
    click h "https://github.com/cr3wcr3w/the-portfolio/blob/main/seed.sql"
    click i "https://github.com/cr3wcr3w/the-portfolio/blob/main/env.local"
    click j "https://github.com/cr3wcr3w/the-portfolio/blob/main/next.config.ts"
    click k "https://github.com/cr3wcr3w/the-portfolio/tree/main/public/"
    click l "https://github.com/cr3wcr3w/the-portfolio/blob/main/.github/workflows/main.yml"
```
