# nadeerasilvaa/insta-scrapper architecture

> Architecture diagram of the GitHub repository nadeerasilvaa/insta-scrapper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nadeerasilvaa/insta-scrapper
- Repository: https://github.com/nadeerasilvaa/insta-scrapper

## Overview

##### Main Components
- API Server: Represent the Express.js server (the index.js entry point) as the central component.
- Scraping/HTTP Client Module: Identify the module/component that makes HTTP requests via axios and then parses HTML using Cheerio.
- Rate Limiter: Mark the rate limiting middleware (express-rate-limit) that wraps the API endpoint to control incoming traffic.
- External Service: Represent Instagram as an external system from which the scraper fetches profile pages.

##### Relationships and Interactions
- Cheerio-based HTML parsing as part of the scraping workflow.

##### Architectural Patterns and Design Principles
- Middleware (the rate limiter) as an internal middleware layer within the Express application.
- Separation of concerns: Request validation and throttling, external data fetching, and data parsing/response generation.

##### Highlighting Technologies
- Instagram as an external system that serves as the source of data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Client/Consumer"]:::client
    B["Express.js API Server"]:::server
    subgraph "API Internal Processing"
        C["Rate Limiting Middleware"]:::middleware
        D["Scraper Module (Axios & Cheerio)"]:::scraper
    end
    E["Instagram"]:::external

    A -->|"GET_/scrapeProfile"| B
    B -->|"RateLimit_Check"| C
    C -->|"IfAllowed_Request"| D
    D -->|"axios_HTTP_Request"| E
    E -->|"HTML_Response"| D
    D -->|"Assemble_JSON"| B
    B -->|"Return_JSON_Response"| A

    click B "https://github.com/nadeerasilvaa/insta-scrapper/blob/main/index.js"
    click C "https://github.com/nadeerasilvaa/insta-scrapper/blob/main/index.js"
    click D "https://github.com/nadeerasilvaa/insta-scrapper/blob/main/index.js"

    classDef client fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef server fill:#66C2FF,stroke:#333,stroke-width:2px;
    classDef middleware fill:#A6CEE3,stroke:#333,stroke-width:2px;
    classDef scraper fill:#B2DF8A,stroke:#333,stroke-width:2px;
    classDef external fill:#FF9999,stroke:#CC0000,stroke-width:2px;
```
