# ako1122/insta-download architecture

> Architecture diagram of the GitHub repository ako1122/insta-download, 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/ako1122/insta-download
- Repository: https://github.com/ako1122/insta-download

## Overview

ReelsDl.net is a web app for resolving publicly accessible Instagram reels, posts, and carousels into downloadable media, with an audio-to-MP3 mode. The main workflow is paste a public Instagram URL, resolve its media, then stream a download; the UI sends requests through API endpoints to the resolver. The README documents GraphQL-first resolution with HTML fallback, plus FFmpeg audio extraction. The graph also includes the site shell, API security, and proxy. Some route and resolver internals were not sampled, so only documented or indexed relationships are shown.

Main entry points: [`components/DownloadPage.jsx`](https://github.com/ako1122/insta-download/blob/main/components/DownloadPage.jsx) (Download pages), [`lib/reelstash.js`](https://github.com/ako1122/insta-download/blob/main/lib/reelstash.js) (Media resolver), [`components/Downloader.jsx`](https://github.com/ako1122/insta-download/blob/main/components/Downloader.jsx) (URL downloader), [`src/pages/api/resolve.js`](https://github.com/ako1122/insta-download/blob/main/src/pages/api/resolve.js) (Resolve endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_site_shell["Site shell<br/>[AppRoot.jsx]"]
  node_download_page["Download pages<br/>[DownloadPage.jsx]"]
  node_downloader["URL downloader<br/>[Downloader.jsx]"]
  node_audio_copy["Audio guide<br/>[AudioCopy.jsx]"]
  node_home_copy["Home guide<br/>[HomeCopy.jsx]"]
  node_header["Header<br/>[Header.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
  node_i18n["Localization<br/>[I18nProvider.jsx]"]
end

subgraph group_api["API and access"]
  node_resolve_route["Resolve endpoint<br/>[resolve.js]"]
  node_download_route["Download endpoint<br/>[download.js]"]
  node_health_route["Health endpoint<br/>[health.js]"]
  node_api_guard["API access checks<br/>[api-guard.js]"]
  node_middleware["Host and security middleware<br/>[middleware.js]"]
end

subgraph group_media["Media processing"]
  node_resolver["Media resolver<br/>[reelstash.js]"]
end

subgraph group_delivery["Site delivery"]
  node_proxy["Cloudflare proxy<br/>[worker.js]"]
  node_seo["SEO metadata<br/>[seo.js]"]
  node_robots["Robots and sitemap<br/>[robots.txt.js]"]
  node_sitemap["Sitemap route<br/>[sitemap.xml.js]"]
end

node_visitor(("Visitor"))
node_instagram(("Instagram"))
node_ffmpeg["FFmpeg"]
node_vercel["Vercel app host"]

node_visitor -->|"pastes URL"| node_downloader
node_site_shell -->|"renders"| node_download_page
node_download_page -->|"renders"| node_downloader
node_download_page -->|"renders"| node_header
node_download_page -->|"renders"| node_footer
node_download_page -->|"renders"| node_home_copy
node_download_page -->|"renders"| node_audio_copy
node_header -->|"reads translations"| node_i18n
node_downloader -->|"POSTs URL"| node_resolve_route
node_resolve_route -->|"delegates resolution"| node_resolver
node_download_route -->|"delegates download"| node_resolver
node_health_route -->|"checks health"| node_resolver
node_resolver -->|"resolves public media"| node_instagram
node_resolver -->|"extracts MP3"| node_ffmpeg
node_middleware -->|"checks API access"| node_api_guard
node_middleware -->|"routes requests"| node_vercel
node_proxy -->|"proxies requests"| node_vercel
node_robots -->|"uses SEO data"| node_seo
node_sitemap -->|"uses SEO data"| node_seo
node_downloader -.->|"fetches download"| node_download_route
node_resolve_route -.->|"enforces access"| node_api_guard
node_download_route -.->|"enforces access"| node_api_guard

click node_site_shell "https://github.com/ako1122/insta-download/blob/main/components/AppRoot.jsx"
click node_download_page "https://github.com/ako1122/insta-download/blob/main/components/DownloadPage.jsx"
click node_downloader "https://github.com/ako1122/insta-download/blob/main/components/Downloader.jsx"
click node_audio_copy "https://github.com/ako1122/insta-download/blob/main/components/AudioCopy.jsx"
click node_home_copy "https://github.com/ako1122/insta-download/blob/main/components/HomeCopy.jsx"
click node_header "https://github.com/ako1122/insta-download/blob/main/components/Header.jsx"
click node_footer "https://github.com/ako1122/insta-download/blob/main/components/Footer.jsx"
click node_i18n "https://github.com/ako1122/insta-download/blob/main/components/I18nProvider.jsx"
click node_resolve_route "https://github.com/ako1122/insta-download/blob/main/src/pages/api/resolve.js"
click node_download_route "https://github.com/ako1122/insta-download/blob/main/src/pages/api/download.js"
click node_health_route "https://github.com/ako1122/insta-download/blob/main/src/pages/api/health.js"
click node_api_guard "https://github.com/ako1122/insta-download/blob/main/lib/api-guard.js"
click node_middleware "https://github.com/ako1122/insta-download/blob/main/src/middleware.js"
click node_resolver "https://github.com/ako1122/insta-download/blob/main/lib/reelstash.js"
click node_proxy "https://github.com/ako1122/insta-download/blob/main/worker.js"
click node_seo "https://github.com/ako1122/insta-download/blob/main/lib/seo.js"
click node_robots "https://github.com/ako1122/insta-download/blob/main/src/pages/robots.txt.js"
click node_sitemap "https://github.com/ako1122/insta-download/blob/main/src/pages/sitemap.xml.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_site_shell,node_download_page,node_downloader,node_audio_copy,node_home_copy,node_header,node_footer,node_i18n toneBlue
class node_resolve_route,node_download_route,node_health_route,node_api_guard,node_middleware toneAmber
class node_resolver toneMint
class node_proxy,node_seo,node_robots,node_sitemap toneRose
class node_visitor,node_instagram,node_ffmpeg,node_vercel toneIndigo
```

## Components

### Web experience

- [Site shell](https://github.com/ako1122/insta-download/blob/main/components/AppRoot.jsx): `components/AppRoot.jsx`
- [Download pages](https://github.com/ako1122/insta-download/blob/main/components/DownloadPage.jsx): `components/DownloadPage.jsx`
- [URL downloader](https://github.com/ako1122/insta-download/blob/main/components/Downloader.jsx): `components/Downloader.jsx`
- [Audio guide](https://github.com/ako1122/insta-download/blob/main/components/AudioCopy.jsx): `components/AudioCopy.jsx`
- [Home guide](https://github.com/ako1122/insta-download/blob/main/components/HomeCopy.jsx): `components/HomeCopy.jsx`
- [Header](https://github.com/ako1122/insta-download/blob/main/components/Header.jsx): `components/Header.jsx`
- [Footer](https://github.com/ako1122/insta-download/blob/main/components/Footer.jsx): `components/Footer.jsx`
- [Localization](https://github.com/ako1122/insta-download/blob/main/components/I18nProvider.jsx): `components/I18nProvider.jsx`

### API and access

- [Resolve endpoint](https://github.com/ako1122/insta-download/blob/main/src/pages/api/resolve.js): `src/pages/api/resolve.js`
- [Download endpoint](https://github.com/ako1122/insta-download/blob/main/src/pages/api/download.js): `src/pages/api/download.js`
- [Health endpoint](https://github.com/ako1122/insta-download/blob/main/src/pages/api/health.js): `src/pages/api/health.js`
- [API access checks](https://github.com/ako1122/insta-download/blob/main/lib/api-guard.js): `lib/api-guard.js`
- [Host and security middleware](https://github.com/ako1122/insta-download/blob/main/src/middleware.js): `src/middleware.js`

### Media processing

- [Media resolver](https://github.com/ako1122/insta-download/blob/main/lib/reelstash.js): `lib/reelstash.js`

### Site delivery

- [Cloudflare proxy](https://github.com/ako1122/insta-download/blob/main/worker.js): `worker.js`
- [SEO metadata](https://github.com/ako1122/insta-download/blob/main/lib/seo.js): `lib/seo.js`
- [Robots and sitemap](https://github.com/ako1122/insta-download/blob/main/src/pages/robots.txt.js): `src/pages/robots.txt.js`
- [Sitemap route](https://github.com/ako1122/insta-download/blob/main/src/pages/sitemap.xml.js): `src/pages/sitemap.xml.js`

### Other components

- **Visitor**
- **Instagram**
- **FFmpeg**
- **Vercel app host**

## Connections

- Visitor → URL downloader: pastes URL (evidence: `README.md`)
- Site shell → Download pages: renders (evidence: `components/AppRoot.jsx`)
- Download pages → URL downloader: renders (evidence: `components/DownloadPage.jsx`)
- Download pages → Header: renders (evidence: `components/DownloadPage.jsx`)
- Download pages → Footer: renders (evidence: `components/DownloadPage.jsx`)
- Download pages → Home guide: renders (evidence: `components/DownloadPage.jsx`)
- Download pages → Audio guide: renders (evidence: `components/DownloadPage.jsx`)
- Header → Localization: reads translations (evidence: `components/Header.jsx`)
- URL downloader → Resolve endpoint: POSTs URL (evidence: `components/Downloader.jsx`)
- Resolve endpoint → Media resolver: delegates resolution (evidence: `src/pages/api/resolve.js`)
- Download endpoint → Media resolver: delegates download (evidence: `src/pages/api/download.js`)
- Health endpoint → Media resolver: checks health (evidence: `src/pages/api/health.js`)
- Media resolver → Instagram: resolves public media (evidence: `README.md`)
- Media resolver → FFmpeg: extracts MP3 (evidence: `README.md`)
- Host and security middleware → API access checks: checks API access (evidence: `src/middleware.js`)
- Host and security middleware → Vercel app host: routes requests (evidence: `README.md`)
- Cloudflare proxy → Vercel app host: proxies requests (evidence: `README.md`)
- Robots and sitemap → SEO metadata: uses SEO data (evidence: `src/pages/robots.txt.js`)
- Sitemap route → SEO metadata: uses SEO data (evidence: `src/pages/sitemap.xml.js`)
- URL downloader → Download endpoint: fetches download
- Resolve endpoint → API access checks: enforces access
- Download endpoint → API access checks: enforces access
