# mrl-creator/gmail-cleaner architecture

> Architecture diagram of the GitHub repository mrl-creator/gmail-cleaner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrl-creator/gmail-cleaner
- Repository: https://github.com/mrl-creator/gmail-cleaner

## Overview

Gmail Cleaner is a Google Apps Script that finds expired OTP and verification emails, then logs or trashes matching Gmail threads. The documented principal workflow is a scheduled or manual run, query construction with age and safety exclusions, batched Gmail searches, audit logging, and optional bulk trashing. The supplied source excerpt covers only cleaner.js; other source files and README-described capabilities such as dashboard and multi-account behavior are not evidenced here, so they are omitted rather than inferred.

Main entry points: [`cleaner.js`](https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js) (Cleanup run)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cleanup["Email cleanup"]
  node_entry["Cleanup run<br/>[cleaner.js]"]
  node_query["Search query<br/>[cleaner.js]"]
  node_batch["Batch processing<br/>[cleaner.js]"]
  node_audit["Audit logging<br/>[cleaner.js]"]
end

subgraph group_services["Gmail services"]
  node_gmail[("Gmail")]
end

node_user(("Account owner"))

node_user -->|"starts"| node_entry
node_entry -->|"builds"| node_query
node_entry -->|"runs batches"| node_batch
node_batch -->|"searches"| node_gmail
node_batch -->|"trashes threads"| node_gmail
node_entry -->|"logs run"| node_audit
node_query -->|"filters search"| node_batch

click node_entry "https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js"
click node_query "https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js"
click node_batch "https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js"
click node_audit "https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_query,node_batch,node_audit toneBlue
class node_gmail toneAmber
class node_user toneIndigo
```

## Components

### Email cleanup

- [Cleanup run](https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js): `cleaner.js`
- [Search query](https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js): `cleaner.js`
- [Batch processing](https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js): `cleaner.js`
- [Audit logging](https://github.com/mrl-creator/gmail-cleaner/blob/master/cleaner.js): `cleaner.js`

### Gmail services

- **Gmail**

### Other components

- **Account owner**

## Connections

- Account owner → Cleanup run: starts (evidence: `README.md`)
- Cleanup run → Search query: builds (evidence: `cleaner.js`)
- Cleanup run → Batch processing: runs batches (evidence: `cleaner.js`)
- Batch processing → Gmail: searches (evidence: `cleaner.js`)
- Batch processing → Gmail: trashes threads (evidence: `cleaner.js`)
- Cleanup run → Audit logging: logs run (evidence: `cleaner.js`)
- Search query → Batch processing: filters search (evidence: `cleaner.js`)
