# rssnext/follow architecture

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

- Interactive diagram: https://gitdiagram.com/rssnext/follow
- Repository: https://github.com/rssnext/follow

## Overview

##### High-Level Architecture Components

a) Client Applications:
- Web App (Browser-based)
- Desktop App (Electron)
- Mobile App (React Native)
- Server Application

b) Core Services:
- Authentication Service
- Feed Management Service
- Content Processing Service
- AI Services (translation, summary)
- Wallet/Power Token Service
- Real-time Updates Service

##### Key Architectural Patterns to Highlight

- Monorepo structure with shared packages
- Multi-platform architecture
- Event-driven communication
- State management patterns
- Data synchronization flows

##### Detailed Component Breakdown

Create sections for:

Frontend Layer:
- UI Components (packages/components)
- State Management (using Jotai - evident from atoms folders)
- Routing System
- Platform-specific Views
- Shared Utils & Hooks

Backend Layer:
- API Routes
- Database Interactions
- Authentication
- Feed Processing
- Content Storage

Integration Layer:
- RSS Feed Handlers
- AI Service Integration
- Payment Processing
- Real-time Updates

##### Data Flow Representation

Flow of:
- Feed subscription and updates
- Content synchronization
- User authentication
- AI processing requests
- Power token transactions

##### Specific Implementation Details

Technology-specific elements:
- Vite for build system
- Electron for desktop
- React Native for mobile
- Tailwind for styling
- i18n for localization
- Database systems

- Client Applications                                     |

- Web App   |  | Desktop Client |  | Mobile App |  | Progressive Web App     |       |

- v

- Shared Core Logic                                       |

- State Manager  |  | UI Components  |  | Utils/Helpers |  | Platform Adapters    |    |

- v

- Service Layer                                          |

- Feed Service   |  | AI Processing  |  | Auth Service  |  | Power Token Service |     |

- v

- External Services                                       |

- RSS Sources    |  | AI APIs        |  | Payment Gates |  | Storage Services     |    |

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Applications Layer
    subgraph Clients
        WebApp["Web App"]
        Desktop["Desktop App"]
        Mobile["Mobile App"]
        Server["Server App"]
    end

    %% Core Services Layer
    subgraph CoreServices
        AuthService["Authentication Service"]:::service
        FeedService["Feed Management Service"]:::service
        ContentService["Content Processing Service"]:::service
        AIService["AI Services"]:::service
        WalletService["Wallet/Power Token Service"]:::service
        RTService["Real-time Updates Service"]:::service
    end

    %% Frontend Layer
    subgraph Frontend
        UIComponents["UI Components"]:::frontend
        StateManagement["State Management"]:::frontend
        Routing["Routing System"]:::frontend
        PlatformViews["Platform-specific Views"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        APIRoutes["API Routes"]:::backend
        DBInteractions["Database Interactions"]:::backend
        AuthModule["Authentication Module"]:::backend
        FeedProcessor["Feed Processing"]:::backend
    end

    %% Integration Layer
    subgraph Integration
        RSSHandlers["RSS Feed Handlers"]:::integration
        AIIntegration["AI Service Integration"]:::integration
        PaymentProc["Payment Processing"]:::integration
        RTUpdates["Real-time Updates"]:::integration
    end

    %% Shared Resources
    subgraph Shared
        CommonComps["Common Components"]:::shared
        Constants["Constants"]:::shared
        Utils["Utilities"]:::shared
        Types["Types"]:::shared
    end

    %% Relationships
    Clients --> CoreServices
    CoreServices --> Frontend
    CoreServices --> Backend
    Backend --> Integration
    Frontend --> Integration
    Integration --> Shared

    %% Styling
    classDef service fill:#f9f,stroke:#333
    classDef frontend fill:#bbf,stroke:#333
    classDef backend fill:#bfb,stroke:#333
    classDef integration fill:#fbb,stroke:#333
    classDef shared fill:#ddd,stroke:#333

    %% Click Events
    click WebApp "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/"
    click Desktop "https://github.com/RSSNext/Follow/tree/dev/apps/main/"
    click Mobile "https://github.com/RSSNext/Follow/tree/dev/apps/mobile/"
    click Server "https://github.com/RSSNext/Follow/tree/dev/apps/server/"
    click AuthService "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/services/auth.ts"
    click FeedService "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/services/feed.ts"
    click ContentService "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/services/entry.ts"
    click AIService "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/ai/"
    click WalletService "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/power/"
    click RTService "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/workers/sw/"
    click UIComponents "https://github.com/RSSNext/Follow/tree/dev/packages/components/src/ui/"
    click StateManagement "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/store/"
    click Routing "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/router.tsx"
    click PlatformViews "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/app-layout/"
    click APIRoutes "https://github.com/RSSNext/Follow/tree/dev/apps/server/api/"
    click DBInteractions "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/database/"
    click AuthModule "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/auth/"
    click FeedProcessor "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/services/feed.ts"
    click RSSHandlers "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/rsshub/"
    click AIIntegration "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/ai/"
    click PaymentProc "https://github.com/RSSNext/Follow/tree/dev/apps/renderer/src/modules/wallet/"
    click RTUpdates "https://github.com/RSSNext/Follow/blob/dev/apps/renderer/src/workers/sw/pusher.ts"
    click CommonComps "https://github.com/RSSNext/Follow/tree/dev/packages/components/"
    click Constants "https://github.com/RSSNext/Follow/tree/dev/packages/constants/"
    click Utils "https://github.com/RSSNext/Follow/tree/dev/packages/utils/"
    click Types "https://github.com/RSSNext/Follow/tree/dev/packages/types/"
```
