# robertbutlerdev/when-did-i-templates architecture

> Architecture diagram of the GitHub repository robertbutlerdev/when-did-i-templates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robertbutlerdev/when-did-i-templates
- Repository: https://github.com/robertbutlerdev/when-did-i-templates

## Overview

##### Main Components

a. Template Management Layer
- Two primary template types: Layouts and Partials
- Separation between HTML and text templates
- Compilation process

b. Provider Integration Layer
- Connection to email service providers (Mailjet)
- Demonstrate the provider configuration handling

c. Template Processing Engine
- Handlebars templating system
- TypeScript model integration
- Payload schema validation

##### Component Relationships

**┌─ Template Repository ─────────────────────┐**

- ┌─ Layouts ─────┐    ┌─ Partials ────┐  │
- HTML        │    │ - Header      │  │
- Text        │    │ - Footer      │  │
- Models      │    │ - Styles      │  │
- ┘    └──────────────┘   │
- ↓                 ↓            │
- ┌─ Template Engine ──────────────┐    │
- (Handlebars)              │    │
- ┘    │
- ↓                              │
- ┌─ Compilation Layer ──────────────┐  │
- TypeScript Models              │  │
- Payload Validation             │  │
- ┘    │
- ↓                              │
- ┌─ Provider Integration ────────────┐  │
- (Mailjet)                 │  │
- ┘    │
- ┘

##### Important Details to Highlight

a. Template Structure:
- How layouts and partials are organized
- Dual format support (HTML/Text)
- Model-template relationship

b. Processing Flow:
- Demonstrate the compilation process
- Validation points
- Where provider configuration is applied

##### Specific Implementation Notes

- How the orbit-template-http-repository is integrated
- Where TypeScript models are used
- Payload schema validation process
- Relationship between handlebars templates and their corresponding models

Remember to include:
- Proper labeling of all components
- Version information where relevant
- Configuration points
- Integration boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph TM["Template Management Layer"]
        Layouts["Layouts"]
        Partials["Partials"]
        HTML["HTML Templates"]
        Text["Text Templates"]
        Models["TypeScript Models"]
    end

    subgraph TE["Template Processing Engine"]
        HB["Handlebars Engine"]
        TC["Template Components"]
        Header["Header Component"]
        Footer["Footer Component"]
        Styles["Styles Component"]
    end

    subgraph CL["Compilation Layer"]
        Compiler["Compilation Process"]
        TSModels["TypeScript Models"]
        Validation["Payload Validation"]
        Schema["Schema Definition"]
    end

    subgraph PI["Provider Integration Layer"]
        Config["Provider Configuration"]
        Provider["Mailjet Integration"]
    end

    %% Relationships
    Layouts --> HB
    Partials --> HB
    HTML --> HB
    Text --> HB
    Models --> TSModels

    TC --> Header
    TC --> Footer
    TC --> Styles

    HB --> Compiler
    TSModels --> Compiler
    Validation --> Compiler
    Schema --> Validation

    Compiler --> Provider
    Config --> Provider

    %% Click Events
    click Layouts "https://github.com/robertbutlerdev/when-did-i-templates/tree/main/layouts/"
    click Partials "https://github.com/robertbutlerdev/when-did-i-templates/tree/main/partials/"
    click HTML "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/layouts/loginCode/html.handlebars"
    click Text "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/layouts/loginCode/txt.handlebars"
    click Models "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/layouts/loginCode/model.ts"
    click Header "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/partials/html/header.handlebars"
    click Footer "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/partials/html/footer.handlebars"
    click Styles "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/partials/html/styles.handlebars"
    click Compiler "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/runScripts/compileLayouts.ts"
    click Schema "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/layouts/loginCode/payloadSchema.json"
    click Config "https://github.com/robertbutlerdev/when-did-i-templates/blob/main/mailjet.json"

    %% Styling
    classDef storage fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#2ecc71,stroke:#27ae60,color:white
    classDef integration fill:#e67e22,stroke:#d35400,color:white
    classDef validation fill:#95a5a6,stroke:#7f8c8d,color:white

    class Layouts,Partials,HTML,Text,Models storage
    class HB,TC,Header,Footer,Styles,Compiler,TSModels process
    class Config,Provider integration
    class Validation,Schema validation

    %% Legend
    subgraph Legend
        Storage["Storage Components"]:::storage
        Process["Processing Components"]:::process
        Integration["Integration Components"]:::integration
        ValidationComp["Validation Components"]:::validation
    end
```
