# harshoutoftokens/instagram-reconstructor architecture

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

- Interactive diagram: https://gitdiagram.com/harshoutoftokens/instagram-reconstructor
- Repository: https://github.com/harshoutoftokens/instagram-reconstructor

## Overview

Instagram DM Reconstructor is a local export-to-inbox application. The user runs the Python builder on an Instagram data export; it normalizes profile, thread, message, and media data into viewer/data.js, which the browser viewer uses to browse and search conversations and render message types. The main stages and viewer capabilities are represented below. The viewer HTML and styling are listed in the tree but were not sampled, so links involving them are limited to the README's explicit workflow.

Main entry points: [`build.py`](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py) (Export builder), [`viewer/app.js`](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js) (Message rendering), [`viewer/index.html`](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/index.html) (Viewer page), [`viewer/style.css`](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/style.css) (Responsive themes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Export preparation"]
  node_builder["Export builder<br/>[build.py]"]
  node_profile["Profile loading<br/>[build.py]"]
  node_thread_loader["Thread loading<br/>[build.py]"]
  node_message_normalizer["Message normalization<br/>[build.py]"]
  node_viewer_data["Inbox data"]
end

subgraph group_viewer["Inbox viewer"]
  node_viewer_page["Viewer page<br/>[index.html]"]
  node_thread_list["Conversation list<br/>[app.js]"]
  node_thread_search["List search<br/>[app.js]"]
  node_message_view["Message rendering<br/>[app.js]"]
  node_media_cards["Media and share cards<br/>[app.js]"]
  node_message_search["Message search<br/>[app.js]"]
  node_incremental_loading["Chunked scrolling<br/>[app.js]"]
  node_theme_layout["Responsive themes<br/>[style.css]"]
end

node_user(("Local user"))
node_instagram_export["Instagram export"]
node_instagram_links["Instagram links"]

node_user -->|"selects export"| node_instagram_export
node_user -->|"runs builder"| node_builder
node_instagram_export -->|"provides JSON"| node_builder
node_builder -->|"loads profile"| node_profile
node_builder -->|"loads threads"| node_thread_loader
node_thread_loader -->|"converts messages"| node_message_normalizer
node_builder -->|"writes data"| node_viewer_data
node_user -->|"opens viewer"| node_viewer_page
node_viewer_data -->|"provides threads"| node_thread_list
node_viewer_data -->|"provides messages"| node_message_view
node_thread_list -->|"filters names"| node_thread_search
node_thread_list -->|"opens thread"| node_message_view
node_message_view -->|"renders content"| node_media_cards
node_message_view -->|"loads chunks"| node_incremental_loading
node_message_search -->|"jumps to match"| node_message_view
node_viewer_page -.->|"hosts interface"| node_thread_list
node_viewer_page -.->|"uses styling"| node_theme_layout
node_media_cards -->|"links shared posts"| node_instagram_links

click node_builder "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py"
click node_profile "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py"
click node_thread_loader "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py"
click node_message_normalizer "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py"
click node_viewer_page "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/index.html"
click node_thread_list "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_thread_search "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_message_view "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_media_cards "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_message_search "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_incremental_loading "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js"
click node_theme_layout "https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/style.css"

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_builder,node_profile,node_thread_loader,node_message_normalizer,node_viewer_data,node_user toneBlue
class node_viewer_page,node_thread_list,node_thread_search,node_message_view,node_media_cards,node_message_search,node_incremental_loading,node_theme_layout toneAmber
class node_instagram_export,node_instagram_links toneIndigo
```

## Components

### Export preparation

- [Export builder](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py): `build.py`
- [Profile loading](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py): `build.py`
- [Thread loading](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py): `build.py`
- [Message normalization](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/build.py): `build.py`
- **Inbox data**

### Inbox viewer

- [Viewer page](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/index.html): `viewer/index.html`
- [Conversation list](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [List search](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [Message rendering](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [Media and share cards](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [Message search](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [Chunked scrolling](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/app.js): `viewer/app.js`
- [Responsive themes](https://github.com/harshoutoftokens/instagram-reconstructor/blob/main/viewer/style.css): `viewer/style.css`

### Other components

- **Local user**
- **Instagram export**
- **Instagram links**

## Connections

- Local user → Instagram export: selects export (evidence: `README.md`)
- Local user → Export builder: runs builder (evidence: `README.md`)
- Instagram export → Export builder: provides JSON (evidence: `README.md`)
- Export builder → Profile loading: loads profile (evidence: `build.py`)
- Export builder → Thread loading: loads threads (evidence: `build.py`)
- Thread loading → Message normalization: converts messages (evidence: `build.py`)
- Export builder → Inbox data: writes data (evidence: `build.py`)
- Local user → Viewer page: opens viewer (evidence: `README.md`)
- Inbox data → Conversation list: provides threads (evidence: `viewer/app.js`)
- Inbox data → Message rendering: provides messages (evidence: `viewer/app.js`)
- Conversation list → List search: filters names (evidence: `viewer/app.js`)
- Conversation list → Message rendering: opens thread (evidence: `viewer/app.js`)
- Message rendering → Media and share cards: renders content (evidence: `viewer/app.js`)
- Message rendering → Chunked scrolling: loads chunks (evidence: `viewer/app.js`)
- Message search → Message rendering: jumps to match (evidence: `viewer/app.js`)
- Viewer page → Conversation list: hosts interface (evidence: `README.md`)
- Viewer page → Responsive themes: uses styling (evidence: `README.md`)
- Media and share cards → Instagram links: links shared posts (evidence: `README.md`)
