# dhananjaylab/web_search_app architecture

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

- Interactive diagram: https://gitdiagram.com/dhananjaylab/web_search_app
- Repository: https://github.com/dhananjaylab/web_search_app

## Overview

##### Project type and purpose
- Its purpose is to extract text from URLs or documents, generate embeddings over that text, perform a search over those embeddings, and finally craft a user-facing prompt or result.

##### File structure
- Top-level scripts:
- wsearch.py        – likely the CLI entry point / orchestrator.
- text_extractor.py – pulls raw text from web pages or documents.
- embedding_search.py – computes or loads vector embeddings and performs nearest-neighbor search.
- prompt_generator.py – builds the final prompt or human-readable output for the user.
- No separate frontend/backend directories: it’s a single-process Python pipeline.
- No explicit database; embeddings are probably in memory or in local files.
- No web server or long-lived service—this is a CLI tool.

##### README for additional insights
- The README is minimal (“# web_search_app”), so most architecture clues come from the filenames and typical patterns:
- text extraction → vectorization → search → prompt assembly → output.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Internal Pipeline
    subgraph "Internal Pipeline"
        direction TB
        CLI["wsearch.py\n(CLI)"]:::internal
        TextExtractor["text_extractor.py\n(Text Extraction)"]:::internal
        EmbeddingSearch["embedding_search.py\n(Embedding/Search)"]:::internal
        PromptGenerator["prompt_generator.py\n(Prompt Generation)"]:::internal
        VectorIndex["In-memory Vector Index"]:::datastore
    end

    %% External Services
    ExternalWeb["Web (HTTP)"]:::external
    EmbeddingAPI["Embedding API"]:::external

    %% Data Flows
    CLI -->|"URL or Query"| TextExtractor
    TextExtractor -->|"fetch HTML"| ExternalWeb
    ExternalWeb -->|"raw HTML"| TextExtractor
    TextExtractor -->|"extracted text"| EmbeddingSearch
    EmbeddingSearch -->|"embedding request"| EmbeddingAPI
    EmbeddingAPI -->|"embeddings"| EmbeddingSearch
    EmbeddingSearch -->|"index vectors"| VectorIndex
    VectorIndex -->|"nearest neighbors"| EmbeddingSearch
    EmbeddingSearch -->|"search results"| PromptGenerator
    PromptGenerator -->|"final output"| CLI

    %% Click Events
    click CLI "https://github.com/dhananjaylab/web_search_app/blob/main/wsearch.py"
    click TextExtractor "https://github.com/dhananjaylab/web_search_app/blob/main/text_extractor.py"
    click EmbeddingSearch "https://github.com/dhananjaylab/web_search_app/blob/main/embedding_search.py"
    click PromptGenerator "https://github.com/dhananjaylab/web_search_app/blob/main/prompt_generator.py"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px
    classDef datastore fill:#FFFF99,stroke:#000,stroke-width:1px
```
