flake-explorer docs

flake-explorer documentation

flake-explorer is an interactive visualizer for Nix flakes — optimized for dendritic (flake-parts + import-tree) configurations, but it works on any flake. It evaluates a flake with your own nix binary, extracts its outputs, module hierarchy, option values, and file provenance into JSON, and renders them in a three-pane Svelte 5 SPA that can be served locally or exported as a single standalone HTML file (see the top-level README for quick-start usage).

flake-explorer browsing a NixOS configuration: module tree, option detail, and file list

The three panes:

System at a glance

One CLI entry point (flake-explorer.ts) dispatches extract, export, and serve. All three run the same extraction driver, which shells out to the host nix binary to evaluate src/extract/extract.nix and writes a data directory: a cheap manifest.json plus one expensive per-configuration blob. serve builds the SPA in-memory and extracts configurations on demand; export embeds the SPA and data into one HTML file (src/export.ts).

flowchart LR
  cli["CLI: extract / export / serve"] --> ext["extractor: nix eval extract.nix"]
  ext --> data["data dir: manifest.json + per-config JSON"]
  data --> serve["serve: HTTP server"]
  data --> export["export: single HTML file"]
  serve --> spa["Svelte SPA in browser"]
  export --> spa

Pages

Page What it answers
Architecture How the pieces fit together; key design decisions and the directory map.
Data schema The manifest / config-blob contract in src/schema.ts.
Extraction pipeline How extract.nix, the chunk walk, and the narHash cache work.
Frontend The Svelte 5 SPA: state, indexes, components, theming.
Build & infra Bun bundling, Nix packaging, CI, and Pages publishing.
CLI reference Every command and flag of the flake-explorer CLI.
Testing The bun test suite, fixtures, and how to run it.
Glossary Project-specific terms, each linked to its source.