# xenoswarlocks/email_pattern_verification architecture

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

- Interactive diagram: https://gitdiagram.com/xenoswarlocks/email_pattern_verification
- Repository: https://github.com/xenoswarlocks/email_pattern_verification

## Overview

##### Project Overview
- Your project is essentially a two-component system. One component is a backend API (built with Flask, as indicated by the api.py file and FLASK_ENV variable) and the other is a frontend user interface built with Streamlit (using a dedicated streamlit_app.py within the “frondend” folder and custom components/pages).
- Docker containerization is used extensively. There are three Dockerfiles (a generic one, and then specific Dockerfile.api and Dockerfile.frontend) and a docker-compose.yml file to orchestrate the API and frontend services.
- The project supports multiple deployment strategies, including local Docker deployment, Heroku, and Google Cloud Run. This indicates that the system design should also account for container orchestration and external deployment/hosting aspects.

##### Main Components
a. Backend Service:
- That it runs on port 5000 and is containerized using Dockerfile.api.
- Mention that it might include email verification logic (as implied by the project’s name and the presence of api.py).

b. Frontend Service:
- Details like:
- It is structured into directories “frondend/components” and “frondend/pages,” representing UI components (footer, header, sidebar, styles) and different pages (dashboard, home, payment, pricing).
- The main entry point for the UI is streamlit_app.py; note the use of Streamlit for interactive UI.
- It runs on port 8501 and is containerized using Dockerfile.frontend.
- That the frontend depends on the API (via an environment variable API_URL=http://api:5000).

c. Docker and Deployment Infrastructure:
- External deployment scenarios:

d. Additional Components:
- Shared infrastructure like “Volumes” (as seen in docker-compose, where ./logs is mounted to /app/logs for API logging).
- Optionally, include placeholders for testing (files like testing.py and email_tes.py) to highlight that there is a test suite making sure components interact correctly.

##### Capturing Architectural Patterns
- Separation of concerns:
- The services are decoupled, which is why the Docker containers are used.
- Dependency inversion:
- The frontend is designed to consume the API endpoints, reinforcing an API-first mindset.
- Containerization:
- Each service has its dedicated Dockerfile for an isolated environment ensuring consistent deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    DI("Docker Infrastructure\n(Dockerfile, docker-compose.yml)"):::docker

    subgraph "Services (Docker Compose)"
        FE("Frontend Service\n(Streamlit, port 8501)"):::frontend
        API("API Service\n(Flask, port 5000)"):::api
        VOL("Logs Volume\n(/app/logs)"):::docker
        FE -->|"calls_API"| API
        API -->|"logs_to"| VOL
    end

    DI -->|"orchestrates"| FE
    DI -->|"orchestrates"| API

    subgraph "Cloud Deployments"
        Heroku("Heroku"):::docker
        GCR("Google Cloud Run"):::docker
    end
    DI -->|"builds_images_for"| Heroku
    DI -->|"builds_images_for"| GCR

    TEST("Testing Suite\n(tests: testing.py, email_tes.py)"):::testing
    API ---|"tested_by"| TEST
    FE ---|"tested_by"| TEST

    click API "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/api.py"
    click API "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/Dockerfile.api"
    click API "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/docker-compose.yml"
    click FE "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/frondend/streamlit_app.py"
    click FE "https://github.com/xenoswarlocks/email_pattern_verification/tree/main/frondend/components"
    click FE "https://github.com/xenoswarlocks/email_pattern_verification/tree/main/frondend/pages"
    click FE "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/Dockerfile.frontend"
    click DI "https://github.com/xenoswarlocks/email_pattern_verification/tree/main/Dockerfile"
    click DI "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/docker-compose.yml"
    click TEST "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/testing.py"
    click TEST "https://github.com/xenoswarlocks/email_pattern_verification/blob/main/email_tes.py"

    classDef api fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef frontend fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef docker fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef testing fill:#f8bbd0,stroke:#880e4f,stroke-width:2px;
```
