# Automattic Harper Dependencies: Complete Guide to the Rust Workspace Architecture

> Explore Automattic Harper dependencies. Discover its Rust workspace architecture and high-performance crates like fst, pulldown-cmark, and tower-lsp-server. Learn how Harper integrates these powerful libraries.

- Repository: [Automattic/harper](https://github.com/Automattic/harper)
- Tags: architecture
- Published: 2026-08-01

---

**Harper is organized as a Cargo workspace containing over 20 specialized crates that depend on high-performance Rust libraries including `fst` for finite-state transducers, `pulldown-cmark` for Markdown parsing, and `tower-lsp-server` for LSP functionality, with each crate's dependencies defined in its respective [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) manifest.**

Understanding the Automattic Harper dependencies requires examining its distributed workspace structure rather than a single package manifest. This grammar-checking engine separates concerns across multiple crates—from core text processing to WebAssembly bindings—with each component declaring specific external libraries optimized for tasks like spell-checking, parsing, and asynchronous communication.

## Workspace Structure and Dependency Organization

The root [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) establishes a shared versioning scheme and enables intra-workspace linking by declaring all member crates. This workspace definition ensures consistent dependency resolution across the entire project while allowing individual crates to specify only the libraries they require.

### Workspace Members

The root manifest defines the following components as workspace members:

- `harper-cli`
- `harper-core`
- `harper-ls`
- `harper-comments`
- `harper-wasm`
- `harper-tree-sitter`
- `harper-html`
- `harper-literate-haskell`
- `harper-typst`
- `harper-stats`
- `harper-pos-utils`
- `harper-brill`
- `harper-ink`
- `harper-python`
- `harper-jjdescription`
- `harper-thesaurus`
- `harper-asciidoc`
- `fuzz`
- `harper-tex`
- `harper-desktop/src-tauri`
- `harper-git-commit`

Source: [Root Cargo.toml](https://github.com/Automattic/harper/blob/master/Cargo.toml)

## Core Engine Dependencies in harper-core

The [`harper-core/Cargo.toml`](https://github.com/Automattic/harper/blob/main/harper-core/Cargo.toml) file defines the heart of the language-checking engine. This crate pulls in specialized libraries for finite-state transducers, Unicode handling, and efficient data structures.

### Text Processing and Parsing Libraries

- **`pulldown-cmark`** (0.13.3) — Markdown parsing engine
- **`regex`** (1.12.3) — Regular expression engine for pattern matching
- **`ammonia`** (4.1.2) — HTML sanitization utilities
- **`levenshtein_automata`** (0.2.1 with `fst_automaton` feature) — Approximate string matching for spell-checking suggestions

### Data Structures and Performance

- **`fst`** (0.4.7) — Finite-state transducers enabling fast spell-checking operations
- **`hashbrown`** (0.16.1 with `serde` feature) — High-performance hash maps and sets
- **`trie-rs`** (0.4.2) — Trie data structures for efficient prefix matching
- **`smallvec`** (1.15.1 with `serde` feature) — Stack-allocated vector optimization to reduce heap allocations
- **`lru`** (0.18.0) — LRU cache implementation
- **`cached`** (0.59.0) — Memoization utilities for expensive computations
- **`foldhash`** (0.2.0) — Fast hash implementation

### Serialization and Error Handling

- **`serde`** / **`serde_json`** (1.0.228 / 1.0.150 with `derive` feature) — Data serialization and deserialization
- **`thiserror`** (2.0.18) — Derive macro for standard error implementations
- **`bitflags`** (2.11.0 with `serde` feature) — Type-safe bit-flag handling
- **`strum`** / **`strum_macros`** (0.28.0) — Enum utility macros

### Unicode and Text Utilities

- **`unicode-blocks`**, **`unicode-script`**, **`unicode-width`** — Unicode classification and width calculation
- **`ordered-float`** (5.3.0 with `serde` feature) — Ordered floating-point value wrappers

### Internal Workspace Dependencies

- **`harper-brill`** (path dependency, version 2.0.0) — Brill-tagger integration for part-of-speech tagging
- **`harper-thesaurus`** (optional, path dependency, version 2.0.0) — Synonym lookup when the `thesaurus` feature is enabled

Source: [harper-core/Cargo.toml](https://github.com/Automattic/harper/blob/master/harper-core/Cargo.toml)

## Language Server and CLI Dependencies

### harper-ls (Language Server Protocol)

The [`harper-ls/Cargo.toml`](https://github.com/Automattic/harper/blob/main/harper-ls/Cargo.toml) extends the core engine with LSP capabilities using async Rust:

- **`tower-lsp-server`** (0.22.1) — LSP protocol implementation
- **`tokio`** (1.52.1) — Asynchronous runtime with selected features
- **`clap`** (4.6.0) — Command-line argument parsing
- **`dirs`** (6.0.0) — Platform-specific directory resolution
- **`anyhow`** (1.0.102) — Flexible error handling and context propagation
- **`tracing`** / **`tracing-subscriber`** — Structured logging and telemetry
- **`resolve-path`**, **`open`**, **`futures`**, **`globset`** — Path resolution, file opening, async utilities, and glob pattern matching

This crate also maintains path dependencies to other workspace members including `harper-stats`, `harper-comments`, and `harper-typst`.

Source: [harper-ls/Cargo.toml](https://github.com/Automattic/harper/blob/master/harper-ls/Cargo.toml)

### harper-cli (Command Line Interface)

Located in [`harper-cli/Cargo.toml`](https://github.com/Automattic/harper/blob/main/harper-cli/Cargo.toml), the CLI frontend uses:

- **`clap`** — Command-line interface generation
- **`anyhow`** — Error handling
- **`serde_json`** — JSON output formatting
- **`harper-core`** — Core engine integration

Source: [harper-cli/Cargo.toml](https://github.com/Automattic/harper/blob/master/harper-cli/Cargo.toml)

## Platform-Specific Dependencies

### WebAssembly Support (harper-wasm)

The [`harper-wasm/Cargo.toml`](https://github.com/Automattic/harper/blob/main/harper-wasm/Cargo.toml) configures the WebAssembly wrapper with:

- **`wasm-bindgen`** — JavaScript bindings generation
- **`js-sys`** — JavaScript global bindings
- **`wee-alloc`** — Lightweight WebAssembly allocator

Source: [harper-wasm/Cargo.toml](https://github.com/Automattic/harper/blob/master/harper-wasm/Cargo.toml)

### Desktop Application (harper-desktop)

The Tauri backend defined in [`harper-desktop/src-tauri/Cargo.toml`](https://github.com/Automattic/harper/blob/main/harper-desktop/src-tauri/Cargo.toml) combines:

- **`tauri`** — Desktop application framework
- **`serde`** — Configuration serialization
- **`anyhow`** — Error propagation
- **`harper-core`** — Text checking engine integration

Source: [harper-desktop/src-tauri/Cargo.toml](https://github.com/Automattic/harper/blob/master/harper-desktop/src-tauri/Cargo.toml)

## Inspecting the Dependency Graph

You can analyze the Automattic Harper dependencies using Cargo's built-in tooling. Run these commands from the repository root to visualize the dependency tree:

```bash

# Display the complete dependency tree for the entire workspace

cargo tree --all-features

# Show dependencies for only the core engine

cargo tree -p harper-core --all-features

# Inspect LSP server dependencies with specific features enabled

cargo tree -p harper-ls --features concurrent,thesaurus

```

These commands reveal how external crates like `fst` and `pulldown-cmark` integrate with workspace members such as `harper-brill` and `harper-thesaurus`.

## Summary

- Harper uses a **Cargo workspace** with over 20 member crates, each with targeted dependencies defined in individual [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) files.
- The **core engine** (`harper-core`) relies on `fst` for finite-state transducers, `pulldown-cmark` for Markdown parsing, and `levenshtein_automata` for spell-checking suggestions.
- **Async dependencies** including `tokio` and `tower-lsp-server` are isolated to the `harper-ls` crate for Language Server Protocol support.
- **Platform-specific crates** like `harper-wasm` and `harper-desktop` import specialized libraries (`wasm-bindgen`, `tauri`) while maintaining a common core through path dependencies.
- **Utility macros** such as `thiserror`, `strum`, and `bitflags` appear consistently across crates to reduce boilerplate code.

## Frequently Asked Questions

### What is the primary spell-checking dependency in Harper?

Harper uses the **`fst`** crate (version 0.4.7) to implement finite-state transducers for fast dictionary lookups, combined with **`levenshtein_automata`** (0.2.1) to generate spelling suggestions based on edit distance. These libraries enable high-performance approximate string matching without loading entire word lists into memory.

### Does Harper require an asynchronous runtime?

Only the Language Server implementation requires async support. The **`harper-ls`** crate depends on **`tokio`** (1.52.1) as its asynchronous runtime and **`tower-lsp-server`** (0.22.1) for LSP protocol handling. The core engine and CLI tools operate synchronously without async overhead.

### How does Harper manage dependencies across multiple crates?

Harper uses **path dependencies** to link workspace members together. For example, `harper-core` declares `harper-brill` as a path dependency (`path = "../harper-brill"`), ensuring version alignment across the workspace. External crates are pinned to specific versions in each [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) to guarantee reproducible builds.

### What library handles Markdown parsing in Harper?

The **`pulldown-cmark`** crate (version 0.13.3) handles all Markdown parsing operations in `harper-core`. This pull-parser library processes Markdown text efficiently without building a complete DOM, making it suitable for real-time grammar checking in documents.