# xcarter93/nextjs-portfolio-app architecture

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

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

## Overview

##### Main Components

a) Client Layer:
- Next.js 14 App Router frontend structure
- IDE-style components (Sidebar, Tabs, Terminal)
- Interactive elements (Boot Screen, Background Effects)
- State management (Zustand store and React Context)

b) Server Layer:
- Next.js Server Components and API Routes
- Server Actions for data mutations
- Authentication system (Clerk)

c) External Services:
- PostgreSQL Database (via Prisma ORM)
- WakaTime API Integration
- GitHub API Integration
- Clerk Authentication

**┌─ Client Tier ─────────────────────────┐**
- ┌─ UI Components ─┐ ┌─ State ───────┐ │
- IDE Layout     │ │- Zustand      │ │
- Boot Screen    │ │- TabsContext  │ │
- Terminal       │ └───────────────┘ │
- ┘                    │
- ┘
- ↕ (Next.js App Router)
**┌─ Server Tier ─────────────────────────┐**
- ┌─ API Routes ───┐ ┌─ Server Actions┐ │
- /api/        │ │- actions.ts     │ │
- middleware.ts│ └────────────────┘ │
- ┘                     │
- ┘
- ↕
**┌─ External Services ──────────────────┐**
- ┌─ Data ────────┐ ┌─ Auth ─────────┐│
- PostgreSQL   │ │- Clerk         ││
- WakaTime API │ └───────────────┘││
- GitHub API   │                   ││
- ┘                   ││
- ┘

##### Key Relationships to Highlight

- Real-time updates for coding stats and guest book
- Demonstrate authentication flow through Clerk
- Database interactions through Prisma

##### Additional Elements

- Version numbers for major dependencies
- Deployment flow to Vercel
- Error handling and loading states

This system design should be particularly detailed in showing how the IDE-like interface is achieved through the combination of client-side components and server-side functionality, while also highlighting the integration of external services for features like coding statistics and git history.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Client Layer"
        UI["UI Components"]
        IDE["IDE Layout"]:::component
        Boot["Boot Screen"]:::component
        Terminal["Terminal"]:::component
        Background["Background Effects"]:::component
        Sidebar["IDE Sidebar"]:::component
        Tabs["IDE Tabs"]:::component
        Footer["IDE Footer"]:::component
        
        State["State Management"]
        ZustandStore["Terminal Store"]:::component
        TabsContext["Tabs Context"]:::component
        
        UI --> IDE
        UI --> Boot
        UI --> Terminal
        UI --> Background
        UI --> Sidebar
        UI --> Tabs
        UI --> Footer
        
        State --> ZustandStore
        State --> TabsContext
    end
    
    subgraph "Server Layer"
        API["API Routes"]:::component
        ServerActions["Server Actions"]:::component
        Middleware["Authentication Middleware"]:::component
        Validation["Form Validation"]:::component
    end
    
    subgraph "Data Layer"
        Database["PostgreSQL (Prisma)"]:::component
        DBUtils["Database Utils"]:::component
        
        WakaTime["WakaTime Integration"]
        WakaTimeLib["WakaTime Library"]:::component
        CodingChart["Coding Chart"]:::component
        LanguagesChart["Languages Chart"]:::component
        
        GitHub["GitHub Integration"]
        GitHistory["Git History"]:::component
        GitHubProfile["GitHub Profile"]:::component
        ContributionGraph["Contribution Graph"]:::component
        
        ProjectContent["Project Content (MDX)"]:::component
        
        WakaTime --> WakaTimeLib
        WakaTime --> CodingChart
        WakaTime --> LanguagesChart
        
        GitHub --> GitHistory
        GitHub --> GitHubProfile
        GitHub --> ContributionGraph
        
        Database --> DBUtils
    end
    
    subgraph "External Services"
        ClerkAuth["Clerk Authentication"]
        WakaTimeAPI["WakaTime API"]
        GitHubAPI["GitHub API"]
        PostgreSQL["PostgreSQL Database"]
    end
    
    %% Relationships
    UI --> State
    State --> API
    API --> ServerActions
    API --> Middleware
    ServerActions --> Database
    Database --> PostgreSQL
    WakaTime --> WakaTimeAPI
    GitHub --> GitHubAPI
    Middleware --> ClerkAuth
    
    %% Styling
    classDef component fill:#f9f,stroke:#333,stroke-width:2px
    classDef external fill:#ff9,stroke:#333,stroke-width:2px
    
    %% Click Events
    click IDE "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/IDE/IDELayout.tsx"
    click Boot "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/BootScreen.tsx"
    click ZustandStore "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/store/useTerminalStore.ts"
    click Background "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/Background/ParticlesBackground.tsx"
    click TabsContext "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/contexts/TabsContext.tsx"
    click ServerActions "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/app/actions.ts"
    click Database "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/prisma/schema.prisma"
    click WakaTimeLib "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/lib/wakatime.ts"
    click CodingChart "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/WakaTime/CodingChart.tsx"
    click LanguagesChart "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/WakaTime/LanguagesChart.tsx"
    click GitHistory "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/Git/GitHistory.tsx"
    click GitHubProfile "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/Git/GitHubProfile.tsx"
    click ContributionGraph "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/Git/ContributionGraph.tsx"
    click Sidebar "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/IDE/Sidebar.tsx"
    click Tabs "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/IDE/Tabs.tsx"
    click Footer "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/components/IDE/Footer.tsx"
    click API "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/app/api/last-updated/route.ts"
    click Middleware "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/middleware.ts"
    click ProjectContent "https://github.com/xCarter93/nextjs-portfolio-app/tree/main/src/markdown/projects"
    click Validation "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/lib/validation.ts"
    click DBUtils "https://github.com/xCarter93/nextjs-portfolio-app/blob/main/src/lib/prisma.ts"
```
