# gjelbrim/twittermirror architecture

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

- Interactive diagram: https://gitdiagram.com/gjelbrim/twittermirror
- Repository: https://github.com/gjelbrim/twittermirror

## Overview

twittermirror is a Python script that polls a chosen Twitter user's latest tweet and mirrors it through a second account when it differs from that account's latest tweet. Setup gathers credentials and the target handle; configuration supplies them to separate reader and poster clients; the main loop compares tweets and decides when to post or retweet. The README documents this two-account setup and the install-and-run workflow. Source excerpts show the calls and configuration wiring; the Twitter service is inferred from Tweepy API calls.

Main entry points: [`users.py`](https://github.com/gjelbrim/twittermirror/blob/main/users.py) (Tweet poster), [`config.py`](https://github.com/gjelbrim/twittermirror/blob/main/config.py) (Config loader), [`twittermirror.py`](https://github.com/gjelbrim/twittermirror/blob/main/twittermirror.py) (Poll and compare), [`install.py`](https://github.com/gjelbrim/twittermirror/blob/main/install.py) (Credential setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and config"]
  node_installer["Credential setup<br/>[install.py]"]
  node_config_file["config.ini"]
  node_configuration["Config loader<br/>[config.py]"]
end

subgraph group_mirror["Mirroring workflow"]
  node_loop["Poll and compare<br/>[twittermirror.py]"]
end

subgraph group_clients["Twitter clients"]
  node_reader["Tweet reader<br/>[users.py]"]
  node_poster["Tweet poster<br/>[users.py]"]
end

node_operator(("Operator"))
node_twitter{{"Twitter API"}}

node_operator -->|"provides credentials"| node_installer
node_operator -->|"starts script"| node_loop
node_installer -->|"writes settings"| node_config_file
node_config_file -->|"loads settings"| node_configuration
node_configuration -->|"supplies credentials"| node_reader
node_configuration -->|"supplies credentials"| node_poster
node_loop -->|"fetches latest tweet"| node_reader
node_loop -->|"checks and posts"| node_poster
node_reader -->|"reads timeline"| node_twitter
node_poster -->|"posts or retweets"| node_twitter
node_poster -->|"retweets internally"| node_poster

click node_installer "https://github.com/gjelbrim/twittermirror/blob/main/install.py"
click node_configuration "https://github.com/gjelbrim/twittermirror/blob/main/config.py"
click node_loop "https://github.com/gjelbrim/twittermirror/blob/main/twittermirror.py"
click node_reader "https://github.com/gjelbrim/twittermirror/blob/main/users.py"
click node_poster "https://github.com/gjelbrim/twittermirror/blob/main/users.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_installer,node_config_file,node_configuration toneBlue
class node_loop toneAmber
class node_reader,node_poster,node_twitter toneMint
class node_operator toneIndigo
```

## Components

### Setup and config

- [Credential setup](https://github.com/gjelbrim/twittermirror/blob/main/install.py): `install.py`
- **config.ini**
- [Config loader](https://github.com/gjelbrim/twittermirror/blob/main/config.py): `config.py`

### Mirroring workflow

- [Poll and compare](https://github.com/gjelbrim/twittermirror/blob/main/twittermirror.py): `twittermirror.py`

### Twitter clients

- [Tweet reader](https://github.com/gjelbrim/twittermirror/blob/main/users.py): `users.py`
- [Tweet poster](https://github.com/gjelbrim/twittermirror/blob/main/users.py): `users.py`

### Other components

- **Operator**
- **Twitter API**

## Connections

- Operator → Credential setup: provides credentials (evidence: `README.md`)
- Operator → Poll and compare: starts script (evidence: `README.md`)
- Credential setup → config.ini: writes settings (evidence: `install.py`)
- config.ini → Config loader: loads settings (evidence: `config.py`)
- Config loader → Tweet reader: supplies credentials (evidence: `users.py`)
- Config loader → Tweet poster: supplies credentials (evidence: `users.py`)
- Poll and compare → Tweet reader: fetches latest tweet (evidence: `twittermirror.py`)
- Poll and compare → Tweet poster: checks and posts (evidence: `twittermirror.py`)
- Tweet reader → Twitter API: reads timeline (evidence: `users.py`)
- Tweet poster → Twitter API: posts or retweets (evidence: `users.py`)
- Tweet poster → Tweet poster: retweets internally (evidence: `users.py`)
