Hauchiwa
A flexible, incremental, graph-based static site generator library for Rust. It provides the building blocks to create your own custom static site generator tailored exactly to your needs.
Unlike traditional SSGs that force a specific directory structure or build pipeline, Hauchiwa gives you a task graph. You define the inputs (files, data), the transformations (markdown parsing, image optimization, SCSS compilation), and the dependencies between them. Hauchiwa handles the parallel execution, caching, and incremental rebuilds.
If you are tired of:
- Rigid frameworks that force their file structure on you (Jekyll, Hugo).
- Complex config files that are hard to debug.
- Bloated JavaScript bundles for simple static content.
Then Hauchiwa is for you.
Quick Start
Add hauchiwa to your Cargo.toml:
[]
# Check crates.io for the latest version
= "*"
# Serde is needed to parse frontmatter
= { = "1", = ["derive"] }
Create your generator in src/main.rs:
use ;
use Deserialize;
// 1. Define your content structure (Frontmatter)
Key Features
- Graph-based: Define your build as a graph where tasks are wired together using strictly typed handles rather than rigid file paths. This structure automatically resolves complex dependencies, ensuring shared ancestor tasks execute exactly once before efficiently distributing their results.
- Incremental: The engine identifies the specific task responsible for a changed file and marks only its dependent subgraph as "dirty". By re-executing only this precise chain of tasks, the system avoids wasteful full rebuilds and delivers near-instant updates.
- Parallel: A threaded execution engine schedules tasks to run on a thread pool the moment their dependencies are resolved. This saturates your CPU cores automatically, processing heavy assets and content concurrently without manual async orchestration.
- Type-safe: Dependencies are passed as generic tokens, allowing the Rust compiler to enforce that the output type perfectly matches the input type.
- Asset pipeline: Built-in support for:
- Images: Automatically generates multi-format
sources (WebP, AVIF) via the
imagecrate. - CSS/Sass: Integrates
grassto compile and minify stylesheets, outputting CSS bundles. - JavaScript: Bundling and minification via
esbuild. - Svelte: Orchestrates Deno to compile components into separate SSR and hydration scripts, automatically propagating import maps for seamless client-side interactivity.
- Search: Static search indexing via
pagefind. - Sitemap: Sitemap generation via
sitemap-rs.
- Images: Automatically generates multi-format
sources (WebP, AVIF) via the
Core Concepts
- Blueprint: The blueprint of your site. You use this to register tasks and loaders.
- Task: A single unit of work. Tasks can depend on other
tasks.
- Coarse-grained: Tasks that produce a single output.
- Fine-grained: Tasks that produce multiple outputs.
- Handle: A reference to the future result of a task. You pass these to other tasks to define dependencies.
- Loader: A kind of a task that reads data from the filesystem (e.g., markdown files, images).
- Website: The engine that converts the graph defined in
Blueprintinto a proper static website.
Documentation
Introduction is available in the docs/ directory (run make watch), or you
can visit the online version. The best place to
learn the API is the full documentation. It covers
the available features in depth.
Examples
Some examples are available in the examples/ directory.
In addition, there are also some real-world examples:
Feature flags
By default, Hauchiwa is built with the following features, but you can opt out
of them by disabling them in your Cargo.toml file, if you don't need them.
grass: Enables SCSS/Sass compilation.image: Enables image optimization (WebP, resizing).tokio: Enables the Tokio runtime for async tasks.live: Enables live-reload during development.server: Enables the built-in development server.pagefind: Enables static search indexing.sitemap: Enablessitemap.xmlgeneration.
License
GPL-2.0 or later.