# jeevan-gharate/instastra architecture

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

- Interactive diagram: https://gitdiagram.com/jeevan-gharate/instastra
- Repository: https://github.com/jeevan-gharate/instastra

## Overview

1. **Repository purpose**
   - InstAstra is a small **Python command-line Instagram scraper/downloader**. Its core job is to take a profile identifier from the user, query Instagram through a Python library, and either print profile information or download media to local disk.

2. **Main entrypoint**
   - `InstAstra.py` is the primary runtime entrypoint.
   - It appears to implement the interactive user interface / menu flow and dispatches actions to the feature modules under `funcs/`.

3. **Feature-oriented module split**
   - The `funcs/` directory is the main application boundary for capabilities.
   - Each file is a separate responsibility:
     - `ProfileDetails.py` — fetches and displays profile metadata/details.
     - `ProfileDPDownload.py` — downloads the profile display picture.
     - `ProfileStoriesDownload.py` — downloads saved stories for a profile.
     - `allPostsDownload.py` — downloads all posts from a profile.

4. **Execution flow**
   - User starts the CLI from `InstAstra.py`.
   - The CLI collects a target Instagram profile and the desired action.
   - The selected function module performs the scraping/download task.
   - Results are either printed to the terminal or written to the local filesystem as media files.

5. **External dependency boundary**
   - The project depends on **Instaloader**, which is the key integration point with Instagram.
   - Instaloader is the layer that handles Instagram interaction, metadata retrieval, and media download mechanics; the repo itself is mostly orchestration around that library.

6. **Data and control flow**
   - Input is human-driven and interactive, not batch/API driven.
   - Control flow is menu-based: the main script routes to one of the feature modules.
   - Data flow is one-way from Instagram to the tool, then to console output and/or downloaded files on disk.

7. **Local storage behavior**
   - The application is download-centric rather than database-centric.
   - There is no indication of a server, persistent datastore, or background job system.
   - Any outputs are likely stored as files in the working directory or a user-visible download path managed by Instaloader.

8. **Build/setup path**
   - `build.py` is the setup/install helper referenced in the README.
   - Its role is likely environment preparation: installing dependencies and/or configuring the tool before `InstAstra.py` is run.
   - This makes the repo a simple two-step workflow: setup, then run the CLI.

9. **Runtime and packaging**
   - The project is plain Python, intended to run with Python 3 on Linux or Windows.
   - `requirements.txt` defines the dependency set, with Instaloader as the central package.
   - The README’s Windows notes suggest the script invokes `python3` explicitly in places, which matters for execution compatibility.

10. **Architectural style**
    - This is a **single-process, modular CLI utility**.
    - It is not a client-server system.
    - The main architectural boundary is between the **UI/orchestrator layer** (`InstAstra.py`) and the **feature/service layer** (`funcs/*.py`), with Instaloader acting as the external integration layer.

11. **What to show in an architecture diagram**
    - Show the user at the left, interacting with `InstAstra.py`.
    - Show `InstAstra.py` delegating to the four feature modules.
    - Show those modules depending on Instaloader.
    - Show Instagram as the external system and the local filesystem as the output target for downloads.

12. **Overall takeaway**
    - InstAstra is a compact, functionally split scraper/downloader with a single CLI entrypoint, a small set of feature modules, and one major third-party dependency that does the actual Instagram interaction.

