# pratham82/portfolio-v5 architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack portfolio website built with Next.js and TypeScript.
- Front-end: React components styled with Tailwind CSS.
- Back-end: GraphQL API (in a separate repo) providing blog posts, projects, and contact data.
- Dev-ops: Uses ESLint, Prettier, Husky, and GitHub Actions for CI.

##### File structure
- pages/ – Next.js routes:
– pages/*.tsx are used for SSG/SSR page rendering (home, about, blogs, projects).
– pages/api/ implements serverless functions (e.g., blogPosts.ts) that proxy or enrich data.
- components/ – Reusable UI pieces (cards, header, footer, theme switcher).
- content/blogs/ – Markdown files for statically generated blog posts.
- lib/apollo/ – Apollo Client setup for GraphQL queries.
- src/graphql/queries/ – GraphQL operations used at build time or runtime.
- interface/, src/data/, src/utils/, src/hooks/ – Structured data models, helpers, and custom hooks.
- public/ – Static assets.
- styles/ and tailwind.config.js – Global CSS and Tailwind configuration.
- Config files (.eslintrc.json, .prettierrc, husky hooks, GitHub workflow ci.yml) manage code quality and CI/CD.

##### README for additional insights
- Confirms this is a Next.js TS template with built-in tooling.
- Points to a backend “portfolio-api” GraphQL service.

##### Detail
- Every distinct layer (UI, data fetch, serverless, backend).
- Don’t lump everything under “Next.js”—split out SSG, SSR, and API routes.
- How interfaces and GraphQL queries map to data sources.
- Call out tooling (ESLint/Husky, GitHub Actions) as part of the overall pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client and Delivery
    Browser["Client Browser"]:::frontend
    CDN["CDN / Hosting (Vercel)"]:::infra

    Browser -->|"HTTP(S) Request"| CDN
    CDN -->|"Serve SSR or Static"| NextJS

    %% Next.js Frontend
    subgraph "Next.js Frontend" 
        direction TB
        NextJS["Next.js Frontend"]:::frontend

        subgraph "Static Generation (SSG)" 
            direction TB
            Markdown["Markdown Content"]:::frontend
            BlogPages["pages/blogs/[slug].tsx,<br>pages/blogs/index.tsx"]:::frontend
        end

        subgraph "Server-Side Rendering (SSR)" 
            direction TB
            Home["pages/home.tsx"]:::frontend
            About["pages/about.tsx"]:::frontend
            Projects["pages/projects.tsx"]:::frontend
        end

        subgraph "Serverless API Routes" 
            direction TB
            BlogAPI["pages/api/blogPosts.ts"]:::api
            HelloAPI["pages/api/hello.ts"]:::api
        end

        NextJS -->|SSG Build-Time| Markdown
        Markdown -->|Generate Pages| BlogPages
        NextJS -->|Runtime Data| ApolloClient
        ApolloClient -->|GraphQL Queries| GraphQLBackend
        NextJS -->|API Calls| BlogAPI
        NextJS -->|API Calls| HelloAPI
    end

    %% UI Components & Styling
    subgraph "UI & Components" 
        direction TB
        Layout["components/Layout.tsx"]:::frontend
        Header["components/Header.tsx"]:::frontend
        Footer["components/Footer.tsx"]:::frontend
        BlogCard["components/BlogCard.tsx"]:::frontend
        ProjectCard["components/ProjectCard.tsx"]:::frontend
        EducationCard["components/EducationCard.tsx"]:::frontend
        WorkExCard["components/WorkExCard.tsx"]:::frontend
        ThemeSwitcher["components/ThemeSwitcher.tsx"]:::frontend
        PageAnim["components/PageAnimationContainer.tsx"]:::frontend
        LoadingSkeleton["components/loadingPages/*.skeleton.tsx"]:::frontend
    end

    NextJS --> Layout
    Layout --> Header
    Layout --> Footer
    Layout --> ThemeSwitcher
    Layout --> PageAnim
    NextJS --> BlogCard
    NextJS --> ProjectCard
    NextJS --> EducationCard
    NextJS --> WorkExCard
    NextJS --> LoadingSkeleton

    %% Data & Logic Layers
    subgraph "Data Fetching & Utilities"
        direction TB
        ApolloClient["Apollo Client<br>(lib/apollo/index.ts)"]:::api
        GraphQLQueries["GraphQL Queries<br>(src/graphql/queries/*.graphql,<br>src/graphql/queries/index.ts)"]:::api
        Interfaces["TypeScript Interfaces<br>(interface/*.ts)"]:::api
        Hooks["useGetPageData<br>(src/hooks/useGetPageData.ts)"]:::api
        Utils["Utility Functions"]:::api
        DataFiles["Static Data & Config<br>(src/data/headerData.ts,<br>src/data/homepage.data.json)"]:::api
        UtilsDate["getFormattedDate.ts"]:::api
        UtilsProj["getProjectsByCategories.ts"]:::api
        UtilsReadTime["getReadTime.ts"]:::api
    end

    SSR_Home[Home] --> Hooks
    SSR_About[About] --> Hooks
    SSR_Projects[Projects] --> Hooks
    Hooks --> ApolloClient
    ApolloClient --> GraphQLQueries
    Hooks --> Interfaces
    NextJS --> DataFiles
    NextJS --> UtilsDate
    NextJS --> UtilsProj
    NextJS --> UtilsReadTime

    %% Backend Services
    subgraph "External GraphQL Backend" 
        direction TB
        GraphQLBackend["GraphQL API (portfolio-api)"]:::api
        Database["Database (MongoDB/Postgres)"]:::api
    end
    GraphQLBackend --> Database

    %% Dev Tooling & CI/CD
    subgraph "Dev Tooling & CI/CD" 
        direction TB
        ESLint[".eslintrc.json,<br>.eslintignore"]:::infra
        Prettier[".prettierrc,<br>.prettierignore"]:::infra
        Husky[".husky/pre-commit"]:::infra
        CI["GitHub Actions CI/CD<br>(.github/workflows/ci.yml)"]:::infra
    end

    CI -->|Build & Lint| NextJS
    CI -->|Deploy| CDN

    %% Styling & Config
    subgraph "Styling & Config" 
        direction TB
        GlobalStyles["styles/globals.css"]:::frontend
        TailwindConfig["tailwind.config.js"]:::frontend
        PostCSS["postcss.config.js"]:::frontend
    end
    NextJS --> GlobalStyles
    NextJS --> TailwindConfig
    NextJS --> PostCSS

    %% Click Events
    click Markdown "https://github.com/pratham82/portfolio-v5/blob/master/content/blogs/*.md"
    click BlogPages "https://github.com/pratham82/portfolio-v5/blob/master/pages/blogs/[slug].tsx"
    click BlogPages "https://github.com/pratham82/portfolio-v5/blob/master/pages/blogs/index.tsx"
    click Home "https://github.com/pratham82/portfolio-v5/blob/master/pages/home.tsx"
    click About "https://github.com/pratham82/portfolio-v5/blob/master/pages/about.tsx"
    click Projects "https://github.com/pratham82/portfolio-v5/blob/master/pages/projects.tsx"
    click BlogAPI "https://github.com/pratham82/portfolio-v5/blob/master/pages/api/blogPosts.ts"
    click HelloAPI "https://github.com/pratham82/portfolio-v5/blob/master/pages/api/hello.ts"
    click Layout "https://github.com/pratham82/portfolio-v5/blob/master/components/Layout.tsx"
    click Header "https://github.com/pratham82/portfolio-v5/blob/master/components/Header.tsx"
    click Footer "https://github.com/pratham82/portfolio-v5/blob/master/components/Footer.tsx"
    click BlogCard "https://github.com/pratham82/portfolio-v5/blob/master/components/BlogCard.tsx"
    click ProjectCard "https://github.com/pratham82/portfolio-v5/blob/master/components/ProjectCard.tsx"
    click EducationCard "https://github.com/pratham82/portfolio-v5/blob/master/components/EducationCard.tsx"
    click WorkExCard "https://github.com/pratham82/portfolio-v5/blob/master/components/WorkExCard.tsx"
    click ThemeSwitcher "https://github.com/pratham82/portfolio-v5/blob/master/components/ThemeSwitcher.tsx"
    click PageAnim "https://github.com/pratham82/portfolio-v5/blob/master/components/PageAnimationContainer.tsx"
    click LoadingSkeleton "https://github.com/pratham82/portfolio-v5/blob/master/components/loadingPages/*.skeleton.tsx"
    click ApolloClient "https://github.com/pratham82/portfolio-v5/blob/master/lib/apollo/index.ts"
    click GraphQLQueries "https://github.com/pratham82/portfolio-v5/blob/master/src/graphql/queries/*.graphql"
    click GraphQLQueries "https://github.com/pratham82/portfolio-v5/blob/master/src/graphql/queries/index.ts"
    click Interfaces "https://github.com/pratham82/portfolio-v5/blob/master/interface/*.ts"
    click Hooks "https://github.com/pratham82/portfolio-v5/blob/master/src/hooks/useGetPageData.ts"
    click UtilsDate "https://github.com/pratham82/portfolio-v5/blob/master/src/utils/getFormattedDate.ts"
    click UtilsProj "https://github.com/pratham82/portfolio-v5/blob/master/src/utils/getProjectsByCategories.ts"
    click UtilsReadTime "https://github.com/pratham82/portfolio-v5/blob/master/src/utils/getReadTime.ts"
    click DataFiles "https://github.com/pratham82/portfolio-v5/blob/master/src/data/headerData.ts"
    click DataFiles "https://github.com/pratham82/portfolio-v5/blob/master/src/data/homepage.data.json"
    click GlobalStyles "https://github.com/pratham82/portfolio-v5/blob/master/styles/globals.css"
    click TailwindConfig "https://github.com/pratham82/portfolio-v5/blob/master/tailwind.config.js"
    click PostCSS "https://github.com/pratham82/portfolio-v5/blob/master/postcss.config.js"
    click ESLint "https://github.com/pratham82/portfolio-v5/blob/master/.eslintrc.json"
    click ESLint "https://github.com/pratham82/portfolio-v5/blob/master/.eslintignore"
    click Prettier "https://github.com/pratham82/portfolio-v5/blob/master/.prettierrc"
    click Prettier "https://github.com/pratham82/portfolio-v5/blob/master/.prettierignore"
    click Husky "https://github.com/pratham82/portfolio-v5/tree/master/.husky/pre-commit"
    click CI "https://github.com/pratham82/portfolio-v5/blob/master/.github/workflows/ci.yml"

    %% Styles
    classDef frontend fill:#E0F2FE,stroke:#0369A1,color:#034663
    classDef api fill:#DCFCE7,stroke:#15803D,color:#166534
    classDef infra fill:#FEF3C7,stroke:#CA8A04,color:#854d0e
```
