# meaningfulbits/socialtool00 architecture

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

- Interactive diagram: https://gitdiagram.com/meaningfulbits/socialtool00
- Repository: https://github.com/meaningfulbits/socialtool00

## Overview

##### Project type and purpose
- This is a command-line tool (an open-source utility) written in Go.
- Its sole purpose is to read Mastodon credentials from a configuration file, call the Mastodon API (via the go-mastodon library), fetch three lists (Followers, Following, Mutuals), and print or pipe those lists to stdout or another program.

##### File structure
- Top-level files
- README.md – explains usage and configuration.
- conf/STDefault.conf – sample config holding clientKey, clientSecret, accessToken, serverURL.
- src/
- go.mod / go.sum – Go module definition, external dependency (go-mastodon).
- main.go – the entire executable entry point.
- There are no frontend/backend directories or databases—this is a simple single-binary CLI tool.

##### README for additional insights
- The README confirms that the only external interaction is the Mastodon API.
- Configuration is done by editing the .conf file.
- Execution is via `go run main.go ./conf/STDefault.conf` or by building the binary.

a. Main components
1. Configuration Loader (reads STDefault.conf)
2. API Client (go-mastodon library wrapper)
3. Data Fetcher (issues three API calls: getFollowers, getFollowing, getMutuals)
4. Data Processor/Formatter (formats the lists as text or JSON)
5. CLI Interface (main.go orchestrates everything, accepts config filepath, flags)
6. External Mastodon Server (third-party service)
b. Relationships & Interactions
- The CLI Interface invokes the Configuration Loader.
- The loader returns credentials to the API Client.
- The CLI then calls the Data Fetcher, which uses the API Client to talk to the Mastodon Server.
- Returned user lists flow back to the Data Processor for formatting.
- Formatted output is sent back to the CLI Interface and printed to stdout or piped.
c. Architectural patterns / design principles
- Single responsibility modules (loader, client, fetcher, processor).
- Dependency injection for the client (keeps code testable).
- External integration isolated behind a thin wrapper (go-mastodon).
d. Key technologies & libraries
- Go (main language)
- go-mastodon (API client)
- Mastodon REST API (external service)
- Toml or similar parser for the .conf file (depending on STDefault.conf format)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Input & Docs"
        CONF["STDefault.conf"]:::config
        README["README.md"]:::doc
    end

    subgraph "Internal Modules"
        Loader["Configuration Loader"]:::internal
        CLI["CLI Interface"]:::internal
        Fetcher["Data Fetcher"]:::internal
        Processor["Data Processor/Formatter"]:::internal
        APIClient["API Client Wrapper"]:::library
        GoMod["go.mod"]:::library
        GoSum["go.sum"]:::library
    end

    Mastodon["Mastodon Server"]:::external
    STDOUT["stdout / pipe"]:::output

    CONF -->|"reads credentials"| Loader
    Loader -->|"provides creds"| CLI
    CLI -->|"initiates fetch"| Fetcher
    Fetcher -->|"uses client"| APIClient
    APIClient -->|"HTTP GET /api/v1/accounts/:id/(followers,following,mutuals)"| Mastodon
    Mastodon -->|"JSON response"| APIClient
    APIClient -->|"user lists"| Fetcher
    Fetcher -->|"raw lists"| Processor
    Processor -->|"formatted output"| CLI
    CLI -->|"prints"| STDOUT
    CLI -->|"imports"| GoMod
    CLI -->|"imports"| GoSum

    click CLI "https://github.com/meaningfulbits/socialtool00/blob/Development/src/main.go"
    click Loader "https://github.com/meaningfulbits/socialtool00/blob/Development/conf/STDefault.conf"
    click APIClient "https://github.com/meaningfulbits/socialtool00/blob/Development/src/main.go"
    click Fetcher "https://github.com/meaningfulbits/socialtool00/blob/Development/src/main.go"
    click Processor "https://github.com/meaningfulbits/socialtool00/blob/Development/src/main.go"
    click GoMod "https://github.com/meaningfulbits/socialtool00/blob/Development/src/go.mod"
    click GoSum "https://github.com/meaningfulbits/socialtool00/blob/Development/src/go.sum"
    click README "https://github.com/meaningfulbits/socialtool00/blob/Development/README.md"

    classDef internal fill:#bbdefb,stroke:#0d47a1
    classDef library fill:#c8e6c9,stroke:#1b5e20
    classDef external fill:#ffe0b2,stroke:#e65100
    classDef config fill:#f3e5f5,stroke:#6a1b9a
    classDef doc fill:#e0e0e0,stroke:#424242
    classDef output fill:#b2dfdb,stroke:#00695c
```
