# fluentpython/book-site architecture

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

- Interactive diagram: https://gitdiagram.com/fluentpython/book-site
- Repository: https://github.com/fluentpython/book-site

## Overview

1. **Repository role**
   This is a Hugo-based static documentation site for the Fluent Python companion web site, not an application with a server-side runtime. The main product is generated HTML plus static assets published to fluentpython.com.

2. **Build pipeline**
   The primary flow is: source content and templates in the repo are rendered by Hugo into a static site. The site also uses Hugo’s external AsciiDoc integration, so some pages are authored in AsciiDoc and processed through Asciidoctor during the build.

3. **Content layer**
   The `content/` tree is the main editorial source. It contains the home page, about page, lingo page, posts, and the large `content/extra/` section with topic-focused articles. Many of these topic folders include code examples, diagrams, and supporting files alongside the prose.

4. **Executable examples as content artifacts**
   Under `content/extra/` there are Python scripts, C code, notebooks, and reference docs tied to individual articles. These are not a service layer; they are educational artifacts embedded in the content and referenced by the pages they explain.

5. **Theme boundary**
   The site is built on the `themes/cupper` Hugo theme. That theme provides the base layouts, partials, shortcodes, CSS, JS, and example site; the top-level repository overrides or extends it with its own `layouts/` and `static/` content.

6. **Presentation and rendering**
   `layouts/` contains local template overrides such as the default list view and header partials. This is the main boundary where site-specific presentation differs from the upstream theme, while most shared rendering behavior remains in `themes/cupper/layouts/`.

7. **Client-side assets**
   Static assets live in `static/` and theme assets. These include syntax highlighting, search UI, service-worker registration, the web manifest, images, and a large `static/data/flags/` dataset used by the emoji/flags content. These assets are delivered as-is with the generated site.

8. **Data-driven content**
   Some sections, especially the emoji-related material, depend on structured static data rather than code execution. The `static/data/flags/*/metadata.json` files form a country/flag metadata store that supports those pages and any associated client-side rendering.

9. **Tooling and dependencies**
   The root `Gemfile` and the README’s Asciidoctor references indicate a Ruby-based build dependency for converting AsciiDoc during Hugo builds. The repository also includes `fix_dunder.py` and `deploy.sh` as maintenance/deployment helpers.

10. **Deployment target**
   The site is configured for Netlify through `netlify.toml` at the root and also within the theme. Deployment is therefore a static hosting pipeline: build on CI/Netlify, publish the generated Hugo output, and serve it via CDN.

11. **Theme example site vs. live site**
   `themes/cupper/exampleSite/` is reference content for the theme itself, separate from the production Fluent Python content. It demonstrates theme capabilities and is useful for understanding the theme boundary, but it is not the actual site content.

12. **Architecture summary**
   The architecture is: editorial source content + embedded example files -> Hugo/Asciidoctor build -> theme templates and overrides -> static HTML/CSS/JS/data -> Netlify deployment. There is no application backend; the main integration points are content formats, theme templates, and static assets.

