# kalluru498/website_portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/kalluru498/website_portfolio
- Repository: https://github.com/kalluru498/website_portfolio

## Overview

##### Project type and purpose
- This is a Next.js-based portfolio website (front-end only) built with React, TypeScript, Tailwind CSS, and Contentlayer.
- Its primary function is to serve static and server-rendered pages (home, about, blog, projects, contact, resume) along with a chatbot component that calls out to an external API.

##### File structure
- Top level:
- `app/` – Next.js App Router directory containing page.tsx files for each route, plus global CSS, layout and metadata.
- `components/` – React components organized by feature (about, blog, contact, home, projects, resume), plus a generic `ui/` subfolder for reusable UI building blocks.
- `hooks/`, `lib/`, `types/` – custom hooks, utility functions, and type definitions.
- `contentlayer.config.ts` – config for sourcing markdown or MDX blog content at build time.
- `public/` – static assets (images).
- Config files for ESLint, Tailwind, PostCSS, Next.js, TypeScript, etc.

##### README
- Minimal description; confirms this is a “portfolio” site.

a. Main components
- Client (Browser)
- CDN / Edge Cache (e.g., Vercel)
- Next.js Serverless Rendering / Static Generation Engine
- Content Data (Markdown/MDX via Contentlayer)
- UI Component Library (in-repo components/ui)
- Build & Deployment Pipeline (Git → CI/CD → Vercel)
- External Chatbot API (e.g., OpenAI)

b. Relationships and data flows
1. Browser → CDN: request for `/`, `/blog`, `/projects`, etc.
2. CDN → Next.js:
- For static pages: serve from cache.
- For SSG paths (blog posts): if not cached, Next.js static-generates at build or on-demand using Contentlayer data, then caches.
- For SSR/ISR (if used): executes a serverless function, fetches data, renders React output, then returns HTML + hydration JS.
3. React Components → UI Library & Hooks: client loads JS bundle containing the component hierarchy and util functions.
4. Chat interaction: Browser → ChatbotProvider component → external API → back to ChatbotProvider → UI update.
5. Build pipeline: Git push → CI/CD → runs `next build` (Contentlayer processes content) → deploy to Vercel → populates CDN.

c. Architectural patterns & design principles
- File-based routing with Next.js App Router
- Static Site Generation (SSG) for performance, with some Server-Side Rendering (SSR)/Incremental Static Regeneration (ISR) capabilities.
- Component-driven design: atomic/reusable UI primitives in `components/ui` and feature-specific components.
- Separation of concerns: routing (app/) vs. UI composition (components/) vs. utilities (lib/, hooks/).
- CDN edge caching and serverless functions for scalable delivery.

d. Key technologies & frameworks
- Next.js 13+ (App Router)
- React + TypeScript
- Tailwind CSS + PostCSS
- Contentlayer for Markdown/MDX → data layer
- Vercel (or similar) for hosting and edge functions
- (Optional) OpenAI or other API for chatbot integration

