# caddybuilds/caddy-cloudflare architecture

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

- Interactive diagram: https://gitdiagram.com/caddybuilds/caddy-cloudflare
- Repository: https://github.com/caddybuilds/caddy-cloudflare

## Overview

Caddy Cloudflare is a Docker image that extends Caddy with Cloudflare DNS-01 and proxy-related modules. The documented user workflow is to pull the image, provide a Caddyfile and Cloudflare API token, then let Caddy issue certificates and serve or proxy requests. Its other documented runtime capabilities include trusted client IP handling, combining trusted IP ranges, and rate limiting. The repository tree contains no runtime source excerpts, so relationships below rely on the README; implementation details beyond the Dockerfile’s existence are not inferred.

Main entry points: [`Dockerfile`](https://github.com/caddybuilds/caddy-cloudflare/blob/main/Dockerfile) (Caddy server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_image["Caddy image"]
  node_image["Caddy image"]
  node_caddy["Caddy server"]
  node_caddyfile["Caddyfile configuration"]
end

subgraph group_tls["Certificate management"]
  node_token["Cloudflare API token"]
  node_dns01["DNS-01 provider"]
  node_cloudflare_dns["Cloudflare DNS"]
end

subgraph group_requests["Request handling"]
  node_ip_trust["Cloudflare IP trust"]
  node_range_combine["IP range combining"]
  node_rate_limit["Rate limiting"]
end

node_operator(("Operator"))
node_origin["Origin service"]
node_visitor(("Visitor"))

node_operator -->|"pulls"| node_image
node_operator -->|"configures"| node_caddyfile
node_operator -->|"provides"| node_token
node_image -->|"packages"| node_caddy
node_caddy -->|"uses"| node_dns01
node_caddy -->|"uses"| node_ip_trust
node_caddy -->|"uses"| node_range_combine
node_caddy -->|"uses"| node_rate_limit
node_caddy -->|"reads"| node_caddyfile
node_dns01 -->|"uses"| node_token
node_dns01 -->|"validates via"| node_cloudflare_dns
node_visitor -->|"requests"| node_caddy
node_caddy -->|"proxies to"| node_origin
node_ip_trust -->|"provides client IPs"| node_caddy
node_rate_limit -->|"limits requests"| node_caddy

click node_image "https://github.com/caddybuilds/caddy-cloudflare/blob/main/Dockerfile"
click node_caddy "https://github.com/caddybuilds/caddy-cloudflare/blob/main/Dockerfile"

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_image,node_caddy,node_caddyfile toneBlue
class node_token,node_dns01,node_cloudflare_dns toneAmber
class node_ip_trust,node_range_combine,node_rate_limit toneMint
class node_operator,node_origin,node_visitor toneIndigo
```

## Components

### Caddy image

- [Caddy image](https://github.com/caddybuilds/caddy-cloudflare/blob/main/Dockerfile): `Dockerfile`
- [Caddy server](https://github.com/caddybuilds/caddy-cloudflare/blob/main/Dockerfile): `Dockerfile`
- **Caddyfile configuration**

### Certificate management

- **Cloudflare API token**
- **DNS-01 provider**
- **Cloudflare DNS**

### Request handling

- **Cloudflare IP trust**
- **IP range combining**
- **Rate limiting**

### Other components

- **Operator**
- **Origin service**
- **Visitor**

## Connections

- Operator → Caddy image: pulls (evidence: `README.md`)
- Operator → Caddyfile configuration: configures (evidence: `README.md`)
- Operator → Cloudflare API token: provides (evidence: `README.md`)
- Caddy image → Caddy server: packages (evidence: `README.md`)
- Caddy server → DNS-01 provider: uses (evidence: `README.md`)
- Caddy server → Cloudflare IP trust: uses (evidence: `README.md`)
- Caddy server → IP range combining: uses (evidence: `README.md`)
- Caddy server → Rate limiting: uses (evidence: `README.md`)
- Caddy server → Caddyfile configuration: reads (evidence: `README.md`)
- DNS-01 provider → Cloudflare API token: uses (evidence: `README.md`)
- DNS-01 provider → Cloudflare DNS: validates via (evidence: `README.md`)
- Visitor → Caddy server: requests (evidence: `README.md`)
- Caddy server → Origin service: proxies to (evidence: `README.md`)
- Cloudflare IP trust → Caddy server: provides client IPs (evidence: `README.md`)
- Rate limiting → Caddy server: limits requests (evidence: `README.md`)
