# dimdengd/oldtwitter architecture

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

- Interactive diagram: https://gitdiagram.com/dimdengd/oldtwitter
- Repository: https://github.com/dimdengd/oldtwitter

## Overview

OldTwitter is a browser extension that replaces Twitter’s client interface with an old-style (or optional 2018-style) experience. Users navigate extension-rendered pages for timelines, profiles, search, lists, tweets, and notifications; page modules obtain Twitter data through the shared API layer and render it in the browser. Settings and shared runtime modules support customization and common behavior. The excerpts show several page-to-API calls, but do not expose the extension’s full bootstrap wiring or the API transport implementation, so those links are omitted rather than inferred.

Main entry points: [`scripts/apis.js`](https://github.com/dimdengd/oldtwitter/blob/master/scripts/apis.js) (Twitter API client), [`layouts/header/script.js`](https://github.com/dimdengd/oldtwitter/blob/master/layouts/header/script.js) (Header and inbox), [`layouts/lists/script.js`](https://github.com/dimdengd/oldtwitter/blob/master/layouts/lists/script.js) (Lists), [`layouts/search/script.js`](https://github.com/dimdengd/oldtwitter/blob/master/layouts/search/script.js) (Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Extension runtime"]
  node_injection["Page injection<br/>[injection.js]"]
  node_background["Background runtime<br/>[background.js]"]
end

subgraph group_pages["Social interface"]
  node_header["Header and inbox<br/>[script.js]"]
  node_home["Home timeline<br/>[script.js]"]
  node_profile["Profiles<br/>[script.js]"]
  node_lists["Lists<br/>[script.js]"]
  node_search["Search<br/>[script.js]"]
  node_tweet["Tweet detail<br/>[script.js]"]
  node_notifications["Notifications<br/>[script.js]"]
  node_topics["Topics<br/>[script.js]"]
  node_bookmarks["Bookmarks<br/>[script.js]"]
  node_unfollows["Unfollower tracking<br/>[script.js]"]
  node_itl["Timeline variants<br/>[script.js]"]
end

subgraph group_shared["Shared services"]
  node_config["Configuration<br/>[config.js]"]
  node_api["Twitter API client<br/>[apis.js]"]
  node_helpers["Shared helpers<br/>[helpers.js]"]
  node_tweetview["Tweet rendering"]
  node_tweetviewer["Media viewer<br/>[tweetviewer.js]"]
  node_emoji["Emoji picker<br/>[emojipicker.js]"]
  node_gif["GIF encoding<br/>[gif.js]"]
  node_gifworker["GIF worker<br/>[gif.worker.js]"]
  node_text["Twitter text utilities<br/>[twitter-text.js]"]
end

subgraph group_prefs["Customization"]
  node_settings["Settings<br/>[script.js]"]
end

node_user(("Extension user"))
node_browser["Browser extension host"]

node_user -->|"uses extension"| node_browser
node_header -->|"requests inbox and search"| node_api
node_lists -->|"requests list data"| node_api
node_search -->|"requests search results"| node_api
node_tweet -->|"requests tweet data"| node_api
node_notifications -->|"requests notifications"| node_api
node_topics -->|"requests topic data"| node_api
node_itl -->|"requests account and timeline data"| node_api
node_browser -.->|"loads page replacement"| node_injection
node_browser -.->|"runs extension background"| node_background

click node_injection "https://github.com/dimdengd/oldtwitter/blob/master/scripts/injection.js"
click node_background "https://github.com/dimdengd/oldtwitter/blob/master/scripts/background.js"
click node_config "https://github.com/dimdengd/oldtwitter/blob/master/scripts/config.js"
click node_api "https://github.com/dimdengd/oldtwitter/blob/master/scripts/apis.js"
click node_helpers "https://github.com/dimdengd/oldtwitter/blob/master/scripts/helpers.js"
click node_tweetview "https://github.com/dimdengd/oldtwitter/blob/master/scripts/tweetConstructor.js"
click node_tweetviewer "https://github.com/dimdengd/oldtwitter/blob/master/scripts/tweetviewer.js"
click node_header "https://github.com/dimdengd/oldtwitter/blob/master/layouts/header/script.js"
click node_home "https://github.com/dimdengd/oldtwitter/blob/master/layouts/home/script.js"
click node_profile "https://github.com/dimdengd/oldtwitter/blob/master/layouts/profile/script.js"
click node_lists "https://github.com/dimdengd/oldtwitter/blob/master/layouts/lists/script.js"
click node_search "https://github.com/dimdengd/oldtwitter/blob/master/layouts/search/script.js"
click node_tweet "https://github.com/dimdengd/oldtwitter/blob/master/layouts/tweet/script.js"
click node_notifications "https://github.com/dimdengd/oldtwitter/blob/master/layouts/notifications/script.js"
click node_topics "https://github.com/dimdengd/oldtwitter/blob/master/layouts/topics/script.js"
click node_bookmarks "https://github.com/dimdengd/oldtwitter/blob/master/layouts/bookmarks/script.js"
click node_unfollows "https://github.com/dimdengd/oldtwitter/blob/master/layouts/unfollows/script.js"
click node_itl "https://github.com/dimdengd/oldtwitter/blob/master/layouts/itl/script.js"
click node_settings "https://github.com/dimdengd/oldtwitter/blob/master/layouts/settings/script.js"
click node_emoji "https://github.com/dimdengd/oldtwitter/blob/master/libraries/emojipicker.js"
click node_gif "https://github.com/dimdengd/oldtwitter/blob/master/libraries/gif.js"
click node_gifworker "https://github.com/dimdengd/oldtwitter/blob/master/libraries/gif.worker.js"
click node_text "https://github.com/dimdengd/oldtwitter/blob/master/libraries/twitter-text.js"

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_injection,node_background,node_user,node_browser toneBlue
class node_header,node_home,node_profile,node_lists,node_search,node_tweet,node_notifications,node_topics,node_bookmarks,node_unfollows,node_itl toneAmber
class node_config,node_api,node_helpers,node_tweetview,node_tweetviewer,node_emoji,node_gif,node_gifworker,node_text toneMint
class node_settings toneRose
```

## Components

### Extension runtime

- [Page injection](https://github.com/dimdengd/oldtwitter/blob/master/scripts/injection.js): `scripts/injection.js`
- [Background runtime](https://github.com/dimdengd/oldtwitter/blob/master/scripts/background.js): `scripts/background.js`

### Social interface

- [Header and inbox](https://github.com/dimdengd/oldtwitter/blob/master/layouts/header/script.js): `layouts/header/script.js`
- [Home timeline](https://github.com/dimdengd/oldtwitter/blob/master/layouts/home/script.js): `layouts/home/script.js`
- [Profiles](https://github.com/dimdengd/oldtwitter/blob/master/layouts/profile/script.js): `layouts/profile/script.js`
- [Lists](https://github.com/dimdengd/oldtwitter/blob/master/layouts/lists/script.js): `layouts/lists/script.js`
- [Search](https://github.com/dimdengd/oldtwitter/blob/master/layouts/search/script.js): `layouts/search/script.js`
- [Tweet detail](https://github.com/dimdengd/oldtwitter/blob/master/layouts/tweet/script.js): `layouts/tweet/script.js`
- [Notifications](https://github.com/dimdengd/oldtwitter/blob/master/layouts/notifications/script.js): `layouts/notifications/script.js`
- [Topics](https://github.com/dimdengd/oldtwitter/blob/master/layouts/topics/script.js): `layouts/topics/script.js`
- [Bookmarks](https://github.com/dimdengd/oldtwitter/blob/master/layouts/bookmarks/script.js): `layouts/bookmarks/script.js`
- [Unfollower tracking](https://github.com/dimdengd/oldtwitter/blob/master/layouts/unfollows/script.js): `layouts/unfollows/script.js`
- [Timeline variants](https://github.com/dimdengd/oldtwitter/blob/master/layouts/itl/script.js): `layouts/itl/script.js`

### Shared services

- [Configuration](https://github.com/dimdengd/oldtwitter/blob/master/scripts/config.js): `scripts/config.js`
- [Twitter API client](https://github.com/dimdengd/oldtwitter/blob/master/scripts/apis.js): `scripts/apis.js`
- [Shared helpers](https://github.com/dimdengd/oldtwitter/blob/master/scripts/helpers.js): `scripts/helpers.js`
- [Tweet rendering](https://github.com/dimdengd/oldtwitter/blob/master/scripts/tweetConstructor.js): `scripts/tweetConstructor.js`
- [Media viewer](https://github.com/dimdengd/oldtwitter/blob/master/scripts/tweetviewer.js): `scripts/tweetviewer.js`
- [Emoji picker](https://github.com/dimdengd/oldtwitter/blob/master/libraries/emojipicker.js): `libraries/emojipicker.js`
- [GIF encoding](https://github.com/dimdengd/oldtwitter/blob/master/libraries/gif.js): `libraries/gif.js`
- [GIF worker](https://github.com/dimdengd/oldtwitter/blob/master/libraries/gif.worker.js): `libraries/gif.worker.js`
- [Twitter text utilities](https://github.com/dimdengd/oldtwitter/blob/master/libraries/twitter-text.js): `libraries/twitter-text.js`

### Customization

- [Settings](https://github.com/dimdengd/oldtwitter/blob/master/layouts/settings/script.js): `layouts/settings/script.js`

### Other components

- **Extension user**
- **Browser extension host**

## Connections

- Extension user → Browser extension host: uses extension (evidence: `README.md`)
- Header and inbox → Twitter API client: requests inbox and search (evidence: `layouts/header/script.js`)
- Lists → Twitter API client: requests list data (evidence: `layouts/lists/script.js`)
- Search → Twitter API client: requests search results (evidence: `layouts/search/script.js`)
- Tweet detail → Twitter API client: requests tweet data (evidence: `layouts/tweet/script.js`)
- Notifications → Twitter API client: requests notifications (evidence: `layouts/notifications/script.js`)
- Topics → Twitter API client: requests topic data (evidence: `layouts/topics/script.js`)
- Timeline variants → Twitter API client: requests account and timeline data (evidence: `layouts/itl/script.js`)
- Browser extension host → Page injection: loads page replacement
- Browser extension host → Background runtime: runs extension background
