# andrew-mathieu/microblog-cms architecture

> Architecture diagram of the GitHub repository andrew-mathieu/microblog-cms, 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/andrew-mathieu/microblog-cms
- Repository: https://github.com/andrew-mathieu/microblog-cms

## Overview

##### Main System Components Identification

The project appears to be a Next.js application with the following key architectural components:

a. Frontend Layer:
- Next.js App Router architecture (indicated by the /app directory)
- Client-side components (in /components directory)
- Admin interface (/app/admin directory)
- Third-party integrations (Soundcloud and Spotify)

b. Backend Layer:
- PocketBase integration (evident from /lib/pb.ts and types/pocketbase-types.ts)
- API routes (implicit in Next.js structure)

c. External Services:
- Google Analytics
- Spotify API
- Soundcloud API

**[Client Layer]**
- ↓
**[Next.js App Router]**
- ↓
**[Server Components/API Layer]**
- ↓
**[PocketBase Backend]**

**[External Services] → [Next.js App Router]**
- Google Analytics
- Spotify
- Soundcloud

##### Component Details

a. Frontend Components (Blue Rectangle):
- Public Pages (/app/page.tsx)
- Admin Dashboard (/app/admin/*)
- UI Components (/components/ui/*)
- Rich Text Editor (Tiptap)

b. Application Logic (Green Hexagon):
- Hooks (/hooks/*)
- Utils (/utils/*)
- Theme Provider
- Toast System

- PocketBase Client
- Type Definitions

d. External Services (Purple Cloud):
- Analytics
- Music Integration Services

##### Data Flow Representation

- Client-Server Communication
- API Calls to External Services
- State Management Flow
- Authentication Flow (especially for admin routes)

##### Technical Stack Highlights

- Next.js 13+ (App Router)
- TypeScript
- TailwindCSS
- PocketBase
- Third-party APIs

##### Environment Configuration

A section showing:
- Environment Variables
- Build Configuration
- API Keys Management

- High-level architecture visibility
- Detailed component relationships
- Clear separation of concerns
- Integration points with external services

- Readable at different zoom levels
- Exportable to common formats
- Easy to update as the architecture evolves
- Documented with clear annotations

Remember to highlight the modern Next.js features being used, such as:
- Server Components
- App Router
- API Routes
- Static/Dynamic Rendering decisions

This will provide a comprehensive view of the application's architecture while maintaining clarity and usefulness for development team members.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser/Client"]
        WebVitals["Web Vitals"]:::monitoring
        click WebVitals "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/web-vitals.tsx"
    end

    subgraph "Next.js Layer"
        AppRouter["App Router"]:::router
        click AppRouter "https://github.com/andrew-mathieu/microblog-cms/blob/main/app/layout.tsx"
        Layout["Layout"]:::frontend
        click Layout "https://github.com/andrew-mathieu/microblog-cms/blob/main/app/page.tsx"
        
        subgraph "Admin Section"
            AdminCreate["Post Creation"]:::admin
            click AdminCreate "https://github.com/andrew-mathieu/microblog-cms/blob/main/app/admin/post/create/page.tsx"
            AdminManage["Post Management"]:::admin
            click AdminManage "https://github.com/andrew-mathieu/microblog-cms/blob/main/app/admin/post/manage/page.tsx"
        end

        subgraph "UI Components"
            BaseUI["Base UI Components"]:::ui
            click BaseUI "https://github.com/andrew-mathieu/microblog-cms/tree/main/components/ui/"
            TipTap["Rich Text Editor"]:::ui
            click TipTap "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/Tiptap.tsx"
            ThemeProvider["Theme Provider"]:::ui
            click ThemeProvider "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/theme-provider.tsx"
            Toast["Toast System"]:::ui
            click Toast "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/toast-component/ToastContainer.tsx"
        end
    end

    subgraph "External Services"
        GA["Google Analytics"]:::external
        click GA "https://github.com/andrew-mathieu/microblog-cms/blob/main/app/GoogleAnalytics.tsx"
        Spotify["Spotify Integration"]:::external
        click Spotify "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/SpotifyIntegration.tsx"
        Soundcloud["Soundcloud Integration"]:::external
        click Soundcloud "https://github.com/andrew-mathieu/microblog-cms/blob/main/components/SoundcloudIntegration.tsx"
    end

    subgraph "Application Logic"
        Utils["Utility Functions"]:::logic
        click Utils "https://github.com/andrew-mathieu/microblog-cms/blob/main/utils/TiptapExtensions.ts"
        Clipboard["Clipboard Utility"]:::logic
        click Clipboard "https://github.com/andrew-mathieu/microblog-cms/blob/main/lib/useCopyToClipboard.ts"
        ColorUtils["Color Utilities"]:::logic
        click ColorUtils "https://github.com/andrew-mathieu/microblog-cms/blob/main/lib/colors.ts"
    end

    subgraph "Data Layer"
        PBClient["PocketBase Client"]:::database
        click PBClient "https://github.com/andrew-mathieu/microblog-cms/blob/main/lib/pb.ts"
        PBTypes["PocketBase Types"]:::database
        click PBTypes "https://github.com/andrew-mathieu/microblog-cms/blob/main/types/pocketbase-types.ts"
        PBHooks["PocketBase Hooks"]:::database
        click PBHooks "https://github.com/andrew-mathieu/microblog-cms/blob/main/hooks/use-pb.ts"
    end

    subgraph "Configuration"
        EnvConfig["Environment Config"]:::config
        click EnvConfig "https://github.com/andrew-mathieu/microblog-cms/blob/main/.env.example"
        NextConfig["Next.js Config"]:::config
        click NextConfig "https://github.com/andrew-mathieu/microblog-cms/blob/main/next.config.js"
        TSConfig["TypeScript Config"]:::config
        click TSConfig "https://github.com/andrew-mathieu/microblog-cms/blob/main/tsconfig.json"
        TailwindConfig["Tailwind Config"]:::config
        click TailwindConfig "https://github.com/andrew-mathieu/microblog-cms/blob/main/tailwind.config.ts"
    end

    Browser --> AppRouter
    AppRouter --> Layout
    AppRouter --> AdminCreate
    AppRouter --> AdminManage
    Layout --> BaseUI
    Layout --> TipTap
    Layout --> ThemeProvider
    Layout --> Toast
    Browser --> WebVitals
    AppRouter --> GA
    AppRouter --> Spotify
    AppRouter --> Soundcloud
    AppRouter --> PBClient
    PBClient --> PBTypes
    PBClient --> PBHooks
    Utils --> TipTap
    Clipboard --> BaseUI
    ColorUtils --> ThemeProvider

    classDef frontend fill:#a8d1ff,stroke:#333
    classDef admin fill:#ffb3b3,stroke:#333
    classDef ui fill:#b3ffb3,stroke:#333
    classDef external fill:#e6b3ff,stroke:#333
    classDef logic fill:#ffd9b3,stroke:#333
    classDef database fill:#ffff99,stroke:#333
    classDef config fill:#d9d9d9,stroke:#333
    classDef router fill:#ff99cc,stroke:#333
    classDef monitoring fill:#99ffeb,stroke:#333
```
