# chuot/rdio-scanner architecture

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

- Interactive diagram: https://gitdiagram.com/chuot/rdio-scanner
- Repository: https://github.com/chuot/rdio-scanner

## Overview

##### Main Components Identification

a) Frontend (Client)
- Angular-based web application
- Progressive Web App (PWA) capabilities
- Native mobile apps (iOS/Android)

b) Backend (Server)
- Go-based server application
- API endpoints
- WebSocket connections for live feed

c) External Systems
- Various radio recorder integrations
- File system watchers
- Database storage

**[Client Layer]**
- Web Application (Angular)
- Mobile Apps (iOS/Android)
- ↕ (HTTP/WebSocket)
**[Server Layer]**
- API Gateway
- Authentication/Authorization
- Core Services
- ↕
**[Integration Layer]**
- Directory Watchers
- API Connectors
- File Processors
- ↕
**[Storage Layer]**
- Database
- File Storage

##### Component Details

Frontend Components (Blue):
- Admin interface
- Search functionality
- Live feed components
- Mobile apps as parallel clients

Backend Services (Green):
- API endpoints (/api)
- WebSocket handlers
- Authentication service
- File processing service
- Configuration management
- Downstream distribution

Integration Points (Orange):
- Directory watch service
- API connectors for different recorders
- FFmpeg processing
- File system interactions

Storage (Purple):
- Database connections
- Audio file storage
- Configuration storage

##### Data Flow Indicators

- Client-server communication (HTTP/WebSocket)
- Audio file ingestion paths
- Live streaming paths
- Configuration management flows
- Authentication flows

##### Additional Elements

Notes for:
- Scalability points
- Security boundaries
- Configuration options
- Deployment considerations
- Docker container boundaries

Remember to highlight the system's unique features:
- Real-time audio streaming
- Multiple recorder support
- Administrative capabilities
- Mobile app integration
- Access control and security

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef storage fill:#e1d5e7,stroke:#9673a6
    classDef integration fill:#fff2cc,stroke:#d6b656

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        WebApp["Web Application (Angular)"]
        AdminUI["Admin Interface"]
        SearchComp["Search Component"]
        LiveFeed["Live Feed Component"]
        MobileApps["Native Mobile Apps"]
    end

    %% Server Layer
    subgraph ServerLayer["Server Layer"]
        APIGateway["API Gateway"]
        WebSocket["WebSocket Handler"]
        AuthService["Authentication Service"]
        ConfigMgmt["Configuration Management"]
        FileProcessor["File Processing Service"]
    end

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        DirWatcher["Directory Watcher"]
        FFmpeg["FFmpeg Processing"]
        APIConnectors["Radio Recorder Connectors"]
    end

    %% Storage Layer
    subgraph StorageLayer["Storage Layer"]
        DB[(Database)]
        FileStore[(File Storage)]
    end

    %% Relationships
    WebApp --> APIGateway
    WebApp --> WebSocket
    AdminUI --> APIGateway
    SearchComp --> APIGateway
    LiveFeed --> WebSocket
    MobileApps --> APIGateway
    MobileApps --> WebSocket

    APIGateway --> AuthService
    APIGateway --> ConfigMgmt
    APIGateway --> FileProcessor
    WebSocket --> FileProcessor

    DirWatcher --> FileProcessor
    APIConnectors --> FileProcessor
    FileProcessor --> FFmpeg
    FFmpeg --> FileStore

    AuthService --> DB
    ConfigMgmt --> DB
    FileProcessor --> DB
    FileProcessor --> FileStore

    %% Component Styling
    class WebApp,AdminUI,SearchComp,LiveFeed,MobileApps frontend
    class APIGateway,WebSocket,AuthService,ConfigMgmt,FileProcessor backend
    class DirWatcher,FFmpeg,APIConnectors integration
    class DB,FileStore storage

    %% Click Events
    click WebApp "https://github.com/chuot/rdio-scanner/blob/master/client/src/app/components/rdio-scanner/rdio-scanner.component.ts"
    click AdminUI "https://github.com/chuot/rdio-scanner/tree/master/client/src/app/components/rdio-scanner/admin/"
    click SearchComp "https://github.com/chuot/rdio-scanner/tree/master/client/src/app/components/rdio-scanner/search/"
    click LiveFeed "https://github.com/chuot/rdio-scanner/tree/master/client/src/app/components/rdio-scanner/main/"
    click MobileApps "https://github.com/chuot/rdio-scanner/tree/master/client/src/app/components/rdio-scanner/native/"
    click APIGateway "https://github.com/chuot/rdio-scanner/blob/master/server/api.go"
    click WebSocket "https://github.com/chuot/rdio-scanner/blob/master/server/livefeed.go"
    click AuthService "https://github.com/chuot/rdio-scanner/blob/master/server/access.go"
    click ConfigMgmt "https://github.com/chuot/rdio-scanner/blob/master/server/config.go"
    click DirWatcher "https://github.com/chuot/rdio-scanner/blob/master/server/dirwatch.go"
    click FFmpeg "https://github.com/chuot/rdio-scanner/blob/master/server/ffmpeg.go"
    click FileProcessor "https://github.com/chuot/rdio-scanner/blob/master/server/call.go"
    click DB "https://github.com/chuot/rdio-scanner/blob/master/server/database.go"
```
