Skip to main content

Importing a vault

Haft imports your vault files into a SQLite catalog for fast rendering and search. Your source files are never modified.

Basic import

haft serve /path/to/vault

On first run, Haft performs a full recursive import. For small vaults (under 1,000 files) this completes in seconds.

Large vaults

For vaults with thousands of files, the initial import can take hours. A 15,000-file vault on a 2-vCPU instance takes roughly 8–10 hours.

tip

The catalog is committed at the end of the import. The reader will show zero pages until the import completes. This is expected — monitor progress with the server logs.

Incremental updates

After the initial import, Haft watches the vault directory. New or modified files are imported incrementally without a full re-scan.

Vault structure

Haft preserves your folder hierarchy as the navigation tree. A typical structure:

vault/
├── Book One/
│ ├── Chapter 01/
│ │ ├── page-1.md
│ │ └── page-2.md
│ └── Chapter 02/
│ └── page-1.md
└── Book Two/
└── ...

Folder names become section titles. File names become page titles (with extensions stripped and hyphens converted to spaces).

Re-importing

To rebuild the catalog from scratch:

rm -rf /path/to/vault/.haft
haft serve /path/to/vault

This is safe — your source files are untouched.