# nixrajput/portfolio-nextjs architecture

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

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

## Overview

##### Main Components Identification

a. Frontend Architecture (Primary Focus)
- Next.js Application Layer
- Component Structure
- Routing System
- Static Assets
- Analytics & Monitoring

b. External Services & Integrations
- Google Analytics
- Sentry Error Tracking
- Payment Integration (Razorpay)

**┌─ Client Browser ─────────────────────┐**
- Web Vitals Monitoring              │
- Google Analytics                   │
- Client-side Navigation             │
- ┘

**┌─ Next.js Application ───────────────────────────────┐**
- ┌─ Pages & Routing ─┐ ┌─ Component Structure ─┐    │
- App Router      │ │ - Common Components   │    │
- Dynamic Routes  │ │ - Core Components     │    │
- Error Handling  │ │ - Home Components     │    │
- ┘ │ - Navbar Components    │    │
- ┘    │
- ┌─ State & Hooks ──┐ ┌─ Data Layer ─────────┐    │
- Custom Hooks   │ │ - Constants           │    │
- Window         │ │ - Configuration       │    │
- Viewport       │ │ - Static Data         │    │
- ┘ └────────────────────────┘    │
- ┘

**┌─ External Services ──────────────────┐**
- Sentry Error Tracking             │
- Razorpay Payment Gateway          │
- Google Analytics                  │
- ┘

##### Important Elements to Highlight

a. Component Architecture:
- Hierarchy between components (common → core → feature-specific)
- Separation between UI components and business logic

b. Data Flow:
- How data flows from static files to components
- Interaction between hooks and components
- Demonstrate payment flow integration

c. Performance Monitoring:
- Web Vitals monitoring flow
- Sentry error tracking implementation
- Analytics data flow

##### Implementation Notes

- Use double lines for API boundaries
- Annotations for critical paths
- Error boundaries and fallback handling

##### Optimization Flows

A section showing:
- Static asset optimization
- Image optimization pipeline
- Client-side navigation optimization
- Performance monitoring points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        Browser["Web Browser"]:::client
        WebVitals["Web Vitals Monitoring"]:::monitoring
        click WebVitals "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/components/common/WebVitals.tsx"
        GA["Google Analytics"]:::external
        click GA "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/components/common/GoogleAnalytics.tsx"
    end

    subgraph NextApp["Next.js Application"]
        subgraph Pages["Pages & Routing"]
            AppRouter["App Router"]:::core
            click AppRouter "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/app"
            MainLayout["Main Layout"]:::core
            click MainLayout "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/app/layout.tsx"
            ErrorHandling["Error Handling"]:::core
            click ErrorHandling "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/app/error.tsx"
            LoadingState["Loading State"]:::core
            click LoadingState "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/app/loading.tsx"
        end

        subgraph Components["Component Structure"]
            CommonComps["Common Components"]:::component
            click CommonComps "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/components/common"
            CoreComps["Core Components"]:::component
            click CoreComps "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/components/core"
            HomeComps["Home Components"]:::component
            click HomeComps "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/components/home"
            NavComps["Navbar Components"]:::component
            click NavComps "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/components/navbar"
        end

        subgraph UI["UI Components"]
            Buttons["Button Components"]:::ui
            click Buttons "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/components/common/FilledButton.tsx"
            LayoutComps["Layout Components"]:::ui
            click LayoutComps "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/components/core/GridBox.tsx"
        end

        subgraph State["State & Data Management"]
            CustomHooks["Custom Hooks"]:::state
            click CustomHooks "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/hooks"
            Constants["Constants"]:::data
            click Constants "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/constants"
            StaticData["Static Data"]:::data
            click StaticData "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/data"
            Types["Types"]:::data
            click Types "https://github.com/nixrajput/portfolio-nextjs/tree/master/src/types"
        end

        subgraph Assets["Static Assets"]
            PublicAssets["Public Assets"]:::assets
            click PublicAssets "https://github.com/nixrajput/portfolio-nextjs/tree/master/public"
        end
    end

    subgraph External["External Services"]
        SentryTracking["Sentry Error Tracking"]:::external
        click SentryTracking "https://github.com/nixrajput/portfolio-nextjs/blob/master/sentry.client.config.js"
        RazorPay["Razorpay Payment"]:::external
        click RazorPay "https://github.com/nixrajput/portfolio-nextjs/blob/master/src/components/common/razor-pay-button.tsx"
        Analytics["Analytics Service"]:::external
    end

    %% Relationships
    Browser --> WebVitals
    Browser --> GA
    Browser --> AppRouter
    AppRouter --> MainLayout
    AppRouter --> ErrorHandling
    AppRouter --> LoadingState
    MainLayout --> Components
    Components --> UI
    Components --> State
    Components --> Assets
    ErrorHandling --> SentryTracking
    Components --> RazorPay
    WebVitals --> Analytics

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef core fill:#9cf,stroke:#333,stroke-width:2px
    classDef component fill:#9f9,stroke:#333,stroke-width:2px
    classDef ui fill:#ff9,stroke:#333,stroke-width:2px
    classDef state fill:#f99,stroke:#333,stroke-width:2px
    classDef data fill:#ccc,stroke:#333,stroke-width:2px
    classDef assets fill:#fc9,stroke:#333,stroke-width:2px
    classDef external fill:#c9f,stroke:#333,stroke-width:2px
    classDef monitoring fill:#9fc,stroke:#333,stroke-width:2px
```
