# w0lv3/cloudflaredynamicdns architecture

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

- Interactive diagram: https://gitdiagram.com/w0lv3/cloudflaredynamicdns
- Repository: https://github.com/w0lv3/cloudflaredynamicdns

## Overview

This .NET worker synchronizes configured Cloudflare A records with the device’s public IPv4 address. It runs an update immediately, then repeats at the configured interval: fetch the address once, check each record, and update only records that differ. Configuration is validated at startup, and record-level failures are counted without stopping later records. The graph focuses on runtime calls and external data transfers; the README also documents Docker deployment, which is not a runtime subsystem.

Main entry points: [`Program.cs`](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Program.cs) (Host startup), [`Services/DynamicDnsUpdater.cs`](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/DynamicDnsUpdater.cs) (Update coordinator), [`Worker.cs`](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Worker.cs) (Periodic worker), [`Services/PublicIpProvider.cs`](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/PublicIpProvider.cs) (Public IP provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Worker runtime"]
  node_host["Host startup<br/>[Program.cs]"]
  node_worker["Periodic worker<br/>[Worker.cs]"]
end

subgraph group_config["Configuration"]
  node_validator["Options validation"]
  node_options["DNS settings"]
end

subgraph group_services["DNS synchronization"]
  node_updater["Update coordinator"]
  node_ipprovider["Public IP provider"]
  node_dnsclient["Cloudflare DNS client"]
end

node_ipservice(("Public IP service"))
node_cloudflare(("Cloudflare API"))

node_host -->|"binds settings"| node_options
node_host -->|"registers validator"| node_validator
node_host -->|"starts service"| node_worker
node_worker -->|"runs immediately and periodically"| node_updater
node_updater -->|"fetches IPv4"| node_ipprovider
node_ipprovider -->|"requests address"| node_ipservice
node_updater -->|"checks each record"| node_dnsclient
node_dnsclient -->|"looks up and patches A record"| node_cloudflare

click node_host "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Program.cs"
click node_worker "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Worker.cs"
click node_validator "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Configuration/DynamicDnsOptionsValidator.cs"
click node_options "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Configuration/DynamicDnsOptions.cs"
click node_updater "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/DynamicDnsUpdater.cs"
click node_ipprovider "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/PublicIpProvider.cs"
click node_dnsclient "https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/CloudflareDnsClient.cs"

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_host,node_worker toneBlue
class node_validator,node_options toneAmber
class node_updater,node_ipprovider,node_dnsclient,node_cloudflare toneMint
class node_ipservice toneIndigo
```

## Components

### Worker runtime

- [Host startup](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Program.cs): `Program.cs`
- [Periodic worker](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Worker.cs): `Worker.cs`

### Configuration

- [Options validation](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Configuration/DynamicDnsOptionsValidator.cs): `Configuration/DynamicDnsOptionsValidator.cs`
- [DNS settings](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Configuration/DynamicDnsOptions.cs): `Configuration/DynamicDnsOptions.cs`

### DNS synchronization

- [Update coordinator](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/DynamicDnsUpdater.cs): `Services/DynamicDnsUpdater.cs`
- [Public IP provider](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/PublicIpProvider.cs): `Services/PublicIpProvider.cs`
- [Cloudflare DNS client](https://github.com/w0lv3/cloudflaredynamicdns/blob/main/Services/CloudflareDnsClient.cs): `Services/CloudflareDnsClient.cs`

### Other components

- **Public IP service**
- **Cloudflare API**

## Connections

- Host startup → DNS settings: binds settings
- Host startup → Options validation: registers validator
- Host startup → Periodic worker: starts service
- Periodic worker → Update coordinator: runs immediately and periodically
- Update coordinator → Public IP provider: fetches IPv4
- Public IP provider → Public IP service: requests address
- Update coordinator → Cloudflare DNS client: checks each record
- Cloudflare DNS client → Cloudflare API: looks up and patches A record
