# tanujkumar24/shopgenie_project architecture

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

- Interactive diagram: https://gitdiagram.com/tanujkumar24/shopgenie_project
- Repository: https://github.com/tanujkumar24/shopgenie_project

## Overview

##### Project type and purpose
- ShopGenie is a full-stack Python application that provides both a CLI (app.py) and a Streamlit web frontend (frontend/streamlit_app.py).
- Its purpose is to let users search for mobile products, run AI-powered comparisons (using LangChain + Groq), suggest YouTube videos, and deliver a comparison report via email.

##### File structure
- Top-level files:
- app.py – entry point for the CLI
- requirements.txt, .gitignore, README.md
- Directories by concern:
- frontend/ – Streamlit UI
- llm/ – LLM integrations: prompts, model wrappers, response parsers
- search/ – real-time web search module
- data/ – YouTube Data API client
- utils/ – email service (SMTP report delivery)

##### README for additional insights
- Tech stack: Python 3.10+, LangChain, Groq, Tavily, YouTube Data API, Pydantic, Streamlit
- Key flows: product search → AI comparison → email report → YouTube suggestions
- No persistent database; data flows through in-memory and third-party APIs.

##### Detail without overcomplicating
- Every Python module as its own block or grouped into its service layer.
- Clearly where environment variables (API keys) feed into each service.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Users
    User[/"User"/]:::external

    %% Frontend Layer
    subgraph "Frontend"
        CLI["CLI (app.py)"]:::frontend
        Streamlit["Streamlit UI (frontend/streamlit_app.py)"]:::frontend
    end

    %% Controller Layer
    Orchestrator["Orchestrator / Controller (app.py)"]:::controller

    %% Services Layer
    subgraph "Service Adapters"
        WebSearch["Web Search Service\n(search/web_search.py)"]:::service
        LLMService["LLM Service\n(llm/groq_model.py)"]:::service
        Prompts["LLM Prompts\n(llm/prompts.py)"]:::service
        Parsers["LLM Parsers\n(llm/parser_models.py)"]:::service
        YouTube["YouTube Client\n(data/youtube_client.py)"]:::service
        EmailService["Email Service\n(utils/email_service.py)"]:::service
    end

    %% Flows
    User -->|"invokes"| CLI
    User -->|"opens"| Streamlit

    CLI -->|"ProductQuery"| Orchestrator
    Streamlit -->|"ProductQuery"| Orchestrator
    Orchestrator -->|"ProductQuery"| WebSearch
    WebSearch -->|"ProductListings"| Orchestrator

    Orchestrator -->|"ProductListings + PromptTemplate"| Prompts
    Prompts -->|"PromptTemplate"| LLMService
    Orchestrator -->|"ComparisonPrompt"| LLMService
    LLMService -->|"RawLLMResponse"| Parsers
    Parsers -->|"ComparisonReport"| Orchestrator

    Orchestrator -->|"VideoQuery"| YouTube
    YouTube -->|"VideoSuggestions"| Orchestrator

    Orchestrator -->|"ComparisonReport + Videos"| EmailService
    EmailService -->|"EmailReport"| User

    Orchestrator -->|"ComparisonReport"| Streamlit

    %% Click Events
    click CLI "https://github.com/tanujkumar24/shopgenie_project/blob/main/app.py"
    click Orchestrator "https://github.com/tanujkumar24/shopgenie_project/blob/main/app.py"
    click Streamlit "https://github.com/tanujkumar24/shopgenie_project/blob/main/frontend/streamlit_app.py"
    click WebSearch "https://github.com/tanujkumar24/shopgenie_project/blob/main/search/web_search.py"
    click LLMService "https://github.com/tanujkumar24/shopgenie_project/blob/main/llm/groq_model.py"
    click Prompts "https://github.com/tanujkumar24/shopgenie_project/blob/main/llm/prompts.py"
    click Parsers "https://github.com/tanujkumar24/shopgenie_project/blob/main/llm/parser_models.py"
    click YouTube "https://github.com/tanujkumar24/shopgenie_project/blob/main/data/youtube_client.py"
    click EmailService "https://github.com/tanujkumar24/shopgenie_project/blob/main/utils/email_service.py"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#000,stroke-width:1px
    classDef service fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
