# quangiscoding/hr-onboarding-appscript architecture

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

- Interactive diagram: https://gitdiagram.com/quangiscoding/hr-onboarding-appscript
- Repository: https://github.com/quangiscoding/hr-onboarding-appscript

## Overview

This Google Apps Script project automates employee onboarding from a Google Sheet: a user selects a row or edits a workflow field, the app validates and normalizes employee data, then sends internal or TA email, or creates a candidate welcome draft with a PDF guide. Separate logging records outcomes. The shown excerpts establish the menu-driven path and workflow dependencies; automatic edit-trigger registration is not shown, so that connection is marked unverified.

Main entry points: [`src/main.js`](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/main.js) (Menu Controller), [`src/workflows.js`](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js) (Offer Accepted), [`src/utils.js`](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/utils.js) (Sheet and Drive Helpers), [`src/email-templates.js`](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/email-templates.js) (Template Renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Sheet Entry"]
  node_controller["Menu Controller<br/>[main.js]"]
  node_rowdata["Input Normalizer<br/>[normalize-input.js]"]
  node_editclass["Edit Classifier<br/>[normalize-input.js]"]
end

subgraph group_onboarding["Onboarding Workflows"]
  node_offer["Offer Accepted<br/>[workflows.js]"]
  node_ta["TA Notification<br/>[workflows.js]"]
  node_welcome["Welcome Draft<br/>[workflows.js]"]
end

subgraph group_content["Email Content"]
  node_templates["Template Renderer<br/>[email-templates.js]"]
  node_html["HTML Email Views"]
end

subgraph group_support["Configuration and Logging"]
  node_helpers["Sheet and Drive Helpers<br/>[utils.js]"]
  node_config["Workflow Configuration<br/>[config.js]"]
  node_logs["Workflow Logs<br/>[logger.js]"]
  node_legacy["Legacy Name Utilities<br/>[legacy-utils.js]"]
end

node_user(("Sheet User"))
node_sheet[("Google Sheets")]
node_gmail["Gmail"]
node_drive["Google Drive"]
node_htmlservice["Apps Script HTML Service"]

node_user -->|"selects menu"| node_controller
node_controller -->|"reads selection"| node_sheet
node_controller -->|"normalizes row"| node_rowdata
node_rowdata -->|"reads row"| node_sheet
node_sheet -.->|"edit event"| node_editclass
node_controller -->|"dispatches workflow"| node_offer
node_controller -->|"dispatches workflow"| node_ta
node_controller -->|"dispatches workflow"| node_welcome
node_offer -->|"loads recipients"| node_helpers
node_offer -->|"builds emails"| node_templates
node_offer -->|"sends email"| node_gmail
node_offer -->|"records sends"| node_logs
node_ta -->|"builds email"| node_templates
node_ta -->|"sends email"| node_gmail
node_ta -->|"records send"| node_logs
node_ta -->|"marks completion"| node_sheet
node_welcome -->|"loads guide and recipients"| node_helpers
node_welcome -->|"builds email"| node_templates
node_welcome -->|"creates draft"| node_gmail
node_welcome -->|"records draft"| node_logs
node_helpers -->|"reads settings"| node_config
node_helpers -->|"reads recipients"| node_sheet
node_helpers -->|"loads PDF"| node_drive
node_templates -->|"renders view"| node_htmlservice
node_templates -->|"loads template"| node_html
node_logs -->|"appends log rows"| node_sheet

click node_controller "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/main.js"
click node_rowdata "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/normalize-input.js"
click node_editclass "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/normalize-input.js"
click node_offer "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js"
click node_ta "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js"
click node_welcome "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js"
click node_templates "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/email-templates.js"
click node_html "https://github.com/quangiscoding/hr-onboarding-appscript/tree/main/src/email-templates"
click node_helpers "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/utils.js"
click node_config "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/config.js"
click node_logs "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/logger.js"
click node_legacy "https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/legacy-utils.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_controller,node_rowdata,node_editclass,node_user toneBlue
class node_offer,node_ta,node_welcome,node_sheet toneAmber
class node_templates,node_html toneMint
class node_helpers,node_config,node_logs,node_legacy toneRose
class node_gmail,node_drive,node_htmlservice toneIndigo
```

## Components

### Sheet Entry

- [Menu Controller](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/main.js): `src/main.js`
- [Input Normalizer](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/normalize-input.js): `src/normalize-input.js`
- [Edit Classifier](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/normalize-input.js): `src/normalize-input.js`

### Onboarding Workflows

- [Offer Accepted](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js): `src/workflows.js`
- [TA Notification](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js): `src/workflows.js`
- [Welcome Draft](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/workflows.js): `src/workflows.js`

### Email Content

- [Template Renderer](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/email-templates.js): `src/email-templates.js`
- [HTML Email Views](https://github.com/quangiscoding/hr-onboarding-appscript/tree/main/src/email-templates): `src/email-templates`

### Configuration and Logging

- [Sheet and Drive Helpers](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/utils.js): `src/utils.js`
- [Workflow Configuration](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/config.js): `src/config.js`
- [Workflow Logs](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/logger.js): `src/logger.js`
- [Legacy Name Utilities](https://github.com/quangiscoding/hr-onboarding-appscript/blob/main/src/legacy-utils.js): `src/legacy-utils.js`

### Other components

- **Sheet User**
- **Google Sheets**
- **Gmail**
- **Google Drive**
- **Apps Script HTML Service**

## Connections

- Sheet User → Menu Controller: selects menu (evidence: `src/main.js`)
- Menu Controller → Google Sheets: reads selection (evidence: `src/main.js`)
- Menu Controller → Input Normalizer: normalizes row (evidence: `src/main.js`)
- Input Normalizer → Google Sheets: reads row (evidence: `src/normalize-input.js`)
- Google Sheets → Edit Classifier: edit event
- Menu Controller → Offer Accepted: dispatches workflow (evidence: `src/main.js`)
- Menu Controller → TA Notification: dispatches workflow (evidence: `src/main.js`)
- Menu Controller → Welcome Draft: dispatches workflow (evidence: `src/main.js`)
- Offer Accepted → Sheet and Drive Helpers: loads recipients (evidence: `src/workflows.js`)
- Offer Accepted → Template Renderer: builds emails (evidence: `src/workflows.js`)
- Offer Accepted → Gmail: sends email (evidence: `src/workflows.js`)
- Offer Accepted → Workflow Logs: records sends (evidence: `src/workflows.js`)
- TA Notification → Template Renderer: builds email (evidence: `src/workflows.js`)
- TA Notification → Gmail: sends email (evidence: `src/workflows.js`)
- TA Notification → Workflow Logs: records send (evidence: `src/workflows.js`)
- TA Notification → Google Sheets: marks completion (evidence: `src/workflows.js`)
- Welcome Draft → Sheet and Drive Helpers: loads guide and recipients (evidence: `src/workflows.js`)
- Welcome Draft → Template Renderer: builds email (evidence: `src/workflows.js`)
- Welcome Draft → Gmail: creates draft (evidence: `src/workflows.js`)
- Welcome Draft → Workflow Logs: records draft (evidence: `src/workflows.js`)
- Sheet and Drive Helpers → Workflow Configuration: reads settings (evidence: `src/utils.js`)
- Sheet and Drive Helpers → Google Sheets: reads recipients (evidence: `src/utils.js`)
- Sheet and Drive Helpers → Google Drive: loads PDF (evidence: `src/utils.js`)
- Template Renderer → Apps Script HTML Service: renders view
- Template Renderer → HTML Email Views: loads template
- Workflow Logs → Google Sheets: appends log rows (evidence: `src/logger.js`)
