# punna1958/portfolio architecture

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

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

## Overview

##### Project Type and Purpose
- This is a modern, responsive portfolio website built entirely with Next.js (App Router), TypeScript and Tailwind CSS.
- It serves static pages (home, about, resume, projects, skills) plus dynamic blog pages generated from Markdown files.
- It runs on Vercel as a static‐and‐serverless deployment (SSG for most routes, serverless functions for dynamic API routes).

##### File Structure
- Top‐level configuration (next.config.ts, tsconfig.json, tailwind.config.ts, eslint + prettier + GitHub workflows).
- `public/`: static assets (images, resume PDF, admin panel).
- `posts/`: Markdown blog posts as content source.
- `src/app/`: Next.js App Router—
- `layout.tsx` and `globals.css` define site‐wide layout and styling.
- `page.tsx` implements the homepage.
- `/api/blogs/[slug]/route.ts` is a serverless function that reads Markdown for each blog slug.
- `/blogs/[slug]/page.tsx` renders each blog’s content.
- `src/components/`: React UI components (Hero, About, Experience, Projects, Skills, and smaller UI elements under `UI/`).
- `src/hooks/`: custom hooks (e.g., `useInView`).
- `src/data.ts` and `src/types.ts`: data definitions and TypeScript types.

##### README for Additional Insights
- Emphasizes responsive design, dark/light mode, timeline UI, performance optimizations (image lazy loading, SSG, minimal CSS).
- Mentions deployment on Vercel and customization points.

