# dushyant4342/bedrockembeddings-pdf-faiss architecture

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

- Interactive diagram: https://gitdiagram.com/dushyant4342/bedrockembeddings-pdf-faiss
- Repository: https://github.com/dushyant4342/bedrockembeddings-pdf-faiss

## Overview

##### Main Components
- Client/User: The end user’s browser that interacts with the Streamlit web app.
- Docker Host (EC2 Instance): The physical or virtual machine running Docker. This is where the Docker image is built and deployed.
- Docker Container: Encapsulates the Streamlit web app (app.py) along with its dependencies (requirements.txt) and the operating environment defined by the Dockerfile.
- Mounted Data Volume: The “data” folder on the host (EC2 folder) that is mounted to /app/data inside the container. This is important for storing and persisting the uploaded/resume PDFs.
- (Future/Optional) External Components such as:
- AWS Load Balancer: For handling high traffic.
- Nginx & HTTPS Termination: For securing the application with SSL certificates (as mentioned in the README).
- ECS for autoscaling: If the deployment moves from EC2 to an orchestrated container service.

##### Relationships & Interactions
- The client’s HTTP requests are directed (currently) to the Docker container’s Streamlit server running on port 8501.
- The container is built from the Dockerfile and runs app.py, which comprises the core application logic.
- The data folder on the host is mounted into the container, ensuring that PDF files (like DushyantResume.pdf) persist beyond container restarts.
- The README instructions refer to using environment variables for AWS credentials, so if the application interacts with AWS services (e.g., for storage or processing), include an “External AWS Services” component.

##### Architectural Patterns in Use
- Containerization: Clearly isolate the application logic and environment from the host.
- Volume Mounting: Distinguishes between ephemeral container storage and persistent storage on EC2.

##### Relevant Technologies & Frameworks
- Streamlit: The web application framework used within app.py.
- Docker: For containerizing the application environment.
- AWS and EC2: The cloud platform where the container is deployed.
- Nginx & Certbot: For next-step HTTPS setup, as described in the README.
- (Optionally) AWS ECS & Load Balancer: For scaling and load management per the future plans.

- Don’t oversimplify. Break down the system into all its elemental parts—even if some, like future load balancer or ECS, are planned improvements.
- Relationships explicitly to provide a high-level view (client → EC2/Docker → internal app, with supporting AWS connectivity if applicable).

A Sample Layout Might Look Like:

[Client Browser]
│ (HTTP Request over port 8501)
▼
[EC2 Host running Docker]
│
├──> [Docker Container]
│        │
│        ├──> [Streamlit App (app.py)]
│        └──> [Internal Dependencies from requirements.txt]
│
└──> [Mounted Data Volume: /app/data (mapped from host’s /data folder)]

(Optional Side Components)
├──> [AWS Load Balancer] (for high traffic)
├──> [Nginx] (for HTTPS termination and domain handling)
└──> [AWS ECS] (for autoscaling)

## Diagram (Mermaid)

```mermaid
graph TD
    LB["AWS Load Balancer"]:::future
    CLIENT["Client Browser"]:::client
    NGINX["Nginx (HTTPS Termination)"]:::future
    ECS["AWS ECS (Autoscaling)"]:::future
    EC2["EC2 Docker Host"]:::host
    CONTAINER["Docker Container"]:::container
    APP["Streamlit App (app.py)"]:::app
    DEP["Dependencies (requirements.txt)"]:::dep
    DOCKERFILE["Dockerfile"]:::docker
    VOLUME["Persistent Data Volume (/data -> /app/data)"]:::volume

    CLIENT -->|"HTTP_Request(8501)"| APP
    CLIENT -->|"Optional_ThroughLB"| LB
    LB -->|"RoutesTraffic"| EC2
    EC2 --> CONTAINER
    CONTAINER --> APP
    CONTAINER --> DEP
    CONTAINER --> DOCKERFILE
    EC2 --> VOLUME
    CONTAINER -->|"Uses_MountedVolume"| VOLUME
    LB -->|"IntegratesWith"| NGINX
    NGINX -->|"SecuresCommunication"| EC2
    ECS -->|"ManagesScaling"| EC2

    click APP "https://github.com/dushyant4342/bedrockembeddings-pdf-faiss/blob/main/app.py"
    click DOCKERFILE "https://github.com/dushyant4342/bedrockembeddings-pdf-faiss/tree/main/Dockerfile"
    click DEP "https://github.com/dushyant4342/bedrockembeddings-pdf-faiss/blob/main/requirements.txt"
    click VOLUME "https://github.com/dushyant4342/bedrockembeddings-pdf-faiss/tree/main/data/"

    classDef client fill:#cce5ff,stroke:#000,stroke-width:2px;
    classDef host fill:#e2e2e2,stroke:#333,stroke-width:1px;
    classDef container fill:#ccffcc,stroke:#333,stroke-width:1px;
    classDef app fill:#ffcccb,stroke:#333,stroke-width:1px;
    classDef dep fill:#fff2cc,stroke:#333,stroke-width:1px;
    classDef docker fill:#d1c4e9,stroke:#333,stroke-width:1px;
    classDef volume fill:#ffd966,stroke:#333,stroke-width:1px;
    classDef future fill:#f7c6c7,stroke:#333,stroke-width:1px;
```
