# dilpreet-singh-13/missnomail architecture

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

- Interactive diagram: https://gitdiagram.com/dilpreet-singh-13/missnomail
- Repository: https://github.com/dilpreet-singh-13/missnomail

## Overview

- Gmail Integration – This component represents the connection with the Gmail API. It encompasses authentication (oAuth/token management) and email data retrieval (using emails_fetch.py).
- Email Fetcher (emails_fetch.py) – A dedicated module that handles interacting with the Gmail API, fetching recent emails (default: past 1 day) and providing content needed for processing.
- LLM Filtering & Extraction (llm_utils.py) – This module takes the retrieved email data and applies a large language model (e.g., Google’s Gemini AI or any other chosen LLM) to filter for relevant job/internship emails and extract structured details (company, position, application link, deadline, etc.).
- Digest Generator (logic within main.py) – This part processes the output from the LLM filtering module to create a neatly formatted email digest using a markdown template (the template_str inside main.py).
- Delivery Mechanism – Although not a separate file, the final digest is delivered to the user’s inbox. This can be visualized as the end point after processing.
- Configuration & Environment Setup – Represented by files such as .env.example and token management (token.json, generated after first manual authentication) which are used to store sensitive API keys and settings.
- GitHub Actions Pipeline – This automation component ensures that after an initial manual run (required to generate token.json), the entire process can be scheduled and executed automatically via the actions.yml workflow in the .github/workflows folder.

##### Out the Flow and Relationships
- Additionally, include a side branch depicting “GitHub Actions” that, on a schedule, triggers the execution of main.py. Link this branch to the “Digest Generator” block to show that the same process is automated.
- Finally, include a component for “Configuration & Secret Management” (drawing from .env.example, token.json, and GitHub Actions secrets) linking to the overall system to denote that environment-based configuration moderates behavior in several components.

##### Architectural Patterns and Technologies
- That the project is primarily a utility script (not a full-stack web application) relying on modular Python files for separation of concerns.
- Use of third-party integrations like the Gmail API and an LLM (which represents external services).
- That the system uses automation (via GitHub Actions) and environment-driven configuration, which are both key design choices.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Services
    A["User's Gmail Account"]:::external

    %% Core Processing Modules
    B["Gmail Integration & Email Fetcher"]:::core
    C["LLM Filtering & Extraction"]:::core
    D["Digest Generator"]:::core
    E["Delivery Mechanism"]:::external

    %% Infrastructure/Automation
    F["GitHub Actions Pipeline"]:::infra

    %% Configuration Component
    G["Configuration & Environment Setup"]:::config

    %% Data Flow
    A -->|"fetches"| B
    B -->|"sends"| C
    C -->|"processes"| D
    D -->|"delivers"| E

    %% Automation Trigger
    F -->|"triggers"| D

    %% Configuration influence arrows
    G -->|"configures"| B
    G -->|"configures"| C
    G -->|"configures"| D

    %% Click Events
    click B "https://github.com/dilpreet-singh-13/missnomail/blob/main/emails_fetch.py"
    click C "https://github.com/dilpreet-singh-13/missnomail/blob/main/llm_utils.py"
    click D "https://github.com/dilpreet-singh-13/missnomail/blob/main/main.py"
    click F "https://github.com/dilpreet-singh-13/missnomail/blob/main/.github/workflows/actions.yml"
    click G "https://github.com/dilpreet-singh-13/missnomail/blob/main/.env.example"

    %% Styles
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px,color:black;
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px,color:black;
    classDef infra fill:#90EE90,stroke:#333,stroke-width:2px,color:black;
    classDef config fill:#FFB6C1,stroke:#333,stroke-width:2px,color:black;
```
