# vihanvt/blogs architecture

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

- Interactive diagram: https://gitdiagram.com/vihanvt/blogs
- Repository: https://github.com/vihanvt/blogs

## Overview

##### Main Components Identification

- Frontend (Next.js Application)
- Content Management System (Sanity)
- Database Layer (Supabase)
- Theme System
- Blog Content Delivery

##### Component Relationships

Use the following connection types:
- Double lines for system boundaries

##### Specific Implementation Details

Frontend Section:
**[Client Browser] → [Next.js App]**
- Pages (app/*)
- Components
- Theme System

CMS Section:
**[Sanity Studio] → [Content API] → [Next.js App]**
- Schemas
- Blog Schema

Database Section:
**[Supabase Client] → [Database Operations]**

##### Important Elements

- Next.js App Router structure
- Sanity Studio admin interface
- Supabase client connections
- Theme toggle system
- Dynamic blog routing
- Static/Dynamic content delivery paths

##### Technical Stack Indicators

- Next.js
- Sanity
- Supabase
- TypeScript
- Tailwind CSS

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        NextApp["Next.js Application"]:::frontend
        click NextApp "https://github.com/vihanvt/blogs/tree/main/app"
        
        subgraph Components
            Pages["Dynamic Pages"]:::frontend
            click Pages "https://github.com/vihanvt/blogs/blob/main/app/blog/[slug]/page.tsx"
            UI["UI Components"]:::frontend
            ThemeSystem["Theme System"]:::frontend
            click ThemeSystem "https://github.com/vihanvt/blogs/blob/main/app/components/theme-provider.tsx"
        end
        
        subgraph UIComponents
            Navbar["Navigation Bar"]:::ui
            click Navbar "https://github.com/vihanvt/blogs/blob/main/app/components/Navbar.tsx"
            LikeBtn["Like Button"]:::ui
            click LikeBtn "https://github.com/vihanvt/blogs/blob/main/app/components/LikeButton.tsx"
            ModeToggle["Mode Toggle"]:::ui
            click ModeToggle "https://github.com/vihanvt/blogs/blob/main/app/components/ModeToggle.tsx"
            SharedUI["Shared UI Elements"]:::ui
            click SharedUI "https://github.com/vihanvt/blogs/tree/main/components/ui"
        end
    end
    
    subgraph CMS
        SanityStudio["Sanity Studio"]:::cms
        click SanityStudio "https://github.com/vihanvt/blogs/blob/main/sanity/sanity.config.ts"
        SanitySchema["Blog Schema"]:::cms
        click SanitySchema "https://github.com/vihanvt/blogs/blob/main/sanity/schemas/blog.ts"
        ContentAPI["Content API"]:::cms
        click ContentAPI "https://github.com/vihanvt/blogs/blob/main/app/lib/sanity.ts"
    end
    
    subgraph Database
        SupabaseClient["Supabase Client"]:::db
        click SupabaseClient "https://github.com/vihanvt/blogs/blob/main/app/lib/supabaseClient.ts"
        DBOperations["Database Operations"]:::db
        Types["Type Definitions"]:::db
        click Types "https://github.com/vihanvt/blogs/blob/main/app/lib/interface.ts"
    end
    
    %% Connections
    Browser --> NextApp
    NextApp --> Pages
    NextApp --> UI
    NextApp --> ThemeSystem
    
    UI --> Navbar
    UI --> LikeBtn
    UI --> ModeToggle
    UI --> SharedUI
    
    SanityStudio --> SanitySchema
    SanitySchema --> ContentAPI
    ContentAPI -.-> NextApp
    
    SupabaseClient --> DBOperations
    DBOperations -.-> NextApp
    Types -.-> DBOperations
    
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef ui fill:#2ecc71,stroke:#27ae60,color:white
    classDef cms fill:#e74c3c,stroke:#c0392b,color:white
    classDef db fill:#f39c12,stroke:#d35400,color:white
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        UIComp["UI Component"]:::ui
        CMSComp["CMS Component"]:::cms
        DBComp["Database Component"]:::db
    end
```
