# servletcloud/fstache architecture

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

- Interactive diagram: https://gitdiagram.com/servletcloud/fstache
- Repository: https://github.com/servletcloud/fstache

## Overview

Fstache is a dependency-free Python Mustache renderer. Applications configure a filesystem renderer, which loads and compiles templates before rendering data into a chunkable result; the CLI provides a separate stdin/JSON entry point. Compilation, partial inlining, missing-value policies, and rendering are distinct internal responsibilities. The map also includes the documented CLI capability. Relationships are limited to README statements and shown source references/calls; unsampled factory details are not inferred.

Main entry points: [`src/fstache/_factories.py`](https://github.com/servletcloud/fstache/blob/main/src/fstache/_factories.py) (Filesystem Factories), [`src/fstache/_renderer.py`](https://github.com/servletcloud/fstache/blob/main/src/fstache/_renderer.py) (Template Renderer), [`src/fstache/_cli.py`](https://github.com/servletcloud/fstache/blob/main/src/fstache/_cli.py) (Render CLI), [`src/fstache/_compiler.py`](https://github.com/servletcloud/fstache/blob/main/src/fstache/_compiler.py) (Mustache Compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Renderer Setup"]
  node_factory["Filesystem Factories<br/>[_factories.py]"]
  node_missing["Missing Policies<br/>[_missing.py]"]
end

subgraph group_template["Template Processing"]
  node_compiler["Mustache Compiler<br/>[_compiler.py]"]
  node_inliner["Partial Inliner<br/>[_inliner.py]"]
end

subgraph group_runtime["Render Runtime"]
  node_renderer["Template Renderer<br/>[_renderer.py]"]
  node_result["Rendered Output<br/>[_renderer.py]"]
end

subgraph group_interface["User Interfaces"]
  node_cli["Render CLI<br/>[_cli.py]"]
end

node_application(("Application"))
node_shell(("Shell User"))

node_application -->|"creates renderer"| node_factory
node_factory -->|"compiles templates"| node_compiler
node_factory -->|"invokes rendering"| node_renderer
node_factory -->|"configures policies"| node_missing
node_factory -.->|"may inline"| node_inliner
node_compiler -->|"provides compiled trees"| node_renderer
node_renderer -->|"compiles lambda output"| node_compiler
node_renderer -->|"produces chunks"| node_result
node_shell -->|"runs command"| node_cli
node_cli -->|"compiles input"| node_compiler
node_cli -->|"loads partials"| node_factory
node_cli -->|"renders template"| node_renderer

click node_factory "https://github.com/servletcloud/fstache/blob/main/src/fstache/_factories.py"
click node_missing "https://github.com/servletcloud/fstache/blob/main/src/fstache/_missing.py"
click node_compiler "https://github.com/servletcloud/fstache/blob/main/src/fstache/_compiler.py"
click node_inliner "https://github.com/servletcloud/fstache/blob/main/src/fstache/_inliner.py"
click node_renderer "https://github.com/servletcloud/fstache/blob/main/src/fstache/_renderer.py"
click node_result "https://github.com/servletcloud/fstache/blob/main/src/fstache/_renderer.py"
click node_cli "https://github.com/servletcloud/fstache/blob/main/src/fstache/_cli.py"

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_factory,node_missing,node_shell toneBlue
class node_compiler,node_inliner toneAmber
class node_renderer,node_result toneMint
class node_cli toneRose
class node_application toneIndigo
```

## Components

### Renderer Setup

- [Filesystem Factories](https://github.com/servletcloud/fstache/blob/main/src/fstache/_factories.py): `src/fstache/_factories.py`
- [Missing Policies](https://github.com/servletcloud/fstache/blob/main/src/fstache/_missing.py): `src/fstache/_missing.py`

### Template Processing

- [Mustache Compiler](https://github.com/servletcloud/fstache/blob/main/src/fstache/_compiler.py): `src/fstache/_compiler.py`
- [Partial Inliner](https://github.com/servletcloud/fstache/blob/main/src/fstache/_inliner.py): `src/fstache/_inliner.py`

### Render Runtime

- [Template Renderer](https://github.com/servletcloud/fstache/blob/main/src/fstache/_renderer.py): `src/fstache/_renderer.py`
- [Rendered Output](https://github.com/servletcloud/fstache/blob/main/src/fstache/_renderer.py): `src/fstache/_renderer.py`

### User Interfaces

- [Render CLI](https://github.com/servletcloud/fstache/blob/main/src/fstache/_cli.py): `src/fstache/_cli.py`

### Other components

- **Application**
- **Shell User**

## Connections

- Application → Filesystem Factories: creates renderer (evidence: `README.md`)
- Filesystem Factories → Mustache Compiler: compiles templates (evidence: `src/fstache/_factories.py`)
- Filesystem Factories → Template Renderer: invokes rendering (evidence: `src/fstache/_factories.py`)
- Filesystem Factories → Missing Policies: configures policies (evidence: `src/fstache/_factories.py`)
- Filesystem Factories → Partial Inliner: may inline (evidence: `src/fstache/_factories.py`)
- Mustache Compiler → Template Renderer: provides compiled trees (evidence: `src/fstache/_compiler.py`)
- Template Renderer → Mustache Compiler: compiles lambda output (evidence: `src/fstache/_renderer.py`)
- Template Renderer → Rendered Output: produces chunks (evidence: `src/fstache/_renderer.py`)
- Shell User → Render CLI: runs command (evidence: `README.md`)
- Render CLI → Mustache Compiler: compiles input (evidence: `src/fstache/_cli.py`)
- Render CLI → Filesystem Factories: loads partials (evidence: `src/fstache/_cli.py`)
- Render CLI → Template Renderer: renders template (evidence: `src/fstache/_cli.py`)
