# sayamkhatri/ai-powered-prompt-engineering-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/sayamkhatri/ai-powered-prompt-engineering-assistant
- Repository: https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant

## Overview

##### Main components
- Backend: A Python application (located in the backend directory) that contains various modules such as main.py, detect_pii.py, prompt_classifier.py, prompt_score.py, and several prompt template-related files. This component likely handles processing of prompts including AI-based prompt engineering, PII detection, scoring, and template management.
- Infrastructure/Deployment: The presence of a Dockerfile and GitHub workflow configuration (under .github/workflows/deploy.yml) indicate that the project includes containerization and automated deployment setups.

##### File structure for architectural clues
- The separation into a backend folder and a chrome-extension folder suggests a clear separation of concerns where the backend does the heavy lifting of processing and AI functionalities while the Chrome extension offers an interactive frontend.
- Look at the Python modules: each script in the backend might represent a specific functionality (e.g., detect_pii.py for detecting sensitive data, prompt_score.py for scoring prompts), suggesting a modular or service-oriented architecture within the backend.
- GitHub workflows and requirements.txt indicate the project’s build and dependency management are clearly laid out.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    User("User"):::frontend

    %% Chrome Extension Layer
    subgraph "Chrome Extension Layer"
        CE("Chrome Extension UI"):::frontend
        Manifest("manifest.json"):::frontend
        BG("background.js"):::frontend
        Content("content.js"):::frontend
        Popup("popup.html & popup.js & popup.css"):::frontend
        Icons("Icon Resources"):::frontend
    end

    %% Backend Service
    subgraph "Backend Service"
        Main("main.py"):::backend
        PII("detect_pii.py"):::backend
        Classifier("prompt_classifier.py"):::backend
        Score("prompt_score.py"):::backend
        TemplateDesc("prompt_template_desc.py"):::backend
        TemplatesShort("prompt_templates_short.py"):::backend
    end

    %% Infrastructure & Deployment
    subgraph "Infrastructure"
        Container("Docker Container"):::infra
        Deployment("CI/CD Pipeline"):::infra
        Dependency("Dependency Management"):::infra
    end

    %% Data Flow Connections
    User -->|"Interacts"| CE
    CE -->|"API Request"| Main

    Main -->|"PII Detection"| PII
    Main -->|"Classify Prompt"| Classifier
    Main -->|"Score Prompt"| Score
    Main -->|"Load Template Desc"| TemplateDesc
    Main -->|"Load Short Templates"| TemplatesShort

    %% Deployment Connections
    Main ---|"Deployed as"| Container
    Deployment -->|"Build&Deploy"| Container

    %% Click Events
    click CE "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/tree/main/chrome-extension/"
    click Manifest "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/chrome-extension/manifest.json"
    click BG "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/chrome-extension/background.js"
    click Content "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/chrome-extension/content.js"
    click Popup "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/chrome-extension/popup.html"
    click Icons "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/tree/main/chrome-extension/icons/"

    click Main "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/main.py"
    click PII "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/detect_pii.py"
    click Classifier "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/prompt_classifier.py"
    click Score "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/prompt_score.py"
    click TemplateDesc "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/prompt_template_desc.py"
    click TemplatesShort "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/backend/prompt_templates_short.py"

    click Container "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/tree/main/Dockerfile"
    click Deployment "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/.github/workflows/deploy.yml"
    click Dependency "https://github.com/sayamkhatri/ai-powered-prompt-engineering-assistant/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef infra fill:#FFD700,stroke:#000,stroke-width:2px;
```
