# pupariaa/composa architecture

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

- Interactive diagram: https://gitdiagram.com/pupariaa/composa
- Repository: https://github.com/pupariaa/composa

## Overview

Composa is a Node.js library and interactive CLI for composing multilingual XHTML email and sending it through Nodemailer. The main workflow is application code configuring a provider and EmailClient, compiling a template into HTML and a subject, then sending the message. The library also supports bulk sending, retries, template management, and connection checks. The source excerpts show template loading and delivery behavior; relationships for unsampled implementation details are omitted or grounded in README statements.

Main entry points: [`src/email-client.js`](https://github.com/pupariaa/composa/blob/main/src/email-client.js) (EmailClient), [`templates`](https://github.com/pupariaa/composa/tree/main/templates) (XHTML templates), [`src/email-providers.js`](https://github.com/pupariaa/composa/blob/main/src/email-providers.js) (Provider presets), [`bin/composa.mjs`](https://github.com/pupariaa/composa/blob/main/bin/composa.mjs) (Provider setup CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_composition["Email composition"]
  node_emailclient["EmailClient<br/>[email-client.js]"]
  node_subjects["Default subjects"]
  node_templateengine["Template engine<br/>[template-engine.js]"]
end

subgraph group_delivery["Provider and delivery"]
  node_providers["Provider presets<br/>[email-providers.js]"]
  node_nodemailer["Nodemailer"]
  node_smtp{{"SMTP providers"}}
end

subgraph group_templates["Template content"]
  node_templateassets["XHTML templates"]
  node_english["English templates"]
  node_french["French templates"]
end

subgraph group_setup["Interactive setup"]
  node_cli["Provider setup CLI<br/>[composa.mjs]"]
end

node_application(("Application"))
node_cliuser(("CLI user"))

node_application -->|"configures and calls"| node_emailclient
node_application -->|"supplies subjects"| node_subjects
node_emailclient -->|"loads templates"| node_templateassets
node_emailclient -->|"sends through"| node_nodemailer
node_emailclient -->|"delivers email"| node_smtp
node_templateengine -->|"loads templates"| node_templateassets
node_templateassets -.->|"includes"| node_english
node_templateassets -.->|"includes"| node_french
node_application -->|"creates transport config"| node_providers
node_providers -->|"configures"| node_smtp
node_cliuser -->|"runs setup"| node_cli
node_cli -->|"requests provider config"| node_providers

click node_emailclient "https://github.com/pupariaa/composa/blob/main/src/email-client.js"
click node_subjects "https://github.com/pupariaa/composa/blob/main/src/default-subjects.js"
click node_templateengine "https://github.com/pupariaa/composa/blob/main/src/template-engine.js"
click node_templateassets "https://github.com/pupariaa/composa/tree/main/templates"
click node_english "https://github.com/pupariaa/composa/tree/main/templates/en-EN"
click node_french "https://github.com/pupariaa/composa/tree/main/templates/fr-FR"
click node_providers "https://github.com/pupariaa/composa/blob/main/src/email-providers.js"
click node_cli "https://github.com/pupariaa/composa/blob/main/bin/composa.mjs"

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_emailclient,node_subjects,node_templateengine,node_cliuser toneBlue
class node_providers,node_nodemailer,node_smtp toneAmber
class node_templateassets,node_english,node_french toneMint
class node_cli toneRose
class node_application toneIndigo
```

## Components

### Email composition

- [EmailClient](https://github.com/pupariaa/composa/blob/main/src/email-client.js): `src/email-client.js`
- [Default subjects](https://github.com/pupariaa/composa/blob/main/src/default-subjects.js): `src/default-subjects.js`
- [Template engine](https://github.com/pupariaa/composa/blob/main/src/template-engine.js): `src/template-engine.js`

### Provider and delivery

- [Provider presets](https://github.com/pupariaa/composa/blob/main/src/email-providers.js): `src/email-providers.js`
- **Nodemailer**
- **SMTP providers**

### Template content

- [XHTML templates](https://github.com/pupariaa/composa/tree/main/templates): `templates`
- [English templates](https://github.com/pupariaa/composa/tree/main/templates/en-EN): `templates/en-EN`
- [French templates](https://github.com/pupariaa/composa/tree/main/templates/fr-FR): `templates/fr-FR`

### Interactive setup

- [Provider setup CLI](https://github.com/pupariaa/composa/blob/main/bin/composa.mjs): `bin/composa.mjs`

### Other components

- **Application**
- **CLI user**

## Connections

- Application → EmailClient: configures and calls (evidence: `README.md`)
- Application → Default subjects: supplies subjects (evidence: `README.md`)
- EmailClient → XHTML templates: loads templates (evidence: `src/email-client.js`)
- EmailClient → Nodemailer: sends through (evidence: `src/email-client.js`)
- EmailClient → SMTP providers: delivers email (evidence: `README.md`)
- Template engine → XHTML templates: loads templates (evidence: `src/template-engine.js`)
- XHTML templates → English templates: includes
- XHTML templates → French templates: includes
- Application → Provider presets: creates transport config (evidence: `README.md`)
- Provider presets → SMTP providers: configures (evidence: `src/email-providers.js`)
- CLI user → Provider setup CLI: runs setup (evidence: `bin/composa.mjs`)
- Provider setup CLI → Provider presets: requests provider config (evidence: `bin/composa.mjs`)