a. Main Components
- Client (Browser)
- Next.js Application
- App Router (layout, pages, dynamic routes)
- Serverless API Routes (for blog content)
- Tailwind CSS + global styling
- Content Source (Markdown files in `posts/`)
- Public Assets (images, resume.pdf)
- Hosting/Delivery (Vercel CDN + Edge network)
b. Relationships and Data Flow
- Browser → CDN edge: request for `/`, `/about`, `/blogs/[slug]`
- CDN edge → Next.js SSG or SSR pipeline
- Serverless Function (API route) reads from filesystem (`posts/`) → returns JSON/HTML
- Next.js renderer hydrates React components → CSS from Tailwind + global CSS
- Static assets served directly from `public/`
c. Architectural Patterns
- Static Site Generation (SSG) for pages without dynamic data
- Server‐Side Rendering (SSR)/Dynamic Page Generation for blogs via serverless functions
- Component‐Based UI—modular React components under `src/components/`
- File‐based routing (App Router)
d. Key Technologies & Frameworks
- Next.js 15 (App Router, Image optimization, API routes)
- TypeScript (type safety)
- Tailwind CSS (utility‐first styling)
- Vercel (hosting, CDN, serverless)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Deployment Trigger
    User["Browser"]:::external
    GitHub["GitHub Repo"]:::config
    VercelCI["Vercel CI/CD"]:::cloud

    %% Hosting Layer
    subgraph "Hosting & Delivery" 
        direction TB
        CDN["Vercel CDN & Edge"]:::cloud
    end

    %% Next.js Application Layer
    subgraph "Next.js Application" 
        direction TB
        subgraph "App Router & Styling"
            direction TB
            Layout["Layout & Globals"]:::app
            click Layout "https://github.com/punna1958/portfolio/blob/main/src/app/layout.tsx"
            click Layout "https://github.com/punna1958/portfolio/blob/main/src/app/globals.css"
        end
        subgraph "Pages (SSG)"
            direction TB
            Home["Home Page"]:::pages
            click Home "https://github.com/punna1958/portfolio/blob/main/src/app/page.tsx"
            BlogsList["Blog Listing"]:::pages
            click BlogsList "https://github.com/punna1958/portfolio/blob/main/src/app/blogs/page.tsx"
        end
        subgraph "Pages (Dynamic)"
            direction TB
            BlogDetail["Blog Detail Page"]:::pages
            click BlogDetail "https://github.com/punna1958/portfolio/blob/main/src/app/blogs/[slug]/page.tsx"
        end
        subgraph "Components"
            direction TB
            About["About Component"]:::ui
            click About "https://github.com/punna1958/portfolio/blob/main/src/components/About.tsx"
            Projects["Projects Component"]:::ui
            click Projects "https://github.com/punna1958/portfolio/blob/main/src/components/Projects.tsx"
            Skills["Skills Component"]:::ui
            click Skills "https://github.com/punna1958/portfolio/blob/main/src/components/Skills.tsx"
            UI["Reusable UI Components"]:::ui
            click UI "https://github.com/punna1958/portfolio/blob/main/src/components/UI/*.tsx"
        end
        subgraph "API & Data Fetching"
            direction TB
            API["Serverless API Route"]:::api
            click API "https://github.com/punna1958/portfolio/blob/main/src/app/api/blogs/[slug]/route.ts"
            Hook["Custom Hook (useInView)"]:::ui
            click Hook "https://github.com/punna1958/portfolio/blob/main/src/hooks/useInView.tsx"
            DataDef["Data Definitions"]:::data
            click DataDef "https://github.com/punna1958/portfolio/blob/main/src/data.ts"
            Types["TypeScript Types"]:::config
            click Types "https://github.com/punna1958/portfolio/blob/main/src/types.ts"
        end
    end

    %% Data & Assets Layer
    subgraph "Content & Assets"
        direction TB
        Markdown["Markdown Posts"]:::data
        click Markdown "https://github.com/punna1958/portfolio/blob/main/posts/*.md"
        Resume["Resume PDF"]:::asset
        click Resume "https://github.com/punna1958/portfolio/blob/main/public/resume.pdf"
        AdminPanel["Admin Panel UI"]:::asset
        click AdminPanel "https://github.com/punna1958/portfolio/blob/main/public/admin/index.html"
        click AdminPanel "https://github.com/punna1958/portfolio/blob/main/public/admin/config.yml"
        Fonts["Global Fonts"]:::asset
        click Fonts "https://github.com/punna1958/portfolio/tree/main/src/app/fonts"
    end

    %% Configuration Files
    subgraph "Configuration"
        direction TB
        NextConfig["next.config.ts"]:::config
        click NextConfig "https://github.com/punna1958/portfolio/blob/main/next.config.ts"
        TailwindConfig["tailwind.config.ts"]:::config
        click TailwindConfig "https://github.com/punna1958/portfolio/blob/main/tailwind.config.ts"
        TSConfig["tsconfig.json"]:::config
        click TSConfig "https://github.com/punna1958/portfolio/blob/main/tsconfig.json"
        DeployYML["deploy.yml"]:::config
        click DeployYML "https://github.com/punna1958/portfolio/blob/main/.github/workflows/deploy.yml"
    end

    %% Flows
    User -->|"requests pages"| CDN
    CDN -->|"serves SSG pages"| Home
    CDN -->|"serves SSG pages"| BlogsList
    CDN -->|"serves static assets"| Resume
    CDN -->|"serves static assets"| AdminPanel
    Home --> Layout
    BlogsList --> Layout
    BlogDetail --> Layout
    Layout --> UI
    Layout --> Hook
    BlogDetail -->|calls API| API
    API -->|reads| Markdown
    Projects --> Layout
    About --> Layout
    Skills --> Layout
    User -->|"push code"| GitHub
    GitHub --> VercelCI
    VercelCI --> CDN

    %% Styles
    classDef external fill:#BBF,stroke:#000,stroke-width:1px
    classDef cloud fill:#AAF,stroke:#000,stroke-width:1px
    classDef app fill:#CFF,stroke:#000,stroke-width:1px
    classDef pages fill:#BEE,stroke:#000,stroke-width:1px
    classDef ui fill:#8FC,stroke:#000,stroke-width:1px
    classDef api fill:#FCA,stroke:#000,stroke-width:1px
    classDef data fill:#CFC,stroke:#000,stroke-width:1px
    classDef asset fill:#FCF,stroke:#000,stroke-width:1px
    classDef config fill:#EEE,stroke:#000,stroke-width:1px
```
