# phd59fr/netflix-household-autovalidator architecture

> Architecture diagram of the GitHub repository phd59fr/netflix-household-autovalidator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phd59fr/netflix-household-autovalidator
- Repository: https://github.com/phd59fr/netflix-household-autovalidator

## Overview

The product monitors an IMAP mailbox for recent Netflix verification messages, parses and filters them, opens valid household-update links in a headless browser, and marks successfully handled messages as read. The README documents the IDLE-driven workflow, expired-link handling, structured trace logging, and cleanup; sampled source confirms the main processing and integration calls. Some subsidiary details are documented but not independently traced here, so the graph omits uncertain wiring.

Main entry points: [`internal/emailprocessor/processor.go`](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/emailprocessor/processor.go) (Email processor), [`cmd/main.go`](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/cmd/main.go) (Runtime entry), [`internal/imap/client.go`](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/imap/client.go) (IMAP client), [`internal/config/config.go`](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/config/config.go) (Config loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_main["Runtime entry<br/>[main.go]"]
  node_processor["Email processor<br/>[processor.go]"]
end

subgraph group_mail["Email intake"]
  node_imapclient["IMAP client<br/>[client.go]"]
  node_emailmodel["Parsed email model<br/>[email.go]"]
  node_parser["Email parser<br/>[parser.go]"]
end

subgraph group_validation["Netflix validation"]
  node_service["Netflix service<br/>[service.go]"]
  node_browser["Rod browser<br/>[browser_rod.go]"]
  node_cleanup["Browser temp cleanup<br/>[browser_rod.go]"]
end

subgraph group_support["Configuration and observability"]
  node_config["Config loader<br/>[config.go]"]
  node_settings["Runtime settings<br/>[config.go]"]
  node_logging["JSON logger<br/>[logger.go]"]
end

node_operator(("Operator"))
node_mailbox[("IMAP mailbox")]
node_netflix(("Netflix verification site"))
node_yaml["YAML settings<br/>[config.yaml]"]
node_environment(("Environment variables"))

node_operator -->|"configures"| node_yaml
node_operator -->|"sets overrides"| node_environment
node_main -->|"loads settings"| node_config
node_config -->|"reads YAML"| node_yaml
node_config -->|"reads overrides"| node_environment
node_config -->|"builds config"| node_settings
node_main -->|"connects and idles"| node_imapclient
node_imapclient -->|"authenticates and searches"| node_mailbox
node_mailbox -->|"signals new mail"| node_imapclient
node_main -->|"processes UIDs"| node_processor
node_processor -->|"fetches and marks seen"| node_imapclient
node_imapclient -->|"returns messages"| node_processor
node_processor -->|"parses message"| node_parser
node_parser -->|"creates email"| node_emailmodel
node_processor -->|"handles valid email"| node_service
node_service -->|"opens verification link"| node_browser
node_browser -->|"navigates and confirms"| node_netflix
node_main -->|"starts cleanup"| node_browser
node_main -->|"records runtime events"| node_logging
node_processor -->|"logs processing"| node_logging
node_service -->|"logs decisions"| node_logging
node_browser -->|"logs browser activity"| node_logging

click node_main "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/cmd/main.go"
click node_processor "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/emailprocessor/processor.go"
click node_config "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/config/config.go"
click node_settings "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/models/config.go"
click node_imapclient "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/imap/client.go"
click node_emailmodel "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/models/email.go"
click node_parser "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/mailparse/parser.go"
click node_service "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/service.go"
click node_browser "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/browser_rod.go"
click node_cleanup "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/browser_rod.go"
click node_logging "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/logging/logger.go"
click node_yaml "https://github.com/phd59fr/netflix-household-autovalidator/blob/main/config.yaml"

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_main,node_processor toneBlue
class node_imapclient,node_emailmodel,node_parser,node_mailbox toneAmber
class node_service,node_browser,node_cleanup toneMint
class node_config,node_settings,node_logging toneRose
class node_operator,node_netflix,node_environment toneIndigo
class node_yaml toneTeal
```

## Components

### Runtime orchestration

- [Runtime entry](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/cmd/main.go): `cmd/main.go`
- [Email processor](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/emailprocessor/processor.go): `internal/emailprocessor/processor.go`

### Email intake

- [IMAP client](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/imap/client.go): `internal/imap/client.go`
- [Parsed email model](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/models/email.go): `internal/models/email.go`
- [Email parser](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/mailparse/parser.go): `internal/mailparse/parser.go`

### Netflix validation

- [Netflix service](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/service.go): `internal/netflix/service.go`
- [Rod browser](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/browser_rod.go): `internal/netflix/browser_rod.go`
- [Browser temp cleanup](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/netflix/browser_rod.go): `internal/netflix/browser_rod.go`

### Configuration and observability

- [Config loader](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/config/config.go): `internal/config/config.go`
- [Runtime settings](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/models/config.go): `internal/models/config.go`
- [JSON logger](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/internal/logging/logger.go): `internal/logging/logger.go`

### Other components

- **Operator**
- **IMAP mailbox**
- **Netflix verification site**
- [YAML settings](https://github.com/phd59fr/netflix-household-autovalidator/blob/main/config.yaml): `config.yaml`
- **Environment variables**

## Connections

- Operator → YAML settings: configures
- Operator → Environment variables: sets overrides
- Runtime entry → Config loader: loads settings
- Config loader → YAML settings: reads YAML
- Config loader → Environment variables: reads overrides
- Config loader → Runtime settings: builds config
- Runtime entry → IMAP client: connects and idles
- IMAP client → IMAP mailbox: authenticates and searches
- IMAP mailbox → IMAP client: signals new mail
- Runtime entry → Email processor: processes UIDs
- Email processor → IMAP client: fetches and marks seen
- IMAP client → Email processor: returns messages
- Email processor → Email parser: parses message
- Email parser → Parsed email model: creates email
- Email processor → Netflix service: handles valid email
- Netflix service → Rod browser: opens verification link
- Rod browser → Netflix verification site: navigates and confirms
- Runtime entry → Rod browser: starts cleanup
- Runtime entry → JSON logger: records runtime events
- Email processor → JSON logger: logs processing
- Netflix service → JSON logger: logs decisions
- Rod browser → JSON logger: logs browser activity
