Architecture
High-level overview of how ciderpress is structured, its design philosophy, and how data flows through the system.
Overview
ciderpress is a documentation framework for monorepos. It takes a single config file, syncs markdown content into a structured output directory, and builds a static site via Rspress. The information architecture -- sections, navigation, sidebar, landing pages -- is derived entirely from the config.
The codebase follows a functional, immutable, composition-first design. There are no classes, no let, no throw statements, and no loops. Errors are returned as Result tuples. Side effects (process exit, terminal output) are pushed to the outermost edges.
Package Ecosystem
ciderpress (wrapper)
The public-facing package. Two entry points and a CLI bin:
The ciderpress CLI bin is provided by this package and delegates to @ciderpress/cli. Users import defineConfig from ciderpress (or ciderpress/config) in their config file.
Layers
CLI Layer
Package: @ciderpress/cli
The command-line interface. Uses @kidd-cli/core for command routing. Styled terminal output goes through @clack/prompts (see packages/cli/src/lib/sync/index.ts:7). Commands orchestrate the core sync engine and Rspress build APIs. See CLI Reference for command details.
Core Layer
Package: @ciderpress/cli (sync engine lives at packages/cli/src/lib/sync/)
The sync engine. Config loading lives separately in @ciderpress/config. See Engine for pipeline details.
UI Layer
Package: @ciderpress/ui
The Rspress theme and plugin:
Data Flow
Error Handling
ciderpress uses the Result<T, E> tuple pattern for expected failures:
Design Decisions
- Config is the information architecture -- A single file defines content structure, routing, navigation, and metadata. No separate sidebar/nav config files.
- Factories over classes -- All components are factory functions returning plain objects.
- Result tuples over throw -- Expected failures use
Result<T, E>. No exceptions. - Incremental sync -- Mtime checks, content hashes, and config hashes skip unchanged work. Manifest comparison removes stale files.
- Virtual pages via MDX -- Landing pages are generated at sync time as MDX with React components.
- Multi-sidebar from config -- Isolated sections get independent sidebar namespaces automatically.
- Glob-driven content discovery -- Patterns auto-discover files without manual entry per page.
- Frontmatter inheritance -- Entries inherit frontmatter from ancestors in the config tree.