# archiveteam/archivebot architecture

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

- Interactive diagram: https://gitdiagram.com/archiveteam/archivebot
- Repository: https://github.com/archiveteam/archivebot

## Overview

##### Main Components

a) Control Node Layer:
- IRC Interface (bot directory)
- Bookkeeping Programs (cogs directory)
- Dashboard (dashboard directory)

b) Data Storage Layer:
- CouchDB (db directory)
- Redis (for real-time communication)

c) Pipeline Layer:
- Crawler Components (pipeline directory)
- Wpull Integration
- Upload System (uploader directory)

d) Monitoring/Viewing Layer:
- Viewer Application (viewer directory)
- Plumbing Systems (plumbing directory)

##### Specific Implementation Details

Technical elements:
- IRC bot integration with Cinch framework
- CouchDB design documents and ignore patterns
- Redis pub/sub system for real-time updates
- Wpull crawler integration
- Dashboard web interface

##### Key Architectural Patterns to Highlight

- Pub/Sub Pattern: Redis-based communication
- MVC Pattern: In dashboard implementation
- Plugin Architecture: Pipeline extensions
- Service-Oriented Architecture: Separate components communicating via message passing

##### Additional Elements

Supporting details:
- Configuration flows
- Monitoring paths
- Error handling routes
- Backup processes
- Integration points

##### Technical Notes

Annotations for:
- Ruby-based control system
- Python-based pipeline
- JavaScript/Haxe dashboard
- Database schemas
- API endpoints

Remember to:
- Keep components loosely coupled
- Clear boundaries between systems
- Failure recovery paths
- Scalability points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef control fill:#a8d1f0,stroke:#333
    classDef storage fill:#90EE90,stroke:#333
    classDef pipeline fill:#FFB347,stroke:#333
    classDef interface fill:#DDA0DD,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333

    %% User Interaction Layer
    subgraph User
        U[User]
        IRC["IRC Interface"]:::interface
        DASH["Dashboard Interface"]:::interface
    end

    %% Control Layer
    subgraph Control
        BOT["IRC Bot"]:::control
        BOOK["Bookkeeping System"]:::control
        CONF["Configuration System"]:::control
        JOB["Job Management"]:::control
    end

    %% Processing Layer
    subgraph Pipeline
        PIPE["Pipeline System"]:::pipeline
        WPULL["Wpull Integration"]:::pipeline
        UP["Upload System"]:::pipeline
    end

    %% Storage Layer
    subgraph Storage
        COUCH["CouchDB"]:::storage
        REDIS["Redis"]:::storage
        DD["Database Design Docs"]:::storage
        IP["Ignore Patterns"]:::storage
        UA["User Agents"]:::storage
    end

    %% Monitoring Layer
    subgraph Monitoring
        VIEW["Viewer Application"]:::interface
        PLUMB["Plumbing System"]:::control
    end

    %% External Layer
    subgraph External
        ARCH["Archive.org"]:::external
        SITES["Target Websites"]:::external
    end

    %% Relationships
    U --> IRC
    U --> DASH
    IRC --> BOT
    BOT --> BOOK
    BOT --> JOB
    DASH --> JOB
    JOB --> PIPE
    PIPE --> WPULL
    WPULL --> SITES
    WPULL --> UP
    UP --> ARCH
    REDIS --> BOT
    REDIS --> PIPE
    REDIS --> VIEW
    COUCH --> BOT
    COUCH --> PIPE
    COUCH --> VIEW
    DD --> COUCH
    IP --> COUCH
    UA --> COUCH
    VIEW --> PLUMB
    CONF --> BOT
    CONF --> PIPE

    %% Click Events
    click IRC "https://github.com/ArchiveTeam/ArchiveBot/blob/master/bot/bot.rb"
    click BOOK "https://github.com/ArchiveTeam/ArchiveBot/tree/master/cogs/"
    click DASH "https://github.com/ArchiveTeam/ArchiveBot/tree/master/dashboard/"
    click COUCH "https://github.com/ArchiveTeam/ArchiveBot/tree/master/db/"
    click REDIS "https://github.com/ArchiveTeam/ArchiveBot/blob/master/lib/redis_subscriber.rb"
    click PIPE "https://github.com/ArchiveTeam/ArchiveBot/tree/master/pipeline/"
    click WPULL "https://github.com/ArchiveTeam/ArchiveBot/tree/master/pipeline/archivebot/wpull/"
    click UP "https://github.com/ArchiveTeam/ArchiveBot/blob/master/uploader/uploader.py"
    click VIEW "https://github.com/ArchiveTeam/ArchiveBot/tree/master/viewer/archivebotviewer/"
    click PLUMB "https://github.com/ArchiveTeam/ArchiveBot/tree/master/plumbing/"
    click JOB "https://github.com/ArchiveTeam/ArchiveBot/blob/master/lib/job.rb"
    click CONF "https://github.com/ArchiveTeam/ArchiveBot/blob/master/lib/shared_config.yml"
    click DD "https://github.com/ArchiveTeam/ArchiveBot/tree/master/db/design_docs/"
    click IP "https://github.com/ArchiveTeam/ArchiveBot/tree/master/db/ignore_patterns/"
    click UA "https://github.com/ArchiveTeam/ArchiveBot/tree/master/db/user_agents/"
```
