# demand-media-bpm/truesendr-backend architecture

> Architecture diagram of the GitHub repository demand-media-bpm/truesendr-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/demand-media-bpm/truesendr-backend
- Repository: https://github.com/demand-media-bpm/truesendr-backend

## Overview

This repository appears to be an email-verification and list-management backend, despite its generic Create React App README. The principal workflow is a user submitting an email or list to the API, which dispatches single or bulk validation and returns status/results; supporting branches cover account access, finder jobs, phone checks, deliverability tests, toxicity checks, file cleanup, training, and dashboard statistics. Evidence is limited to the supplied excerpts and SOURCE INDEX; some route registration and unsampled feature details are therefore represented only where those references support them.

Main entry points: [`server.js`](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/server.js) (HTTP and socket server), [`utils/smtpValidator.js`](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/smtpValidator.js) (SMTP verification), [`routes/singleValidator.js`](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/singleValidator.js) (Single validation), [`routes/bulkValidator.js`](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/bulkValidator.js) (Bulk validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and accounts"]
  node_server["HTTP and socket server<br/>[server.js]"]
  node_auth["Account access<br/>[auth.js]"]
  node_mailer["Account email<br/>[mailer.js]"]
end

subgraph group_verification["Email verification"]
  node_single["Single validation<br/>[singleValidator.js]"]
  node_bulk["Bulk validation<br/>[bulkValidator.js]"]
  node_validator["Validation rules<br/>[validator.js]"]
  node_smtp["SMTP verification<br/>[smtpValidator.js]"]
  node_training_routes["Training operations<br/>[training.js]"]
  node_toxicity["Toxicity checks<br/>[ToxicityChecker.js]"]
end

subgraph group_operations["List and deliverability tools"]
  node_finder["Email finder<br/>[EmailFinder.js]"]
  node_phone["Phone validation<br/>[phoneValidator.js]"]
  node_deliverability["Deliverability tests<br/>[deliverability.js]"]
  node_dashboard["Dashboard reporting<br/>[Dashboard.js]"]
  node_cleaner_route["File cleanup API<br/>[fileCleaner.js]"]
  node_cleaner["File cleanup logic<br/>[fileCleaner.js]"]
end

subgraph group_data["Persistence and analytics"]
  node_user_model[("User records<br/>[User.js]")]
  node_training[("Training samples<br/>[TrainingSample.js]")]
  node_finder_records[("Finder records<br/>[Finder.js]")]
  node_dash_stats[("Dashboard stats<br/>[DashStat.js]")]
  node_bulk_stats[("Bulk job state<br/>[BulkStat.js]")]
  node_region_stats[("Regional stats<br/>[RegionStats.js]")]
end

node_user(("API user"))
node_dns_smtp{{"DNS and mail servers"}}
node_external_mail{{"Mail transport"}}

node_user -->|"submits requests"| node_server
node_server -->|"routes auth"| node_auth
node_server -->|"routes validation"| node_single
node_server -->|"routes bulk jobs"| node_bulk
node_server -->|"routes checks"| node_toxicity
node_server -->|"routes finder"| node_finder
node_server -->|"routes phone checks"| node_phone
node_server -->|"routes tests"| node_deliverability
node_server -->|"routes dashboard"| node_dashboard
node_server -.->|"routes cleanup"| node_cleaner_route
node_auth -->|"reads and updates"| node_user_model
node_auth -->|"sends account email"| node_mailer
node_single -->|"applies rules"| node_validator
node_single -->|"uses samples"| node_training
node_bulk -->|"validates addresses"| node_validator
node_bulk -.->|"tracks job state"| node_bulk_stats
node_validator -->|"updates counters"| node_dash_stats
node_smtp -->|"reads training history"| node_training
node_smtp -->|"queries mail infrastructure"| node_dns_smtp
node_single -.->|"performs SMTP checks"| node_smtp
node_bulk -.->|"performs SMTP checks"| node_smtp
node_training_routes -->|"manages samples"| node_training
node_toxicity -->|"uses validation logic"| node_validator
node_finder -->|"reads and writes jobs"| node_finder_records
node_finder -->|"checks candidate addresses"| node_smtp
node_deliverability -.->|"tests mailbox access"| node_external_mail
node_dashboard -->|"reads statistics"| node_dash_stats
node_dashboard -.->|"uses regional data"| node_region_stats
node_cleaner_route -->|"delegates cleanup"| node_cleaner

click node_server "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/server.js"
click node_auth "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/auth.js"
click node_user_model "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/User.js"
click node_mailer "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/mail/mailer.js"
click node_single "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/singleValidator.js"
click node_bulk "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/bulkValidator.js"
click node_validator "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/validator.js"
click node_smtp "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/smtpValidator.js"
click node_training_routes "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/training.js"
click node_training "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/TrainingSample.js"
click node_toxicity "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/ToxicityChecker.js"
click node_finder "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/EmailFinder.js"
click node_finder_records "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/Finder.js"
click node_phone "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/phoneValidator.js"
click node_deliverability "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/deliverability.js"
click node_dashboard "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/Dashboard.js"
click node_dash_stats "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/DashStat.js"
click node_bulk_stats "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/BulkStat.js"
click node_region_stats "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/RegionStats.js"
click node_cleaner_route "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/fileCleaner.js"
click node_cleaner "https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/fileCleaner.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_server,node_auth,node_mailer,node_user toneBlue
class node_single,node_bulk,node_validator,node_smtp,node_training_routes,node_toxicity toneAmber
class node_finder,node_phone,node_deliverability,node_dashboard,node_cleaner_route,node_cleaner,node_dns_smtp toneMint
class node_user_model,node_training,node_finder_records,node_dash_stats,node_bulk_stats,node_region_stats toneRose
class node_external_mail toneIndigo
```

## Components

### API and accounts

- [HTTP and socket server](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/server.js): `server.js`
- [Account access](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/auth.js): `routes/auth.js`
- [Account email](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/mail/mailer.js): `mail/mailer.js`

### Email verification

- [Single validation](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/singleValidator.js): `routes/singleValidator.js`
- [Bulk validation](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/bulkValidator.js): `routes/bulkValidator.js`
- [Validation rules](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/validator.js): `utils/validator.js`
- [SMTP verification](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/smtpValidator.js): `utils/smtpValidator.js`
- [Training operations](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/training.js): `routes/training.js`
- [Toxicity checks](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/ToxicityChecker.js): `routes/ToxicityChecker.js`

### List and deliverability tools

- [Email finder](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/EmailFinder.js): `routes/EmailFinder.js`
- [Phone validation](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/phoneValidator.js): `routes/phoneValidator.js`
- [Deliverability tests](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/deliverability.js): `routes/deliverability.js`
- [Dashboard reporting](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/Dashboard.js): `routes/Dashboard.js`
- [File cleanup API](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/routes/fileCleaner.js): `routes/fileCleaner.js`
- [File cleanup logic](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/utils/fileCleaner.js): `utils/fileCleaner.js`

### Persistence and analytics

- [User records](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/User.js): `models/User.js`
- [Training samples](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/TrainingSample.js): `models/TrainingSample.js`
- [Finder records](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/Finder.js): `models/Finder.js`
- [Dashboard stats](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/DashStat.js): `models/DashStat.js`
- [Bulk job state](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/BulkStat.js): `models/BulkStat.js`
- [Regional stats](https://github.com/demand-media-bpm/truesendr-backend/blob/dev/models/RegionStats.js): `models/RegionStats.js`

### Other components

- **API user**
- **DNS and mail servers**
- **Mail transport**

## Connections

- API user → HTTP and socket server: submits requests (evidence: `server.js`)
- HTTP and socket server → Account access: routes auth (evidence: `server.js`)
- HTTP and socket server → Single validation: routes validation (evidence: `server.js`)
- HTTP and socket server → Bulk validation: routes bulk jobs (evidence: `server.js`)
- HTTP and socket server → Toxicity checks: routes checks (evidence: `server.js`)
- HTTP and socket server → Email finder: routes finder (evidence: `server.js`)
- HTTP and socket server → Phone validation: routes phone checks (evidence: `server.js`)
- HTTP and socket server → Deliverability tests: routes tests (evidence: `server.js`)
- HTTP and socket server → Dashboard reporting: routes dashboard (evidence: `server.js`)
- HTTP and socket server → File cleanup API: routes cleanup (evidence: `server.js`)
- Account access → User records: reads and updates (evidence: `routes/auth.js`)
- Account access → Account email: sends account email (evidence: `routes/auth.js`)
- Single validation → Validation rules: applies rules (evidence: `routes/singleValidator.js`)
- Single validation → Training samples: uses samples (evidence: `routes/singleValidator.js`)
- Bulk validation → Validation rules: validates addresses (evidence: `routes/bulkValidator.js`)
- Bulk validation → Bulk job state: tracks job state
- Validation rules → Dashboard stats: updates counters (evidence: `utils/validator.js`)
- SMTP verification → Training samples: reads training history (evidence: `utils/smtpValidator.js`)
- SMTP verification → DNS and mail servers: queries mail infrastructure (evidence: `utils/smtpValidator.js`)
- Single validation → SMTP verification: performs SMTP checks
- Bulk validation → SMTP verification: performs SMTP checks
- Training operations → Training samples: manages samples (evidence: `routes/training.js`)
- Toxicity checks → Validation rules: uses validation logic (evidence: `routes/ToxicityChecker.js`)
- Email finder → Finder records: reads and writes jobs (evidence: `routes/EmailFinder.js`)
- Email finder → SMTP verification: checks candidate addresses (evidence: `routes/EmailFinder.js`)
- Deliverability tests → Mail transport: tests mailbox access
- Dashboard reporting → Dashboard stats: reads statistics (evidence: `routes/Dashboard.js`)
- Dashboard reporting → Regional stats: uses regional data
- File cleanup API → File cleanup logic: delegates cleanup (evidence: `routes/fileCleaner.js`)
