# stevenblack/hosts architecture

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

- Interactive diagram: https://gitdiagram.com/stevenblack/hosts
- Repository: https://github.com/stevenblack/hosts
- Video tour (about a minute): https://gitdiagram.com/stevenblack/hosts/video

## Overview

This repository aggregates curated domain blocklists into hosts files, with optional category extensions and many prebuilt combinations. The user-facing workflow is to run the generator, which updates and combines source data into a hosts file; `makeHosts.py` also builds extension variants and invokes README generation. The excerpts show orchestration and selected fetch, filtering, and output behavior, but not every implementation detail, so several internal transitions are omitted rather than inferred.

Main entry points: [`updateHostsFile.py`](https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py) (Hosts generator), [`makeHosts.py`](https://github.com/stevenblack/hosts/blob/master/makeHosts.py) (Build orchestrator), [`updateReadme.py`](https://github.com/stevenblack/hosts/blob/master/updateReadme.py) (README renderer), [`data`](https://github.com/stevenblack/hosts/tree/master/data) (Curated source lists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Generation orchestration"]
  node_generator["Build orchestrator<br/>[makeHosts.py]"]
  node_hosts_builder["Hosts generator<br/>[updateHostsFile.py]"]
  node_readme_builder["README renderer<br/>[updateReadme.py]"]
end

subgraph group_inputs["Source inputs"]
  node_catalog["Curated source lists"]
  node_extensions["Category lists"]
end

subgraph group_processing["Hosts processing"]
  node_fetch_transform["Fetch and transform<br/>[updateHostsFile.py]"]
  node_exclusions["Domain exclusions<br/>[updateHostsFile.py]"]
  node_merge_dedupe["Normalize and deduplicate<br/>[updateHostsFile.py]"]
end

subgraph group_products["Published variants"]
  node_hosts_output["Generated hosts files"]
  node_variant_files["Extension variants"]
  node_metadata["Variant metadata<br/>[readmeData.json]"]
  node_readmes["Variant READMEs<br/>[readme_template.md]"]
end

node_user(("Repository operator"))
node_source_hosts(("Upstream blocklists"))
node_http_service(("HTTP sources"))
node_local_hosts["System hosts file"]

node_user -->|"runs"| node_generator
node_generator -->|"invokes"| node_hosts_builder
node_generator -->|"invokes"| node_readme_builder
node_hosts_builder -->|"aggregates sources"| node_catalog
node_hosts_builder -->|"selects categories"| node_extensions
node_hosts_builder -->|"updates sources"| node_fetch_transform
node_fetch_transform -->|"requests data"| node_http_service
node_source_hosts -->|"contributes lists"| node_catalog
node_hosts_builder -->|"collects exclusions"| node_exclusions
node_hosts_builder -->|"builds merged file"| node_merge_dedupe
node_hosts_builder -->|"generates variants"| node_hosts_output
node_hosts_builder -->|"updates metadata"| node_metadata
node_readme_builder -->|"reads variant data"| node_metadata
node_readme_builder -->|"renders"| node_readmes
node_generator -->|"generates combinations"| node_variant_files
node_hosts_builder -.->|"installs hosts file"| node_local_hosts

click node_generator "https://github.com/stevenblack/hosts/blob/master/makeHosts.py"
click node_hosts_builder "https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py"
click node_readme_builder "https://github.com/stevenblack/hosts/blob/master/updateReadme.py"
click node_catalog "https://github.com/stevenblack/hosts/tree/master/data"
click node_extensions "https://github.com/stevenblack/hosts/tree/master/extensions"
click node_fetch_transform "https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py"
click node_exclusions "https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py"
click node_merge_dedupe "https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py"
click node_hosts_output "https://github.com/stevenblack/hosts/blob/master/hosts"
click node_variant_files "https://github.com/stevenblack/hosts/tree/master/alternates"
click node_metadata "https://github.com/stevenblack/hosts/blob/master/readmeData.json"
click node_readmes "https://github.com/stevenblack/hosts/blob/master/readme_template.md"

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_generator,node_hosts_builder,node_readme_builder toneBlue
class node_catalog,node_extensions toneAmber
class node_fetch_transform,node_exclusions,node_merge_dedupe toneMint
class node_hosts_output,node_variant_files,node_metadata,node_readmes toneRose
class node_user,node_source_hosts,node_http_service,node_local_hosts toneIndigo
```

## Components

### Generation orchestration

- [Build orchestrator](https://github.com/stevenblack/hosts/blob/master/makeHosts.py): `makeHosts.py`
- [Hosts generator](https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py): `updateHostsFile.py`
- [README renderer](https://github.com/stevenblack/hosts/blob/master/updateReadme.py): `updateReadme.py`

### Source inputs

- [Curated source lists](https://github.com/stevenblack/hosts/tree/master/data): `data`
- [Category lists](https://github.com/stevenblack/hosts/tree/master/extensions): `extensions`

### Hosts processing

- [Fetch and transform](https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py): `updateHostsFile.py`
- [Domain exclusions](https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py): `updateHostsFile.py`
- [Normalize and deduplicate](https://github.com/stevenblack/hosts/blob/master/updateHostsFile.py): `updateHostsFile.py`

### Published variants

- [Generated hosts files](https://github.com/stevenblack/hosts/blob/master/hosts): `hosts`
- [Extension variants](https://github.com/stevenblack/hosts/tree/master/alternates): `alternates`
- [Variant metadata](https://github.com/stevenblack/hosts/blob/master/readmeData.json): `readmeData.json`
- [Variant READMEs](https://github.com/stevenblack/hosts/blob/master/readme_template.md): `readme_template.md`

### Other components

- **Repository operator**
- **Upstream blocklists**
- **HTTP sources**
- **System hosts file**

## Connections

- Repository operator → Build orchestrator: runs
- Build orchestrator → Hosts generator: invokes (evidence: `makeHosts.py`)
- Build orchestrator → README renderer: invokes (evidence: `makeHosts.py`)
- Hosts generator → Curated source lists: aggregates sources (evidence: `readme.md`)
- Hosts generator → Category lists: selects categories (evidence: `readme.md`)
- Hosts generator → Fetch and transform: updates sources (evidence: `updateHostsFile.py`)
- Fetch and transform → HTTP sources: requests data (evidence: `updateHostsFile.py`)
- Upstream blocklists → Curated source lists: contributes lists (evidence: `readme.md`)
- Hosts generator → Domain exclusions: collects exclusions (evidence: `updateHostsFile.py`)
- Hosts generator → Normalize and deduplicate: builds merged file (evidence: `updateHostsFile.py`)
- Hosts generator → Generated hosts files: generates variants (evidence: `readme.md`)
- Hosts generator → Variant metadata: updates metadata (evidence: `updateHostsFile.py`)
- README renderer → Variant metadata: reads variant data (evidence: `updateReadme.py`)
- README renderer → Variant READMEs: renders (evidence: `updateReadme.py`)
- Build orchestrator → Extension variants: generates combinations (evidence: `makeHosts.py`)
- Hosts generator → System hosts file: installs hosts file
