# chauhan-yuvraj/portfolio architecture

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

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

## Overview

#### Purpose and Entry Points
This is a Next.js 14 App Router frontend for a personal portfolio with an embedded AI assistant (“UV”). The root application shell is `app/layout.tsx`; the primary portfolio route is `app/(app)/page.tsx`. Route groups separate main portfolio presentation, chat UI, and sidebar composition without necessarily creating URL segments.

#### Portfolio Composition
The portfolio is assembled from feature-oriented visual sections: header/introduction, bio, overview/contact, experience history, and projects. The main content building blocks reside in `app/(main)/components/CenterContent.tsx`, `app/(main)/components/bio/index.tsx`, and `app/(main)/components/projects/index.tsx`. These components render a profile-specific, largely data-driven portfolio rather than querying a portfolio CMS.

#### Profile Data Boundary
Static portfolio domain data is centralized under `features/profile/data`, with matching TypeScript contracts under `features/profile/types`. Core sources include `features/profile/data/user.ts`, `features/profile/data/experiences.ts`, and `features/profile/data/projects.ts`. This creates a boundary between reusable presentation components and the owner-specific content, including blogs, social links, technology stack, and GitHub contribution data.

#### Chat Client and Conversation Flow
The chat experience is decomposed into display, input, and framing components: `app/(chat)/ChatSection.tsx`, `app/(chat)/ChatBody.tsx`, and `app/(chat)/ChatFooter.tsx`. User input, conversation history, and a persisted user name are packaged client-side; responses are rendered into the chat body, including any returned identity updates. The README identifies LocalStorage as the persistence mechanism and a typing/animated response presentation.

#### Backend and AI Integration Boundary
`services/chatService.ts` is the frontend’s REST boundary to an external Python/FastAPI MCP backend. The backend—not this repository—uses Google Gemini and MCP tools to answer portfolio questions, inspect resume/static context, and retrieve live GitHub information such as stars, streaks, and repositories. Production is described as a Render-hosted endpoint; frontend failure/loading behavior should remain isolated at this service boundary.

#### Layout, Navigation, and Responsive Behavior
A desktop sidebar and responsive chat/portfolio layout are represented by `app/(sidebar)/SideBar.tsx`, `app/(sidebar)/components/SideBarBodySection.tsx`, and `components/SideBar.tsx`. Scroll-related cross-component state is exposed through `app/contexts/ScrollContext.tsx`, likely coordinating navigation with portfolio sections. The architecture supports persistent desktop navigation and a mobile chat drawer.

#### Shared UI and Runtime
The runtime is TypeScript/React on Next.js, styled through global CSS and Tailwind-oriented UI primitives. Shared visual infrastructure includes `components/provider.tsx`, `components/ui/button.tsx`, and `components/ui/contribution-graph.tsx`; animation behavior uses Framer Motion per the README. Supporting integrations include DiceBear for name-derived pixel avatars, Lucide icons, GitHub-derived contribution display, and phone-number metadata/utilities in `assets/libphonenumber.metadata.json` and `lib/libphonenumber.ts`.