Main entry points: [`content`](https://github.com/fluentpython/book-site/tree/main/content) (Content tree), [`themes/cupper`](https://github.com/fluentpython/book-site/tree/main/themes/cupper) (Cupper theme), [`content/extra`](https://github.com/fluentpython/book-site/tree/main/content/extra) (Extra articles), [`netlify.toml`](https://github.com/fluentpython/book-site/blob/main/netlify.toml) (Netlify deploy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_content["Editorial content"]
  node_content_root["Content tree<br/>site content"]
  node_home_page["Home page<br/>landing content<br/>[_index.md]"]
  node_about_page["About page<br/>page content<br/>[about.md]"]
  node_lingo_page["Lingo page<br/>reference content<br/>[index.adoc]"]
  node_posts_section["Posts<br/>blog section"]
  node_extra_section["Extra articles<br/>topic articles"]
  node_examples_bundle["Embedded examples<br/>educational artifacts"]
end

subgraph group_group_theme["Theme boundary"]
  node_theme_cupper["Cupper theme<br/>Hugo theme"]
  node_local_layouts["Local layouts<br/>template overrides"]
  node_theme_layouts["Theme layouts<br/>shared templates"]
  node_theme_assets["Theme assets<br/>css/js assets"]
end

subgraph group_group_static["Static delivery"]
  node_static_assets["Static assets<br/>published assets"]
  node_flags_data[("Flags data<br/>structured static data")]
  node_theme_static["Theme static<br/>theme assets"]
end

subgraph group_group_build["Build and deploy"]
  node_build_pipeline["Hugo build<br/>site generator"]
  node_asciidoctor["AsciiDoctor<br/>ruby converter"]
  node_netlify["Netlify deploy<br/>hosting config<br/>[netlify.toml]"]
  node_maint_helpers["Maintenance helpers<br/>scripts"]
end

node_repo["Fluent Python site<br/>Hugo docs site"]

node_repo -->|"sources"| node_content_root
node_repo -->|"uses"| node_theme_cupper
node_repo -->|"publishes"| node_static_assets
node_content_root -->|"contains"| node_home_page
node_content_root -->|"contains"| node_about_page
node_content_root -->|"contains"| node_lingo_page
node_content_root -->|"contains"| node_posts_section
node_content_root -->|"contains"| node_extra_section
node_extra_section -->|"embeds"| node_examples_bundle
node_extra_section -->|"renders via"| node_asciidoctor
node_build_pipeline -->|"renders with"| node_theme_layouts
node_build_pipeline -->|"overrides with"| node_local_layouts
node_build_pipeline -->|"builds"| node_content_root
node_build_pipeline -->|"copies"| node_static_assets
node_build_pipeline -->|"includes"| node_theme_assets
node_build_pipeline -->|"invokes"| node_asciidoctor
node_flags_data -->|"supports"| node_extra_section
node_theme_cupper -->|"provides"| node_theme_layouts
node_theme_cupper -->|"provides"| node_theme_assets
node_theme_cupper -->|"provides"| node_theme_static
node_netlify -->|"runs"| node_build_pipeline
node_netlify -->|"hosts"| node_repo
node_maint_helpers -->|"assists"| node_netlify
node_maint_helpers -->|"assists"| node_build_pipeline

click node_content_root "https://github.com/fluentpython/book-site/tree/main/content"
click node_home_page "https://github.com/fluentpython/book-site/blob/main/content/_index.md"
click node_about_page "https://github.com/fluentpython/book-site/blob/main/content/about.md"
click node_lingo_page "https://github.com/fluentpython/book-site/blob/main/content/lingo/index.adoc"
click node_posts_section "https://github.com/fluentpython/book-site/tree/main/content/posts"
click node_extra_section "https://github.com/fluentpython/book-site/tree/main/content/extra"
click node_examples_bundle "https://github.com/fluentpython/book-site/tree/main/content/extra/classic-coroutines"
click node_theme_cupper "https://github.com/fluentpython/book-site/tree/main/themes/cupper"
click node_local_layouts "https://github.com/fluentpython/book-site/tree/main/layouts"
click node_theme_layouts "https://github.com/fluentpython/book-site/tree/main/themes/cupper/layouts"
click node_theme_assets "https://github.com/fluentpython/book-site/tree/main/themes/cupper/assets"
click node_static_assets "https://github.com/fluentpython/book-site/tree/main/static"
click node_flags_data "https://github.com/fluentpython/book-site/tree/main/static/data/flags"
click node_theme_static "https://github.com/fluentpython/book-site/tree/main/themes/cupper/static"
click node_asciidoctor "https://github.com/fluentpython/book-site/tree/main/Gemfile"
click node_netlify "https://github.com/fluentpython/book-site/blob/main/netlify.toml"

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_content_root,node_home_page,node_about_page,node_lingo_page,node_posts_section,node_extra_section,node_examples_bundle toneBlue
class node_theme_cupper,node_local_layouts,node_theme_layouts,node_theme_assets toneAmber
class node_static_assets,node_flags_data,node_theme_static toneMint
class node_build_pipeline,node_asciidoctor,node_netlify,node_maint_helpers toneRose
class node_repo toneNeutral
```

## Components

### Editorial content

Primary site source material authored for Hugo and Asciidoctor.

- [Content tree](https://github.com/fluentpython/book-site/tree/main/content): site content · Main editorial source for pages, posts, and topic sections. · `content`
- [Home page](https://github.com/fluentpython/book-site/blob/main/content/_index.md): landing content · Top-level site entry page. · `content/_index.md`
- [About page](https://github.com/fluentpython/book-site/blob/main/content/about.md): page content · Site background and author information. · `content/about.md`
- [Lingo page](https://github.com/fluentpython/book-site/blob/main/content/lingo/index.adoc): reference content · Terminology and language guide. · `content/lingo/index.adoc`
- [Posts](https://github.com/fluentpython/book-site/tree/main/content/posts): blog section · Short news or status posts. · `content/posts`
- [Extra articles](https://github.com/fluentpython/book-site/tree/main/content/extra): topic articles · Large collection of companion essays and examples. · `content/extra`
- [Embedded examples](https://github.com/fluentpython/book-site/tree/main/content/extra/classic-coroutines): educational artifacts · Scripts, notebooks, binaries, and diagrams tied to article explanations. · `content/extra/classic-coroutines`

### Theme boundary

Upstream Cupper theme and local presentation overrides.

- [Cupper theme](https://github.com/fluentpython/book-site/tree/main/themes/cupper): Hugo theme · Upstream theme providing shared layouts, assets, shortcodes, and example site. · `themes/cupper`
- [Local layouts](https://github.com/fluentpython/book-site/tree/main/layouts): template overrides · Repository-specific presentation overrides layered on the theme. · `layouts`
- [Theme layouts](https://github.com/fluentpython/book-site/tree/main/themes/cupper/layouts): shared templates · Base templates, partials, and shortcodes from the theme. · `themes/cupper/layouts`
- [Theme assets](https://github.com/fluentpython/book-site/tree/main/themes/cupper/assets): css/js assets · Theme-provided styling and client scripts. · `themes/cupper/assets`

### Static delivery

Published assets and structured data served with the generated site.

- [Static assets](https://github.com/fluentpython/book-site/tree/main/static): published assets · Images, manifest, and other files copied directly into the built site. · `static`
- [Flags data](https://github.com/fluentpython/book-site/tree/main/static/data/flags): structured static data · Country and flag metadata store supporting emoji and flags pages. · `static/data/flags`
- [Theme static](https://github.com/fluentpython/book-site/tree/main/themes/cupper/static): theme assets · Theme-level images, prism styling, and service-worker registration. · `themes/cupper/static`

### Build and deploy

Tooling and hosting configuration for static generation and publication.

- **Hugo build**: site generator · Renders content through theme templates into static HTML.
- [AsciiDoctor](https://github.com/fluentpython/book-site/tree/main/Gemfile): ruby converter · External conversion step for AsciiDoc content during the build. · `Gemfile`
- [Netlify deploy](https://github.com/fluentpython/book-site/blob/main/netlify.toml): hosting config · Static hosting and CI deployment target. · `netlify.toml`
- **Maintenance helpers**: scripts · Small repository utilities for deployment and content fixes.

### Other components

- **Fluent Python site**: Hugo docs site · Static documentation site for fluentpython.com.

## Connections

- Fluent Python site → Content tree: sources · The site is authored in the content tree.
- Fluent Python site → Cupper theme: uses · The site is built on the Cupper theme.
- Fluent Python site → Static assets: publishes · Static files are shipped with the generated site.
- Content tree → Home page: contains · Top-level landing content.
- Content tree → About page: contains · About page content.
- Content tree → Lingo page: contains · Glossary and terminology content.
- Content tree → Posts: contains · Posts section.
- Content tree → Extra articles: contains · Topic-focused companion articles.
- Extra articles → Embedded examples: embeds · Articles bundle code, notebooks, diagrams, and reference files.
- Extra articles → AsciiDoctor: renders via · Some extra articles are authored in AsciiDoc.
- Hugo build → Theme layouts: renders with · Hugo uses theme templates and partials.
- Hugo build → Local layouts: overrides with · Repository-specific templates extend the theme.
- Hugo build → Content tree: builds · Hugo compiles editorial source into the site.
- Hugo build → Static assets: copies · Static assets are included verbatim.
- Hugo build → Theme assets: includes · Theme CSS and JavaScript are part of presentation.
- Hugo build → AsciiDoctor: invokes · AsciiDoc files are converted during the site build.
- Flags data → Extra articles: supports · Structured flag metadata powers emoji/flags pages.
- Cupper theme → Theme layouts: provides · Base rendering system from the theme.
- Cupper theme → Theme assets: provides · Theme-level styles and scripts.
- Cupper theme → Theme static: provides · Theme static files shipped with the site.
- Netlify deploy → Hugo build: runs · Deployment triggers the Hugo build.
- Netlify deploy → Fluent Python site: hosts · Publishes the generated static site.
- Maintenance helpers → Netlify deploy: assists · Deployment helper scripts support hosting workflows.
- Maintenance helpers → Hugo build: assists · Utility scripts support repository maintenance around the build.
