# ibrahemesam/repo-view architecture

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

- Interactive diagram: https://gitdiagram.com/ibrahemesam/repo-view
- Repository: https://github.com/ibrahemesam/repo-view

## Overview

repo-view is a static, client-side GitHub repository viewer: a visitor opens a generated URL, the page interprets its repository, token and optional path, then requests GitHub content and renders a browsable preview. The main viewer also supports Markdown links and images, syntax-highlighted files, PDF preview, cloning/download actions and internet-disconnect handling; the README documents a URL-creation page and dark theme. The separate download page fetches a repository or directory and packages it as a ZIP. The main entry point and downloader were sampled; links for other README-described features are limited to documented relationships.

Main entry points: [`js/main.js`](https://github.com/ibrahemesam/repo-view/blob/main/js/main.js) (Viewer controller), [`download/fetcher.js`](https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js) (ZIP fetcher), [`index.html`](https://github.com/ibrahemesam/repo-view/blob/main/index.html) (Viewer page), [`js/my-marked-base-url.js`](https://github.com/ibrahemesam/repo-view/blob/main/js/my-marked-base-url.js) (Markdown URL fixer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_viewer["Repository viewer"]
  node_mainpage["Viewer page<br/>[index.html]"]
  node_main["Viewer controller<br/>[main.js]"]
  node_github{{"GitHub REST API"}}
  node_markdown["Markdown URL fixer"]
  node_mime["Programming MIME types"]
  node_preview["File preview<br/>[main.js]"]
  node_urlcreator["URL creation page<br/>[index.html]"]
end

subgraph group_download["Repository download"]
  node_downloadpage["Download page<br/>[index.html]"]
  node_fetcher["ZIP fetcher<br/>[fetcher.js]"]
  node_zip["ZIP generation<br/>[fetcher.js]"]
  node_browserdownload["Browser file save<br/>[fetcher.js]"]
end

subgraph group_presentation["Presentation UI"]
  node_theme["Theme switch<br/>[theme-switch.js]"]
  node_includes["HTML includes<br/>[include-html.js]"]
  node_themefragment["Theme widget<br/>[theme-switch.html]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_mainpage
node_mainpage -->|"runs"| node_main
node_main -->|"requests content"| node_github
node_main -->|"renders files"| node_preview
node_main -->|"configures Markdown"| node_markdown
node_markdown -->|"fetches images"| node_github
node_main -.->|"uses MIME map"| node_mime
node_visitor -->|"creates viewer URL"| node_urlcreator
node_visitor -.->|"opens download"| node_downloadpage
node_downloadpage -->|"runs"| node_fetcher
node_fetcher -->|"fetches repository"| node_github
node_fetcher -->|"adds fetched files"| node_zip
node_fetcher -->|"saves ZIP"| node_browserdownload
node_mainpage -.->|"theme control"| node_theme
node_main -.->|"loads fragments"| node_includes
node_includes -.->|"loads fragment"| node_themefragment

click node_mainpage "https://github.com/ibrahemesam/repo-view/blob/main/index.html"
click node_main "https://github.com/ibrahemesam/repo-view/blob/main/js/main.js"
click node_markdown "https://github.com/ibrahemesam/repo-view/blob/main/js/my-marked-base-url.js"
click node_mime "https://github.com/ibrahemesam/repo-view/blob/main/js/programming-txt-mime.js"
click node_preview "https://github.com/ibrahemesam/repo-view/blob/main/js/main.js"
click node_urlcreator "https://github.com/ibrahemesam/repo-view/blob/main/new/index.html"
click node_downloadpage "https://github.com/ibrahemesam/repo-view/blob/main/download/index.html"
click node_fetcher "https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js"
click node_zip "https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js"
click node_browserdownload "https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js"
click node_theme "https://github.com/ibrahemesam/repo-view/blob/main/js/theme-switch.js"
click node_includes "https://github.com/ibrahemesam/repo-view/blob/main/js/include-html.js"
click node_themefragment "https://github.com/ibrahemesam/repo-view/blob/main/widgets/theme-switch.html"

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_mainpage,node_main,node_github,node_markdown,node_mime,node_preview,node_urlcreator toneBlue
class node_downloadpage,node_fetcher,node_zip,node_browserdownload toneAmber
class node_theme,node_includes,node_themefragment toneMint
class node_visitor toneIndigo
```

## Components

### Repository viewer

- [Viewer page](https://github.com/ibrahemesam/repo-view/blob/main/index.html): `index.html`
- [Viewer controller](https://github.com/ibrahemesam/repo-view/blob/main/js/main.js): `js/main.js`
- **GitHub REST API**
- [Markdown URL fixer](https://github.com/ibrahemesam/repo-view/blob/main/js/my-marked-base-url.js): `js/my-marked-base-url.js`
- [Programming MIME types](https://github.com/ibrahemesam/repo-view/blob/main/js/programming-txt-mime.js): `js/programming-txt-mime.js`
- [File preview](https://github.com/ibrahemesam/repo-view/blob/main/js/main.js): `js/main.js`
- [URL creation page](https://github.com/ibrahemesam/repo-view/blob/main/new/index.html): `new/index.html`

### Repository download

- [Download page](https://github.com/ibrahemesam/repo-view/blob/main/download/index.html): `download/index.html`
- [ZIP fetcher](https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js): `download/fetcher.js`
- [ZIP generation](https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js): `download/fetcher.js`
- [Browser file save](https://github.com/ibrahemesam/repo-view/blob/main/download/fetcher.js): `download/fetcher.js`

### Presentation UI

- [Theme switch](https://github.com/ibrahemesam/repo-view/blob/main/js/theme-switch.js): `js/theme-switch.js`
- [HTML includes](https://github.com/ibrahemesam/repo-view/blob/main/js/include-html.js): `js/include-html.js`
- [Theme widget](https://github.com/ibrahemesam/repo-view/blob/main/widgets/theme-switch.html): `widgets/theme-switch.html`

### Other components

- **Visitor**

## Connections

- Visitor → Viewer page: opens (evidence: `README.md`)
- Viewer page → Viewer controller: runs (evidence: `js/main.js`)
- Viewer controller → GitHub REST API: requests content (evidence: `js/main.js`)
- Viewer controller → File preview: renders files (evidence: `js/main.js`)
- Viewer controller → Markdown URL fixer: configures Markdown (evidence: `js/main.js`)
- Markdown URL fixer → GitHub REST API: fetches images (evidence: `js/my-marked-base-url.js`)
- Viewer controller → Programming MIME types: uses MIME map
- Visitor → URL creation page: creates viewer URL (evidence: `README.md`)
- Visitor → Download page: opens download
- Download page → ZIP fetcher: runs (evidence: `download/fetcher.js`)
- ZIP fetcher → GitHub REST API: fetches repository (evidence: `download/fetcher.js`)
- ZIP fetcher → ZIP generation: adds fetched files (evidence: `download/fetcher.js`)
- ZIP fetcher → Browser file save: saves ZIP (evidence: `download/fetcher.js`)
- Viewer page → Theme switch: theme control
- Viewer controller → HTML includes: loads fragments
- HTML includes → Theme widget: loads fragment
