# evilgeek/disposable-email-detection-api architecture

> Architecture diagram of the GitHub repository evilgeek/disposable-email-detection-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/evilgeek/disposable-email-detection-api
- Repository: https://github.com/evilgeek/disposable-email-detection-api

## Overview

##### Project Type and Purpose
- This is a single-service, RESTful API built with Flask (Python 3.7+) that:
- Accepts HTTP requests to check emails/domains
- Determines if they are disposable or public
- Performs MX-record lookups
- Suggests correct domains on typos
- Deployed (per vercel.json) as a serverless or containerized function.

##### Main Components
a. API Layer
- DispoEMailAPI.py: Flask app exposing endpoints:
- /check-disposable
- /check-public
- /mx-lookup
- /suggest-domain
b. Business-Logic Layer
- utils.py: email parsing, domain normalization, suggestion algorithm
- database.py: data-access functions to read/write SQLite
c. Data Layer
- SQLite database (file on disk or ephemeral in serverless) holding:
- Disposable-domain list
- Public-domain list
d. External Services
- DNS Resolver(s): MX-record lookups via DNS
- Clients: any consumer making HTTP requests (web app, mobile app, CLI)
e. Deployment/Configuration
- vercel.json: deployment routing and environment configuration

##### Relationships and Data Flows
- Client → HTTP(S) Request → Flask API (DispoEMailAPI.py)
- API calls into utils.py & database.py
- database.py → SQLite: query domain lists
- If MX lookup endpoint: API → DNS resolver → returns MX records
- utils.py may call DNS as well for suggestion verification
- API assembles response and returns JSON to client

##### Architectural Patterns & Design Principles
- Layered architecture (Presentation/API → Business Logic → Data)
- Separation of concerns:
- DispoEMailAPI.py handles routing & response formatting
- utils.py encapsulates algorithms and helpers
- database.py abstracts persistence
- Single-service / microservice style: one codebase, multiple endpoints
- Stateless per request (state stored only in SQLite; no in-memory session)

##### Detailed Component Breakdown
- Inside: Routing layer (DispoEMailAPI.py)
- Business logic layer (utils.py)
- Data-access layer (database.py)
- Data Store:
- Tables/collections: disposable_domains, public_domains
- External DNS Resolver:
- Deployment:

##### Final Checklist
- [ ] All components clearly labeled
- [ ] Separate layers for routing, logic, persistence, external calls
- [ ] Note on deployment config (vercel.json)
- [ ] Include callouts for key technologies (Flask, SQLite, DNS)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients"
        direction TB
        Client["Client (Web/Mobile/CLI)"]:::external
    end

    %% API Layer
    subgraph "Flask App"
        direction TB
        API["DispoEMailAPI.py<br/>(Routing & Endpoints)"]:::internal
        Utils["utils.py<br/>(Business Logic)"]:::internal
        DB_Layer["database.py<br/>(Data Access)"]:::internal
    end

    %% Data & External Services
    subgraph "Data & External Services"
        direction TB
        SQLite["SQLite Database<br/>(disposable_domains, public_domains)"]:::db
        DNS["DNS Service<br/>(MX lookup)"]:::external
    end

    %% Deployment & Config
    Config["vercel.json<br/>(Deployment Config)"]:::config
    subgraph "Project Files"
        direction TB
        Req["requirements.txt"]:::config
        Readme["README.md"]:::config
        Git[".gitignore"]:::config
    end

    %% Connections
    Client -->|"HTTP Request"| API
    API -->|"calls"| Utils
    API -->|"calls"| DB_Layer
    API -->|"MX lookup"| DNS
    Utils -->|"verifies suggestions via MX lookup"| DNS
    DB_Layer -->|"queries"| SQLite
    API -->|"JSON Response"| Client
    Config -.-> API

    %% Click Events
    click API "https://github.com/evilgeek/disposable-email-detection-api/blob/main/DispoEMailAPI.py"
    click Utils "https://github.com/evilgeek/disposable-email-detection-api/blob/main/utils.py"
    click DB_Layer "https://github.com/evilgeek/disposable-email-detection-api/blob/main/database.py"
    click Config "https://github.com/evilgeek/disposable-email-detection-api/blob/main/vercel.json"
    click Req "https://github.com/evilgeek/disposable-email-detection-api/blob/main/requirements.txt"
    click Readme "https://github.com/evilgeek/disposable-email-detection-api/blob/main/README.md"
    click Git "https://github.com/evilgeek/disposable-email-detection-api/blob/main/.gitignore"

    %% Styles
    classDef internal fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef external fill:#F5B041,stroke:#B03A2E,stroke-width:2px;
    classDef db fill:#ABEBC6,stroke:#1D8348,stroke-width:2px,shape:cylinder;
    classDef config fill:#D7DBDD,stroke:#566573,stroke-width:2px;
```