##### Detail is key
- Data flows (HTML, JSON, JS bundles, markdown → HTML).
- Don’t hesitate to decompose the UI layer further (e.g., highlight the `components/ui` library vs. page-specific components).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Deploy Layer
    subgraph "Build & Deploy" 
        direction TB
        Git["Git Repo"]:::build
        CI["CI/CD Pipeline"]:::build
        ContentData["Markdown/MDX Files"]:::build
        Build["next build + Contentlayer"]:::build
        VercelDeploy["Deploy to Vercel"]:::build
        
        Git -->|push| CI
        CI -->|runs build| Build
        ContentData -->|ingested at build time| Build
        Build -->|deploy| VercelDeploy
        VercelDeploy -->|populate edge cache| CDN
    end

    %% CDN / Edge Cache Layer
    subgraph "CDN / Edge Cache"
        direction TB
        CDN["CDN / Edge Cache"]:::frontend
    end

    %% Serverless Rendering Layer
    subgraph "Serverless / SSR"
        direction TB
        NextEdge["Next.js Edge Function"]:::frontend
        CDN -->|cache miss / SSR request| NextEdge
        NextEdge -->|HTML + JS bundles| CDN
    end

    %% Client Layer
    subgraph "Client (Browser)"
        direction TB
        Browser["Browser"]:::frontend
        ReactUI["React UI Components"]:::frontend
        ChatComp["ChatbotProvider"]:::frontend
        
        Browser -->|request pages| CDN
        Browser -->|hydrates UI| ReactUI
        ReactUI -->|uses| ChatComp
    end

    %% External Services Layer
    subgraph "External Services"
        direction TB
        OpenAI["External Chatbot API"]:::external
        ChatComp -->|API call| OpenAI
        OpenAI -->|response| ChatComp
    end

    %% Codebase Structure
    subgraph "Codebase" 
        direction TB

        subgraph "app/"
            AppRouter["Next.js App Router"]:::build
            HomePage["page.tsx (Home)"]:::build
            AboutPage["about/page.tsx"]:::build
            BlogList["blog/page.tsx"]:::build
            BlogPost["blog/[slug]/page.tsx"]:::build
            ProjectsPage["projects/page.tsx"]:::build
            ContactPage["contact/page.tsx"]:::build
            ResumePage["resume/page.tsx"]:::build
            RootLayout["layout.tsx"]:::build
            GlobalCSS["globals.css"]:::build
        end

        subgraph "components/"
            subgraph "ui/"
                UIlib["Reusable UI Primitives"]:::build
            end
            subgraph "home/"
                HomeComp["Home Previews & Hero"]:::build
            end
            subgraph "about/"
                AboutComp["About Section"]:::build
            end
            subgraph "projects/"
                ProjectsComp["Projects Cards & Filters"]:::build
            end
            subgraph "resume/"
                ResumeComp["Resume Sections"]:::build
            end
            subgraph "contact/"
                ContactForm["contact-form.tsx"]:::build
            end
            subgraph "layout/"
                Navbar["navbar.tsx"]:::build
                Footer["footer.tsx"]:::build
            end
            subgraph "chatbot/"
                ChatProvider["chatbot-provider.tsx"]:::build
            end
            subgraph "theme/"
                ThemeProv["theme-provider.tsx"]:::build
                ThemeToggle["theme-toggle.tsx"]:::build
            end
        end

        subgraph "hooks/"
            UseToast["use-toast.ts"]:::build
        end

        subgraph "lib/"
            Motion["motion.ts"]:::build
            Utils["utils.ts"]:::build
        end

        subgraph "types/"
            TypeDef["react-colorful.d.ts"]:::build
        end

        ContentlayerConfig["contentlayer.config.ts"]:::build
        PublicAssets["public/"]:::build

        subgraph "configs/"
            NextConfig["next.config.js"]:::build
            TsConfig["tsconfig.json"]:::build
            TailwindConfig["tailwind.config.ts"]:::build
            PostCSSConfig["postcss.config.js"]:::build
            ESLintConfig[".eslintrc.json"]:::build
        end
    end

    %% Click Events for Code Files
    click AppRouter "https://github.com/kalluru498/website_portfolio/tree/main/app/"
    click HomePage "https://github.com/kalluru498/website_portfolio/blob/main/app/page.tsx"
    click AboutPage "https://github.com/kalluru498/website_portfolio/blob/main/app/about/page.tsx"
    click BlogList "https://github.com/kalluru498/website_portfolio/blob/main/app/blog/page.tsx"
    click BlogPost "https://github.com/kalluru498/website_portfolio/blob/main/app/blog/[slug]/page.tsx"
    click ProjectsPage "https://github.com/kalluru498/website_portfolio/blob/main/app/projects/page.tsx"
    click ContactPage "https://github.com/kalluru498/website_portfolio/blob/main/app/contact/page.tsx"
    click ResumePage "https://github.com/kalluru498/website_portfolio/blob/main/app/resume/page.tsx"
    click RootLayout "https://github.com/kalluru498/website_portfolio/blob/main/app/layout.tsx"
    click GlobalCSS "https://github.com/kalluru498/website_portfolio/blob/main/app/globals.css"
    click UIlib "https://github.com/kalluru498/website_portfolio/tree/main/components/ui/"
    click HomeComp "https://github.com/kalluru498/website_portfolio/tree/main/components/home/"
    click AboutComp "https://github.com/kalluru498/website_portfolio/tree/main/components/about/"
    click ProjectsComp "https://github.com/kalluru498/website_portfolio/tree/main/components/projects/"
    click ResumeComp "https://github.com/kalluru498/website_portfolio/tree/main/components/resume/"
    click ContactForm "https://github.com/kalluru498/website_portfolio/blob/main/components/contact/contact-form.tsx"
    click Navbar "https://github.com/kalluru498/website_portfolio/blob/main/components/layout/navbar.tsx"
    click Footer "https://github.com/kalluru498/website_portfolio/blob/main/components/layout/footer.tsx"
    click ChatProvider "https://github.com/kalluru498/website_portfolio/blob/main/components/chatbot/chatbot-provider.tsx"
    click ThemeProv "https://github.com/kalluru498/website_portfolio/blob/main/components/theme-provider.tsx"
    click ThemeToggle "https://github.com/kalluru498/website_portfolio/blob/main/components/theme-toggle.tsx"
    click UseToast "https://github.com/kalluru498/website_portfolio/blob/main/hooks/use-toast.ts"
    click Motion "https://github.com/kalluru498/website_portfolio/blob/main/lib/motion.ts"
    click Utils "https://github.com/kalluru498/website_portfolio/blob/main/lib/utils.ts"
    click TypeDef "https://github.com/kalluru498/website_portfolio/blob/main/types/react-colorful.d.ts"
    click ContentlayerConfig "https://github.com/kalluru498/website_portfolio/blob/main/contentlayer.config.ts"
    click PublicAssets "https://github.com/kalluru498/website_portfolio/tree/main/public/"
    click NextConfig "https://github.com/kalluru498/website_portfolio/blob/main/next.config.js"
    click TsConfig "https://github.com/kalluru498/website_portfolio/blob/main/tsconfig.json"
    click TailwindConfig "https://github.com/kalluru498/website_portfolio/blob/main/tailwind.config.ts"
    click PostCSSConfig "https://github.com/kalluru498/website_portfolio/blob/main/postcss.config.js"
    click ESLintConfig "https://github.com/kalluru498/website_portfolio/blob/main/.eslintrc.json"

    %% Styles
    classDef frontend fill:#fff1a8,stroke:#333,stroke-width:1px
    classDef build fill:#e2e8f0,stroke:#333,stroke-width:1px
    classDef external fill:#a8dfff,stroke:#333,stroke-width:1px
    class Git,CI,ContentData,Build,VercelDeploy,AppRouter,HomePage,AboutPage,BlogList,BlogPost,ProjectsPage,ContactPage,ResumePage,RootLayout,GlobalCSS,UIlib,HomeComp,AboutComp,ProjectsComp,ResumeComp,ContactForm,Navbar,Footer,ChatProvider,ThemeProv,ThemeToggle,UseToast,Motion,Utils,TypeDef,ContentlayerConfig,PublicAssets,NextConfig,TsConfig,TailwindConfig,PostCSSConfig,ESLintConfig build
    class CDN,NextEdge,Browser,ReactUI,ChatComp frontend
    class OpenAI external
```
