# ahmadibrahiim/website-downloader architecture

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

- Interactive diagram: https://gitdiagram.com/ahmadibrahiim/website-downloader
- Repository: https://github.com/ahmadibrahiim/website-downloader

## Overview

The product accepts a website address, mirrors the site with wget, compresses the downloaded files into a ZIP, and makes the result available to the user. The README describes socket-based progress and delivery; source confirms the socket-to-download-to-archive flow. The browser-side client and server startup wiring were not sampled, so their internal connections are omitted.

Main entry points: [`wget/index.js`](https://github.com/ahmadibrahiim/website-downloader/blob/master/wget/index.js) (Site download job), [`app.js`](https://github.com/ahmadibrahiim/website-downloader/blob/master/app.js) (Express app), [`socket/socket.js`](https://github.com/ahmadibrahiim/website-downloader/blob/master/socket/socket.js) (Socket handler), [`routes/index.js`](https://github.com/ahmadibrahiim/website-downloader/blob/master/routes/index.js) (Home route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["Express app<br/>[app.js]"]
  node_home["Home route<br/>[index.js]"]
  node_socket["Socket handler<br/>[socket.js]"]
  node_views["Page templates<br/>[index.hbs]"]
end

subgraph group_jobs["Download jobs"]
  node_downloads["Site download job<br/>[index.js]"]
  node_wget["wget process"]
end

subgraph group_archive["Archive output"]
  node_archiver["ZIP compressor<br/>[index.js]"]
  node_zipfiles["ZIP files"]
end

node_user(("User"))
node_website(("Target website"))

node_user -->|"requests page"| node_app
node_app -->|"routes request"| node_home
node_home -->|"renders page"| node_views
node_user -->|"submits job"| node_socket
node_socket -->|"starts job"| node_downloads
node_downloads -->|"runs mirror"| node_wget
node_wget -->|"fetches assets"| node_website
node_downloads -->|"emits progress"| node_socket
node_downloads -->|"compresses files"| node_archiver
node_archiver -->|"writes ZIP"| node_zipfiles
node_app -->|"serves static files"| node_zipfiles
node_user -->|"downloads ZIP"| node_app

click node_app "https://github.com/ahmadibrahiim/website-downloader/blob/master/app.js"
click node_home "https://github.com/ahmadibrahiim/website-downloader/blob/master/routes/index.js"
click node_socket "https://github.com/ahmadibrahiim/website-downloader/blob/master/socket/socket.js"
click node_views "https://github.com/ahmadibrahiim/website-downloader/blob/master/views/index.hbs"
click node_downloads "https://github.com/ahmadibrahiim/website-downloader/blob/master/wget/index.js"
click node_archiver "https://github.com/ahmadibrahiim/website-downloader/blob/master/archiver/index.js"
click node_zipfiles "https://github.com/ahmadibrahiim/website-downloader/tree/master/public/sites"

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_app,node_home,node_socket,node_views,node_user toneBlue
class node_downloads,node_wget toneAmber
class node_archiver,node_zipfiles toneMint
class node_website toneIndigo
```

## Components

### Web interface

- [Express app](https://github.com/ahmadibrahiim/website-downloader/blob/master/app.js): `app.js`
- [Home route](https://github.com/ahmadibrahiim/website-downloader/blob/master/routes/index.js): `routes/index.js`
- [Socket handler](https://github.com/ahmadibrahiim/website-downloader/blob/master/socket/socket.js): `socket/socket.js`
- [Page templates](https://github.com/ahmadibrahiim/website-downloader/blob/master/views/index.hbs): `views/index.hbs`

### Download jobs

- [Site download job](https://github.com/ahmadibrahiim/website-downloader/blob/master/wget/index.js): `wget/index.js`
- **wget process**

### Archive output

- [ZIP compressor](https://github.com/ahmadibrahiim/website-downloader/blob/master/archiver/index.js): `archiver/index.js`
- [ZIP files](https://github.com/ahmadibrahiim/website-downloader/tree/master/public/sites): `public/sites`

### Other components

- **User**
- **Target website**

## Connections

- User → Express app: requests page
- Express app → Home route: routes request
- Home route → Page templates: renders page
- User → Socket handler: submits job
- Socket handler → Site download job: starts job
- Site download job → wget process: runs mirror
- wget process → Target website: fetches assets
- Site download job → Socket handler: emits progress
- Site download job → ZIP compressor: compresses files
- ZIP compressor → ZIP files: writes ZIP
- Express app → ZIP files: serves static files
- User → Express app: downloads ZIP
