# saadsaiyed/reel-finder architecture

> Architecture diagram of the GitHub repository saadsaiyed/reel-finder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saadsaiyed/reel-finder
- Repository: https://github.com/saadsaiyed/reel-finder

## Overview

##### Main components
- Client (e.g. your browser, Postman, mobile app)
- reel-finder service (app.py running in a Python environment)
- Environment configuration store (the .env file injected at runtime)
- External Instagram Graph API (Meta’s service)
- Containerization layer (Docker/Docker-Compose)

##### Relationships and data flows
- The Client issues HTTP requests (e.g. GET /reels, POST /messages) to the reel-finder service.
- The service loads App ID and Secret from environment variables (provided via .env and docker-compose).
- The service formulates calls to the Instagram Graph API to fetch reels or manage inbox.
- Responses from the Graph API return JSON which the service processes and relays back to the client.
- Docker/Docker-Compose orchestrates building and running the container exposing port 5000.

##### Architectural patterns
- Monolithic microservice: All API logic lives in a single code base (app.py).
- 12-factor app principles: Configuration via env vars, stateless processes.
- Containerized deployment: Dockerfile + docker-compose.yml define build/run steps.

##### Incorporate relevant technologies
- Python (Flask or equivalent web framework)
- Instagram Graph API (OAuth2 flows, HTTP REST)
- Docker + Docker-Compose
- (requirements.txt lists any additional libraries, e.g. requests, python-dot-env)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Components
    Client["Client (Browser/Postman/Mobile)"]:::external
    Instagram["Instagram Graph API"]:::external

    %% Docker Container Boundary
    subgraph "Docker Container (5000:5000)" 
        direction TB
        Env["Env Config (.env)"]:::internal
        Service["reel-finder Service\n(app.py)"]:::internal
        Client -->|"GET /reels\nPOST /messages"| Service
        Service -->|"Reads env vars"| Env
        Service -->|"OAuth2 Token Request"| Instagram
        Instagram -->|"JSON Response"| Service
        Service -->|"HTTP Response"| Client
    end

    %% Project Files / Infrastructure
    subgraph "Project Files" 
        direction TB
        DF["Dockerfile"]:::infrastructure
        DC["docker-compose.yml"]:::infrastructure
        RT["requirements.txt"]:::internal
        GI[".gitignore"]:::infrastructure
        DI[".dockerignore"]:::infrastructure
        RD["README.md"]:::infrastructure
    end

    %% Build & Deployment Flows
    DF -->|"Build image"| Service
    DC -->|"Run container"| Service
    RT -->|"Dependencies for"| Service
    GI -->|"Excludes secrets from repo"| Env
    DI -->|"Excludes env from image"| Env
    RD -.->|"Documentation for"| Service

    %% Click Events
    click Service "https://github.com/saadsaiyed/reel-finder/blob/main/app.py"
    click DF "https://github.com/saadsaiyed/reel-finder/tree/main/Dockerfile"
    click DC "https://github.com/saadsaiyed/reel-finder/blob/main/docker-compose.yml"
    click Env "https://github.com/saadsaiyed/reel-finder/blob/main/.env"
    click RT "https://github.com/saadsaiyed/reel-finder/blob/main/requirements.txt"
    click GI "https://github.com/saadsaiyed/reel-finder/blob/main/.gitignore"
    click DI "https://github.com/saadsaiyed/reel-finder/blob/main/.dockerignore"
    click RD "https://github.com/saadsaiyed/reel-finder/blob/main/README.md"

    %% Styles
    classDef internal fill:#AED6F1,stroke:#1B4F72,color:#154360
    classDef external fill:#F5B7B1,stroke:#7B241C,color:#641E16
    classDef infrastructure fill:#ABEBC6,stroke:#1D8348,color:#145A32
```
