# teampiped/piped architecture

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

- Interactive diagram: https://gitdiagram.com/teampiped/piped
- Repository: https://github.com/teampiped/piped

## Overview

##### Main Components

a) Frontend Layer:
- Vue.js Application (evident from .vue files in src/components)
- PWA Support (indicated by registerServiceWorker.js)
- Components Structure:
- Video Player Components
- User Interface Components (NavBar, Modals, Pages)
- Internationalization System (src/locales)

b) External Integrations:
- SponsorBlock Integration
- LBRY Integration
- Return YouTube Dislike Integration
- NewPipeExtractor Integration

c) Backend Services (to be shown as external components):
- Piped Backend API
- Matrix Federation Protocol
- Content Delivery Network (for video streaming)

##### Key Architectural Elements to Highlight

a) Client-Side Architecture:
- Vue Router (src/router)
- Component-based structure
- Local Storage for Preferences
- Service Worker for PWA functionality

b) Data Flow Patterns:
- Video Content Pipeline
- User Authentication Flow
- Federated Content Delivery
- Multi-region Load Balancing

**┌─────────────────────────────────────────────────────────┐**
- Client Browser                         │
- ┬────────────────────┬─────────────────┤
- Vue.js App    │    Service Worker  │  Local Storage  │
- (PWA Support)   │  (Preferences)  │
- ┴────────────────────┴─────────────────┤
- Component Layer                           │
- ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐  │
- Video   │  │  User   │  │ Playlist│  │  Feed   │  │
- Player  │  │  Auth   │  │ Manager │  │ Handler │  │
- ┘  └─────────┘  └─────────┘  └─────────┘  │
- ┤
- Integration Layer                          │
- ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐  │
- Sponsor  │  │  LBRY   │  │  RYD    │  │ NewPipe │  │
- Block    │  │         │  │ Proxy   │  │Extractor│  │
- ┘  └─────────┘  └─────────┘  └─────────┘  │
- ┘

- ▼            ▼            ▼
**┌──────────────┐ ┌──────────┐ ┌─────────────┐**
- Piped API    │ │ Matrix   │ │ CDN Network │
- Backend      │ │Federation│ │             │
- ┘ └──────────┘ └─────────────┘

##### Documentation Elements
- Notes about the federated architecture
- Document the privacy-preserving design patterns
- Technologies used in each component

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Browser["Client Browser"]
        direction TB
        App["Vue.js App"]
        SW["Service Worker (PWA)"]
        LS[("Local Storage")]
        
        subgraph Components["Component Layer"]
            direction TB
            subgraph VideoComponents["Video Components"]
                VP["Video Player"]
                VI["Video Item"]
                WV["Watch Video"]
                CB["Chapters Bar"]
            end
            
            subgraph UIComponents["UI Components"]
                NB["Navigation Bar"]
                FC["Footer"]
                MS["Modal System"]
                EH["Error Handler"]
                LI["Loading Indicator"]
            end
            
            subgraph AuthComponents["Authentication"]
                LP["Login Page"]
                RP["Register Page"]
            end
            
            subgraph PlaylistComponents["Playlist Management"]
                PP["Playlist Page"]
                PV["Playlist Videos"]
                CPM["Create Playlist Modal"]
                PI["Playlist Item"]
            end
            
            subgraph ContentComponents["Feed & Content"]
                FP["Feed Page"]
                TP["Trending Page"]
                SP["Subscriptions Page"]
                SR["Search Results"]
            end
        end
        
        subgraph Integration["Integration Layer"]
            SB["SponsorBlock"]
            LBRY["LBRY"]
            RYD["Return YouTube Dislike"]
            NPE["NewPipe Extractor"]
        end
    end
    
    subgraph External["External Services"]
        API["Piped Backend API"]
        MF["Matrix Federation"]
        CDN["CDN Network"]
    end
    
    App --> SW
    App --> LS
    Components --> Integration
    Integration --> External
    
    %% Component Mappings
    click App "https://github.com/TeamPiped/Piped/blob/master/src/App.vue"
    click SW "https://github.com/TeamPiped/Piped/blob/master/src/registerServiceWorker.js"
    click VP "https://github.com/TeamPiped/Piped/blob/master/src/components/VideoPlayer.vue"
    click VI "https://github.com/TeamPiped/Piped/blob/master/src/components/VideoItem.vue"
    click WV "https://github.com/TeamPiped/Piped/blob/master/src/components/WatchVideo.vue"
    click CB "https://github.com/TeamPiped/Piped/blob/master/src/components/ChaptersBar.vue"
    click NB "https://github.com/TeamPiped/Piped/blob/master/src/components/NavBar.vue"
    click FC "https://github.com/TeamPiped/Piped/blob/master/src/components/FooterComponent.vue"
    click MS "https://github.com/TeamPiped/Piped/blob/master/src/components/ModalComponent.vue"
    click EH "https://github.com/TeamPiped/Piped/blob/master/src/components/ErrorHandler.vue"
    click LI "https://github.com/TeamPiped/Piped/blob/master/src/components/LoadingIndicatorPage.vue"
    click LP "https://github.com/TeamPiped/Piped/blob/master/src/components/LoginPage.vue"
    click RP "https://github.com/TeamPiped/Piped/blob/master/src/components/RegisterPage.vue"
    click PP "https://github.com/TeamPiped/Piped/blob/master/src/components/PlaylistPage.vue"
    click PV "https://github.com/TeamPiped/Piped/blob/master/src/components/PlaylistVideos.vue"
    click CPM "https://github.com/TeamPiped/Piped/blob/master/src/components/CreatePlaylistModal.vue"
    click PI "https://github.com/TeamPiped/Piped/blob/master/src/components/PlaylistItem.vue"
    click FP "https://github.com/TeamPiped/Piped/blob/master/src/components/FeedPage.vue"
    click TP "https://github.com/TeamPiped/Piped/blob/master/src/components/TrendingPage.vue"
    click SP "https://github.com/TeamPiped/Piped/blob/master/src/components/SubscriptionsPage.vue"
    click SR "https://github.com/TeamPiped/Piped/blob/master/src/components/SearchResults.vue"
    
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef storage fill:#9933CC,color:white
    classDef integration fill:#33CC33,color:white
    classDef external fill:#FF9900,color:white
    
    class LS storage
    class SB,LBRY,RYD,NPE integration
    class API,MF,CDN external
```