Main entry points: [`InstAstra.py`](https://github.com/jeevan-gharate/instastra/blob/main/InstAstra.py) (InstAstra CLI), [`funcs/ProfileDetails.py`](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDetails.py) (Profile details), [`funcs/ProfileDPDownload.py`](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDPDownload.py) (DP download), [`funcs/ProfileStoriesDownload.py`](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileStoriesDownload.py) (Stories download)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_cli["InstAstra CLI<br/>entrypoint<br/>[InstAstra.py]"]
  node_details["Profile details<br/>feature module<br/>[ProfileDetails.py]"]
  node_dpdl["DP download<br/>feature module"]
  node_stories["Stories download<br/>feature module"]
  node_posts["Posts download<br/>feature module"]
  node_build["Build helper<br/>setup script<br/>[build.py]"]
  node_requirements["Requirements<br/>dependency manifest<br/>[requirements.txt]"]
  node_readme["README<br/>docs<br/>[README.md]"]
end

subgraph group_ext["External systems"]
  node_user(("User<br/>operator"))
  node_instaloader{{"Instaloader<br/>integration"}}
  node_instagram(("Instagram<br/>external service"))
  node_filesystem[("Local files<br/>output storage")]
end

node_user -->|"run / choose action"| node_cli
node_cli -->|"profile info"| node_details
node_cli -->|"download DP"| node_dpdl
node_cli -->|"download stories"| node_stories
node_cli -->|"download posts"| node_posts
node_details -->|"query"| node_instaloader
node_dpdl -->|"fetch media"| node_instaloader
node_stories -->|"fetch stories"| node_instaloader
node_posts -->|"fetch posts"| node_instaloader
node_instaloader -->|"API access"| node_instagram
node_details -->|"print / save"| node_filesystem
node_dpdl -->|"write files"| node_filesystem
node_stories -->|"write files"| node_filesystem
node_posts -->|"write files"| node_filesystem
node_build -->|"install deps"| node_requirements
node_requirements -->|"depends on"| node_instaloader
node_readme -->|"setup guide"| node_build
node_readme -->|"run guide"| node_cli

click node_cli "https://github.com/jeevan-gharate/instastra/blob/main/InstAstra.py"
click node_details "https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDetails.py"
click node_dpdl "https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDPDownload.py"
click node_stories "https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileStoriesDownload.py"
click node_posts "https://github.com/jeevan-gharate/instastra/blob/main/funcs/allPostsDownload.py"
click node_build "https://github.com/jeevan-gharate/instastra/blob/main/build.py"
click node_requirements "https://github.com/jeevan-gharate/instastra/blob/main/requirements.txt"
click node_readme "https://github.com/jeevan-gharate/instastra/blob/main/README.md"

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_cli,node_details,node_dpdl,node_stories,node_posts,node_build,node_requirements,node_readme toneBlue
class node_user,node_instaloader,node_instagram,node_filesystem toneAmber
```

## Components

### Application

CLI entrypoint and feature modules inside the repo.

- [InstAstra CLI](https://github.com/jeevan-gharate/instastra/blob/main/InstAstra.py): entrypoint · Main interactive script that collects a profile target and routes menu choices. · `InstAstra.py`
- [Profile details](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDetails.py): feature module · Fetches and displays profile metadata. · `funcs/ProfileDetails.py`
- [DP download](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileDPDownload.py): feature module · Downloads a profile display picture. · `funcs/ProfileDPDownload.py`
- [Stories download](https://github.com/jeevan-gharate/instastra/blob/main/funcs/ProfileStoriesDownload.py): feature module · Downloads saved stories for a profile. · `funcs/ProfileStoriesDownload.py`
- [Posts download](https://github.com/jeevan-gharate/instastra/blob/main/funcs/allPostsDownload.py): feature module · Downloads all posts from a profile. · `funcs/allPostsDownload.py`
- [Build helper](https://github.com/jeevan-gharate/instastra/blob/main/build.py): setup script · Environment preparation and dependency setup before running the CLI. · `build.py`
- [Requirements](https://github.com/jeevan-gharate/instastra/blob/main/requirements.txt): dependency manifest · Python dependency list centered on Instaloader. · `requirements.txt`
- [README](https://github.com/jeevan-gharate/instastra/blob/main/README.md): docs · Usage and setup guidance for running the tool. · `README.md`

### External systems

Third-party service and local output targets.

- **User**: operator · Interactive person running the CLI and choosing actions.
- **Instaloader**: integration · Third-party library that handles Instagram access, metadata retrieval, and media downloading.
- **Instagram**: external service · Source system being queried for profile data and media.
- **Local files**: output storage · Filesystem destination for downloaded media and generated output.

## Connections

- User → InstAstra CLI: run / choose action · Interactive command-line usage starts here.
- InstAstra CLI → Profile details: profile info · Dispatches to the profile metadata feature.
- InstAstra CLI → DP download: download DP · Dispatches to the display-picture download feature.
- InstAstra CLI → Stories download: download stories · Dispatches to the stories download feature.
- InstAstra CLI → Posts download: download posts · Dispatches to the posts download feature.
- Profile details → Instaloader: query · Uses the library to fetch profile information.
- DP download → Instaloader: fetch media · Uses the library to retrieve profile images.
- Stories download → Instaloader: fetch stories · Uses the library to access story media.
- Posts download → Instaloader: fetch posts · Uses the library to access post media.
- Instaloader → Instagram: API access · Third-party library communicates with Instagram.
- Profile details → Local files: print / save · Outputs profile details to terminal or files as needed.
- DP download → Local files: write files · Saves downloaded display-picture media locally.
- Stories download → Local files: write files · Saves downloaded story media locally.
- Posts download → Local files: write files · Saves downloaded post media locally.
- Build helper → Requirements: install deps · Setup helper prepares the Python environment.
- Requirements → Instaloader: depends on · Dependency manifest includes the core integration library.
- README → Build helper: setup guide · Documentation points to the build/setup step.
- README → InstAstra CLI: run guide · Documentation explains how to start the CLI.
