# tanselberkant/personalwebapp architecture

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

- Interactive diagram: https://gitdiagram.com/tanselberkant/personalwebapp
- Repository: https://github.com/tanselberkant/personalwebapp

## Overview

##### Main Components

A. Frontend Layer:
- Next.js Application (Client-Side)
- Pages/Routes (/dashboard, /posts, /resume)
- Components (Layout, Home, Dashboard, Posts, Resume)
- Client-Side Utilities

B. Backend Layer:
- Next.js API Routes
- Sanity CMS Integration
- GitHub API Integration

C. External Services:
- Sanity.io (Headless CMS)
- GitHub API
- Content Delivery Network (for images/assets)

**┌─────────────────────────────────────┐**
- Client Layer             │
- (Next.js Pages & React Components) │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- Application Layer           │
- (Next.js API & Sanity Client)    │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- External Services          │
- (Sanity CMS & GitHub API)        │
- ┘

##### Component Details

- Blue: Next.js/React components
- Green: Data services (Sanity, GitHub)
- Orange: API layers
- Purple: External services

##### Key Relationships to Highlight

a. Client-Side Flow:
- How pages (/dashboard, /posts, /resume) connect to their respective components
- Shared layout structure
- Demonstrate theme switching functionality

b. Data Flow:
- Sanity client integration for content management
- GitHub service integration for activity data
- Image optimization and delivery pipeline

##### Technical Stack Callouts

- Next.js 13+ (App Router)
- TypeScript
- Tailwind CSS
- Sanity CMS
- GitHub API

##### Implementation Notes

- The app directory structure (new Next.js 13+ pattern)
- Component organization
- Service integration points
- Data flow between components

##### Recommended Tools

Use tools like:
- Lucidchart
- Or any other professional diagramming tool that supports:
- Nested components

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this project unique, such as the integration of Sanity CMS and the GitHub API for the dashboard features.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Pages[Pages Layer]
        Components[Components Layer]
        Utils[Client Utilities]
    end

    subgraph AppCore[Application Core]
        RootLayout[Root Layout]
        Providers[App Providers]
        Config[Next.js Config]
    end

    subgraph Pages
        Dashboard["/dashboard"]
        Posts["/posts"]
        Resume["/resume"]
        Studio["/studio"]
    end

    subgraph Components
        LayoutComp[Layout Components]
        DashboardComp[Dashboard Components]
        PostsComp[Posts Components]
        ResumeComp[Resume Components]
        HomeComp[Home Components]
        ThemeSwitch[Theme Switcher]
    end

    subgraph Utils
        RouteHandler[Route Handler]
        DateFormat[Date Formatter]
        URLFormat[URL Formatter]
        GitClient[GitHub HTTP Client]
    end

    subgraph Backend
        SanityClient[Sanity Client]
        GitHubService[GitHub Service]
        SanitySchema[Sanity Schema]
        SanityConfig[Sanity Config]
    end

    subgraph ExternalServices
        SanityCMS[Sanity CMS]
        GitHubAPI[GitHub API]
        CDN[Content Delivery Network]
    end

    %% Relationships
    Pages --> Components
    Components --> Utils
    Utils --> Backend
    Backend --> ExternalServices
    AppCore --> Pages
    AppCore --> Components

    %% Click Events
    click Dashboard "https://github.com/tanselberkant/personalWebApp/blob/main/app/dashboard/page.tsx"
    click Posts "https://github.com/tanselberkant/personalWebApp/blob/main/app/posts/page.tsx"
    click Resume "https://github.com/tanselberkant/personalWebApp/blob/main/app/resume/page.tsx"
    click Studio "https://github.com/tanselberkant/personalWebApp/tree/main/app/studio"
    click RootLayout "https://github.com/tanselberkant/personalWebApp/blob/main/app/layout.tsx"
    click Providers "https://github.com/tanselberkant/personalWebApp/blob/main/app/providers.tsx"
    click Config "https://github.com/tanselberkant/personalWebApp/blob/main/next.config.js"
    click LayoutComp "https://github.com/tanselberkant/personalWebApp/tree/main/components/layout"
    click DashboardComp "https://github.com/tanselberkant/personalWebApp/tree/main/components/dashboard"
    click PostsComp "https://github.com/tanselberkant/personalWebApp/tree/main/components/posts"
    click ResumeComp "https://github.com/tanselberkant/personalWebApp/tree/main/components/resume"
    click HomeComp "https://github.com/tanselberkant/personalWebApp/tree/main/components/home"
    click ThemeSwitch "https://github.com/tanselberkant/personalWebApp/blob/main/components/layout/ThemeSwitcher.tsx"
    click RouteHandler "https://github.com/tanselberkant/personalWebApp/blob/main/routes/ClientSideRoute.tsx"
    click DateFormat "https://github.com/tanselberkant/personalWebApp/blob/main/utils/dateFormater.ts"
    click URLFormat "https://github.com/tanselberkant/personalWebApp/blob/main/utils/urlFormater.ts"
    click GitClient "https://github.com/tanselberkant/personalWebApp/blob/main/utils/gitHttpClient.ts"
    click SanityClient "https://github.com/tanselberkant/personalWebApp/blob/main/lib/sanity.client.ts"
    click GitHubService "https://github.com/tanselberkant/personalWebApp/blob/main/services/githubService.ts"
    click SanitySchema "https://github.com/tanselberkant/personalWebApp/tree/main/sanity/schemas"
    click SanityConfig "https://github.com/tanselberkant/personalWebApp/blob/main/sanity.config.ts"

    %% Styling
    classDef page fill:#3498db,stroke:#2980b9,color:white
    classDef component fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#e74c3c,stroke:#c0392b,color:white
    classDef backend fill:#f1c40f,stroke:#f39c12,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef core fill:#1abc9c,stroke:#16a085,color:white

    class Dashboard,Posts,Resume,Studio page
    class LayoutComp,DashboardComp,PostsComp,ResumeComp,HomeComp,ThemeSwitch component
    class RouteHandler,DateFormat,URLFormat,GitClient util
    class SanityClient,GitHubService,SanitySchema,SanityConfig backend
    class SanityCMS,GitHubAPI,CDN external
    class RootLayout,Providers,Config core
```