Main entry points: [`app/(main)/components/CenterContent.tsx`](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/CenterContent.tsx) (Portfolio Content), [`app/layout.tsx`](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/layout.tsx) (Application Shell), [`features/profile/data`](https://github.com/chauhan-yuvraj/portfolio/tree/main/features/profile/data) (Profile Data), [`app/(chat)/ChatSection.tsx`](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatSection.tsx) (Chat Frame)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Next.js Runtime"]
  node_app_shell["Application Shell<br/>Next.js layout<br/>[layout.tsx]"]
  node_portfolio_route["Portfolio Route<br/>App Router page<br/>[page.tsx]"]
end

subgraph group_portfolio["Portfolio"]
  node_portfolio_content["Portfolio Content<br/>section composition<br/>[CenterContent.tsx]"]
  node_bio_section["Bio Section<br/>portfolio section<br/>[index.tsx]"]
  node_projects_section["Projects Section<br/>portfolio section<br/>[index.tsx]"]
  node_profile_contracts["Profile Contracts<br/>TypeScript types"]
  node_profile_data[("Profile Data<br/>static domain data")]
end

subgraph group_chat["Chat Assistant"]
  node_chat_section["Chat Frame<br/>chat composition<br/>[ChatSection.tsx]"]
  node_chat_body["Conversation Display<br/>chat renderer<br/>[ChatBody.tsx]"]
  node_chat_footer["Chat Input<br/>[ChatFooter.tsx]"]
  node_browser_storage[("LocalStorage<br/>browser persistence")]
  node_chat_service{{"Chat Service<br/>REST client boundary<br/>[chatService.ts]"}}
  node_mcp_backend{{"External MCP Backend<br/>FastAPI AI service"}}
end

subgraph group_shared["Shared UI &amp; State"]
  node_desktop_sidebar["Desktop Sidebar<br/>navigation composition<br/>[SideBar.tsx]"]
  node_sidebar_body["Sidebar Body<br/>navigation content"]
  node_responsive_sidebar["Responsive Sidebar<br/>mobile navigation<br/>[SideBar.tsx]"]
  node_scroll_context["Scroll Context<br/>React context<br/>[ScrollContext.tsx]"]
  node_ui_provider["UI Provider<br/>shared provider<br/>[provider.tsx]"]
  node_ui_primitives["UI Primitives<br/>shared components<br/>[button.tsx]"]
  node_phone_utilities["Phone Utilities<br/>phone metadata utility<br/>[libphonenumber.ts]"]
end

node_app_shell -->|"renders"| node_portfolio_route
node_app_shell -->|"wraps"| node_ui_provider
node_portfolio_route -->|"composes"| node_portfolio_content
node_portfolio_content -->|"renders"| node_bio_section
node_portfolio_content -->|"renders"| node_projects_section
node_portfolio_content -->|"reads"| node_profile_data
node_bio_section -->|"reads"| node_profile_data
node_projects_section -->|"reads"| node_profile_data
node_profile_data -->|"conforms to"| node_profile_contracts
node_app_shell -->|"hosts"| node_chat_section
node_chat_section -->|"renders"| node_chat_body
node_chat_section -->|"renders"| node_chat_footer
node_chat_footer -->|"persists user state"| node_browser_storage
node_chat_footer -->|"sends messages"| node_chat_service
node_chat_service -->|"REST requests"| node_mcp_backend
node_mcp_backend -.->|"assistant responses"| node_chat_body
node_app_shell -->|"hosts"| node_desktop_sidebar
node_desktop_sidebar -->|"composes"| node_sidebar_body
node_app_shell -->|"adapts for mobile"| node_responsive_sidebar
node_desktop_sidebar -->|"navigates through"| node_scroll_context
node_scroll_context -.->|"coordinates sections"| node_portfolio_content
node_portfolio_content -->|"uses"| node_ui_primitives
node_portfolio_content -->|"formats contact data"| node_phone_utilities

click node_app_shell "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/layout.tsx"
click node_portfolio_route "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(app)/page.tsx"
click node_portfolio_content "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/CenterContent.tsx"
click node_bio_section "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/bio/index.tsx"
click node_projects_section "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/projects/index.tsx"
click node_profile_contracts "https://github.com/chauhan-yuvraj/portfolio/tree/main/features/profile/types"
click node_profile_data "https://github.com/chauhan-yuvraj/portfolio/tree/main/features/profile/data"
click node_chat_section "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatSection.tsx"
click node_chat_body "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatBody.tsx"
click node_chat_footer "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatFooter.tsx"
click node_chat_service "https://github.com/chauhan-yuvraj/portfolio/blob/main/services/chatService.ts"
click node_desktop_sidebar "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(sidebar)/SideBar.tsx"
click node_sidebar_body "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(sidebar)/components/SideBarBodySection.tsx"
click node_responsive_sidebar "https://github.com/chauhan-yuvraj/portfolio/blob/main/components/SideBar.tsx"
click node_scroll_context "https://github.com/chauhan-yuvraj/portfolio/blob/main/app/contexts/ScrollContext.tsx"
click node_ui_provider "https://github.com/chauhan-yuvraj/portfolio/blob/main/components/provider.tsx"
click node_ui_primitives "https://github.com/chauhan-yuvraj/portfolio/blob/main/components/ui/button.tsx"
click node_phone_utilities "https://github.com/chauhan-yuvraj/portfolio/blob/main/lib/libphonenumber.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_shell,node_portfolio_route toneBlue
class node_portfolio_content,node_bio_section,node_projects_section,node_profile_contracts,node_profile_data toneAmber
class node_chat_section,node_chat_body,node_chat_footer,node_browser_storage,node_chat_service,node_mcp_backend toneMint
class node_desktop_sidebar,node_sidebar_body,node_responsive_sidebar,node_scroll_context,node_ui_provider,node_ui_primitives,node_phone_utilities toneRose
```

## Components

### Next.js Runtime

- [Application Shell](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/layout.tsx): Next.js layout · `app/layout.tsx`
- [Portfolio Route](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(app)/page.tsx): App Router page · `app/(app)/page.tsx`

### Portfolio

- [Portfolio Content](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/CenterContent.tsx): section composition · Composes header, introduction, overview, contact, and experience sections. · `app/(main)/components/CenterContent.tsx`
- [Bio Section](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/bio/index.tsx): portfolio section · `app/(main)/components/bio/index.tsx`
- [Projects Section](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(main)/components/projects/index.tsx): portfolio section · `app/(main)/components/projects/index.tsx`
- [Profile Contracts](https://github.com/chauhan-yuvraj/portfolio/tree/main/features/profile/types): TypeScript types · Contracts for reusable profile presentation and content. · `features/profile/types`
- [Profile Data](https://github.com/chauhan-yuvraj/portfolio/tree/main/features/profile/data): static domain data · Owner-specific content including profile, experience, projects, links, and GitHub data. · `features/profile/data`

### Chat Assistant

- [Chat Frame](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatSection.tsx): chat composition · Hosts the assistant conversation interface. · `app/(chat)/ChatSection.tsx`
- [Conversation Display](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatBody.tsx): chat renderer · Renders history, typing presentation, and identity updates. · `app/(chat)/ChatBody.tsx`
- [Chat Input](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(chat)/ChatFooter.tsx): chat input · Packages user input and persisted user name. · `app/(chat)/ChatFooter.tsx`
- **LocalStorage**: browser persistence · Persists chat-side user state.
- [Chat Service](https://github.com/chauhan-yuvraj/portfolio/blob/main/services/chatService.ts): REST client boundary · Isolates loading and failure behavior for backend requests. · `services/chatService.ts`
- **External MCP Backend**: FastAPI AI service · Uses Gemini and MCP tools for portfolio and live GitHub answers.

### Shared UI & State

- [Desktop Sidebar](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(sidebar)/SideBar.tsx): navigation composition · `app/(sidebar)/SideBar.tsx`
- [Sidebar Body](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/(sidebar)/components/SideBarBodySection.tsx): navigation content · `app/(sidebar)/components/SideBarBodySection.tsx`
- [Responsive Sidebar](https://github.com/chauhan-yuvraj/portfolio/blob/main/components/SideBar.tsx): mobile navigation · Supports the mobile chat drawer layout. · `components/SideBar.tsx`
- [Scroll Context](https://github.com/chauhan-yuvraj/portfolio/blob/main/app/contexts/ScrollContext.tsx): React context · Coordinates scrolling and section navigation. · `app/contexts/ScrollContext.tsx`
- [UI Provider](https://github.com/chauhan-yuvraj/portfolio/blob/main/components/provider.tsx): shared provider · `components/provider.tsx`
- [UI Primitives](https://github.com/chauhan-yuvraj/portfolio/blob/main/components/ui/button.tsx): shared components · Includes buttons and GitHub contribution graph rendering. · `components/ui/button.tsx`
- [Phone Utilities](https://github.com/chauhan-yuvraj/portfolio/blob/main/lib/libphonenumber.ts): phone metadata utility · `lib/libphonenumber.ts`

## Connections

- Application Shell → Portfolio Route: renders
- Application Shell → UI Provider: wraps
- Portfolio Route → Portfolio Content: composes
- Portfolio Content → Bio Section: renders
- Portfolio Content → Projects Section: renders
- Portfolio Content → Profile Data: reads
- Bio Section → Profile Data: reads
- Projects Section → Profile Data: reads
- Profile Data → Profile Contracts: conforms to
- Application Shell → Chat Frame: hosts
- Chat Frame → Conversation Display: renders
- Chat Frame → Chat Input: renders
- Chat Input → LocalStorage: persists user state
- Chat Input → Chat Service: sends messages
- Chat Service → External MCP Backend: REST requests
- External MCP Backend → Conversation Display: assistant responses
- Application Shell → Desktop Sidebar: hosts
- Desktop Sidebar → Sidebar Body: composes
- Application Shell → Responsive Sidebar: adapts for mobile
- Desktop Sidebar → Scroll Context: navigates through
- Scroll Context → Portfolio Content: coordinates sections
- Portfolio Content → UI Primitives: uses
- Portfolio Content → Phone Utilities: formats contact data
