Bengal SSG follows a modular architecture with clear separation of concerns to avoid "God objects" and maintain high performance even with large sites.
Core Architecture
Data models, build coordination, and core principles
Rendering Pipeline
How Bengal transforms Markdown to HTML
Subsystems
Specialized feature subsystems
Tooling & CLI
Developer tools, CLI, server, and configuration
Meta & Operations
Performance, testing, and project structure
High-Level Architecture
graph TB
subgraph "Entry Points"
CLI[CLI<br/>bengal/cli/]
Server[Dev Server<br/>bengal/server/]
end
subgraph "Core Build Pipeline"
Discovery[Discovery<br/>bengal/discovery/]
Orchestration[Orchestration<br/>bengal/orchestration/]
Rendering[Rendering<br/>bengal/rendering/]
PostProcess[Post-Processing<br/>bengal/postprocess/]
end
subgraph "Object Model"
Site[Site<br/>bengal/core/site.py]
Pages[Pages<br/>bengal/core/page/]
Sections[Sections<br/>bengal/core/section.py]
Assets[Assets<br/>bengal/core/asset/]
Menus[Menus<br/>bengal/core/menu.py]
end
subgraph "Supporting Systems"
Cache[Build Cache<br/>bengal/cache/]
Health[Health Checks<br/>bengal/health/]
Autodoc[Autodoc<br/>bengal/autodoc/]
Config[Config<br/>bengal/config/]
Analysis[Analysis<br/>bengal/analysis/]
Fonts[Fonts<br/>bengal/fonts/]
end
CLI --> Site
Server --> Site
Site --> Discovery
Discovery --> Pages
Discovery --> Sections
Discovery --> Assets
Site --> Orchestration
Orchestration --> Menus
Orchestration --> Rendering
Menus -.->|"used by"| Rendering
Rendering --> PostProcess
Cache -.->|"cache checks"| Orchestration
Health -.->|"validation"| PostProcess
Autodoc -.->|"generates"| Pages
Config -.->|"configuration"| Site
Analysis -.->|"analyzes"| Site
Fonts -.->|"downloads/generates"| Assets
Key Flows:
- Build: CLI → Site → Discovery → Orchestration → [Menus + Rendering] → Post-Process
- Menu Building: Orchestration builds menus → Rendering uses menus in templates
- Cache: Build Cache checks file changes and dependencies before rebuilding
- Autodoc: Generate Python/CLI docs → treated as regular content pages
- Dev Server: Watch files → trigger incremental rebuilds → serve output
In This Section
Core Architecture
Data models, build coordination, and core principles
Rendering Pipeline
How Bengal transforms Markdown to HTML
Subsystems
Specialized feature subsystems
Tooling & CLI
Developer tools, CLI, server, and configuration
Design Principles
Core patterns and philosophies guiding Bengal's architecture.
Meta & Operations
Performance, testing, and project structure
Related Pages
Bengal 0.1.4
Configuration system overhaul, asset pipeline improvements, HTML formatting, link checking, and major architecture enhancements
Configuration System
Flexible, format-agnostic configuration loading
Reactive Dataflow Pipeline
Declarative dataflow architecture for Bengal builds with automatic dependency tracking