# hancheo/mobilog architecture

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

- Interactive diagram: https://gitdiagram.com/hancheo/mobilog
- Repository: https://github.com/hancheo/mobilog

## Overview

##### Main System Components

a) Client-Side (Frontend):
- Next.js Application Layer
- Component Library
- Theme/Style System
- Client-side Providers (Analytics, Theme)

b) Server-Side:
- API Routes Layer
- Core Services Layer
- Data Sources Layer
- Repository Layer

c) External Services:
- Notion API Integration
- Google Analytics Integration
- Comment System

##### Architectural Patterns to Highlight

The project follows these patterns that should be represented:
- Clean Architecture (visible in the server/services/useCases structure)
- Repository Pattern (server/services/repository)
- Provider Pattern (client/providers)
- Component-based Architecture (client/components)

**[Client Layer]**
- ↕
**[Next.js API Routes]**
- ↕
**[Service Layer]**
- ↕
**[Repository Layer]**
- ↕
**[External Services]**

##### Detailed Component Breakdown

Frontend Section:
- Main components (PostList, Comments, VisitorCounter)
- Core components and layouts
- Providers (ThemeProvider, GoogleAnalyticsProvider)

Backend Section:
- API routes (/api/blog, /api/posts, /api/tags)
- Service layer with use cases
- Repository pattern implementation
- Data sources (Notion, Google Analytics)

##### Key Interactions to Highlight

- Notion Integration Flow
- Visitor Counter System
- Comment System Flow
- Dynamic OG Image Generation
- Search Functionality

##### Technical Details

- Next.js as the framework
- TypeScript implementation
- Tailwind CSS for styling
- API Routes structure
- Clean Architecture implementation

Remember to:
- Use clear, consistent symbols
- Data flow directions
- Separation between client and server components
- Demonstrate the integration points with external services

This will provide a clear understanding of how Mobilog transforms Notion content into a full-featured blog platform with additional capabilities like visitor counting and dynamic image generation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend Application]
        CL[Component Library]
        TS[Theme System]
        
        subgraph Providers
            GAP[Google Analytics Provider]
            TP[Theme Provider]
        end
        
        subgraph Components
            PC[Post Components]
            VC[Visitor Counter]
            CS[Comment System]
            SS[Search System]
        end
    end
    
    subgraph "API Routes"
        AR["/api/blog"]:::api
        PR["/api/posts"]:::api
        TR["/api/tags"]:::api
        SR["/api/search-notion"]:::api
        OG["/api/social-image"]:::api
        VR["/api/visitor"]:::api
    end
    
    subgraph "Service Layer"
        SVC[Core Services]
        UC[Use Cases]
        CAC[Clean Architecture Container]
    end
    
    subgraph "Repository Layer"
        RP[Repository Pattern]
        DS[Data Sources]
    end
    
    subgraph "External Services"
        NA[Notion API]
        GA[Google Analytics]
        CD[Comment Database]
    end
    
    %% Connections
    FE --> AR & PR & TR & SR & OG & VR
    CL --> Components
    Components --> AR
    VC --> VR
    SS --> SR
    
    AR & PR & TR & SR & OG & VR --> SVC
    SVC --> UC
    UC --> RP
    RP --> DS
    DS --> NA & GA & CD
    
    %% Styles
    classDef frontend fill:#3498db,color:white
    classDef service fill:#2ecc71,color:white
    classDef api fill:#e67e22,color:white
    classDef external fill:#9b59b6,color:white
    
    class FE,CL,TS,GAP,TP,PC,VC,CS,SS frontend
    class SVC,UC,CAC service
    class AR,PR,TR,SR,OG,VR api
    class NA,GA,CD external
    
    %% Click Events
    click FE "https://github.com/Hancheo/mobilog/tree/main/pages"
    click CL "https://github.com/Hancheo/mobilog/tree/main/client/components"
    click TS "https://github.com/Hancheo/mobilog/tree/main/client/styles"
    click GAP "https://github.com/Hancheo/mobilog/blob/main/client/providers/GoogleAnalyticsProvider.tsx"
    click TP "https://github.com/Hancheo/mobilog/blob/main/client/providers/ThemeProvider.tsx"
    click AR "https://github.com/Hancheo/mobilog/tree/main/pages/api"
    click SVC "https://github.com/Hancheo/mobilog/tree/main/server/services"
    click DS "https://github.com/Hancheo/mobilog/tree/main/server/datasource"
    click RP "https://github.com/Hancheo/mobilog/tree/main/server/services/repository"
    click NA "https://github.com/Hancheo/mobilog/blob/main/server/datasource/notion/notionClient.ts"
    click GA "https://github.com/Hancheo/mobilog/blob/main/server/datasource/google/googleAnalytics.ts"
    click CS "https://github.com/Hancheo/mobilog/blob/main/client/components/Comment/Comment.tsx"
    click VC "https://github.com/Hancheo/mobilog/blob/main/client/components/VisitorCounter/VisitorCounter.tsx"
    click OG "https://github.com/Hancheo/mobilog/blob/main/pages/api/social-image.tsx"
    click SR "https://github.com/Hancheo/mobilog/blob/main/pages/api/search-notion.ts"
    click CAC "https://github.com/Hancheo/mobilog/blob/main/server/core/container.ts"
```
