# umputun/remark42 architecture

> Architecture diagram of the GitHub repository umputun/remark42, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/umputun/remark42
- Repository: https://github.com/umputun/remark42

## Overview

##### Main Components Overview

a) Backend (Go-based):
- Core API Service
- Authentication System
- Storage Engine
- Notification Service
- Migration Tools
- Admin Interface

b) Frontend (JavaScript/TypeScript):
- Comment Widget
- Admin UI
- Authentication UI
- Markdown Editor
- Real-time Updates

c) Data Storage:
- Embedded Database
- File Storage (for images)
- Backup System

##### Key Relationships to Highlight

a) External Integrations:
- Social Login Providers (Google, Facebook, GitHub, etc.)
- Notification Services (Email, Telegram, Slack, Webhook)
- RSS Feeds
- Image Upload/Storage

b) Internal Communications:
- Frontend Widget ↔ Backend API
- Authentication Flow
- Storage Operations
- Notification Pipeline

##### Architectural Patterns

Architectural decisions:

- Microservices-like structure (separate frontend/backend)
- REST API communication
- Event-driven notification system
- Embedded storage architecture
- Multi-site support

##### Detailed Component Breakdown

**┌─ API Layer**
- Public API
- Private API
- Admin API
**┌─ Auth Service**
- Social Providers
- Email Auth
- Anonymous Access
**┌─ Storage Engine**
- Comment Store
- User Store
- Image Store
**┌─ Notification System**
- Email Notifications
- Telegram Bot
- Slack Integration
- Webhooks

**┌─ Widget**
- Comment Thread
- Auth UI
- Markdown Editor
- Voting System
**┌─ Admin Interface**
- Moderation Tools
- User Management
- Site Settings

##### Additional Elements

Supporting elements:
- Version/Environment information
- Security boundaries
- Backup/Restore flows
- Data migration paths

##### Technical Details to Note

Annotations for:
- Docker container boundaries
- API endpoints
- Authentication flows
- Data persistence paths
- Backup/restore processes

Remember to highlight the system's unique features like embedded database usage, stateless design, and the ability to run as a single container or self-contained executable.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        SocialLogin[Social Login Providers]
        NotificationProviders[Notification Providers]
        RSS[RSS Feeds]
    end

    subgraph Backend
        API["Core API Service"]:::backend
        Auth["Authentication System"]:::backend
        Store["Storage Engine"]:::backend
        Notify["Notification Service"]:::backend
        Migrate["Migration Tools"]:::backend
        ImageProxy["Image Proxy"]:::backend

        subgraph Storage
            DB[(Embedded DB)]:::storage
            ImageStore[(Image Storage)]:::storage
            Backup[(Backup System)]:::storage
        end
    end

    subgraph Frontend
        Widget["Comment Widget"]:::frontend
        AdminUI["Admin Interface"]:::frontend
        AuthUI["Authentication UI"]:::frontend
        MarkdownEd["Markdown Editor"]:::frontend
        RealTime["Real-time Updates"]:::frontend
    end

    %% Relationships
    SocialLogin --> Auth
    Auth --> API
    API --> Store
    Store --> DB
    Store --> ImageStore
    ImageProxy --> ImageStore
    Notify --> NotificationProviders
    API --> RSS
    Migrate --> DB
    Migrate --> Backup

    Widget --> API
    AdminUI --> API
    AuthUI --> Auth
    MarkdownEd --> Widget
    RealTime --> API

    %% Click Events
    click API "https://github.com/umputun/remark42/tree/master/backend/app/rest/api/"
    click Auth "https://github.com/umputun/remark42/tree/master/backend/app/providers/"
    click Store "https://github.com/umputun/remark42/tree/master/backend/app/store/"
    click Notify "https://github.com/umputun/remark42/tree/master/backend/app/notify/"
    click Migrate "https://github.com/umputun/remark42/tree/master/backend/app/migrator/"
    click ImageProxy "https://github.com/umputun/remark42/blob/master/backend/app/rest/proxy/image.go"
    click ImageStore "https://github.com/umputun/remark42/tree/master/backend/app/store/image/"
    click Backup "https://github.com/umputun/remark42/blob/master/backend/app/migrator/backup.go"
    click Widget "https://github.com/umputun/remark42/tree/master/frontend/apps/remark42/app/components/comment/"
    click AdminUI "https://github.com/umputun/remark42/tree/master/frontend/apps/remark42/app/components/root/"
    click AuthUI "https://github.com/umputun/remark42/tree/master/frontend/apps/remark42/app/components/auth/"
    click MarkdownEd "https://github.com/umputun/remark42/blob/master/frontend/apps/remark42/app/components/comment-form/markdown-toolbar.tsx"

    %% Styling
    classDef backend fill:#2374ab
    classDef frontend fill:#57a773
    classDef storage fill:#ffc857
    classDef external fill:#8491a3

    %% Legend
    subgraph Legend
        BE[Backend Services]:::backend
        FE[Frontend Components]:::frontend
        ST[Storage]:::storage
        EX[External Services]:::external
    end
```
