Main Components of Automattic Harper: Rust Core, Language Server, and Plugin Ecosystem
Automattic/harper is a monorepo grammar-checking ecosystem composed of Rust crates that implement the core engine and JavaScript packages that expose it to editors, browsers, and desktop applications.
The main components of Automattic Harper are organized into a Cargo workspace of Rust crates and a PNPM workspace of TypeScript packages. This architecture enables offline English grammar checking across platforms, from the foundational harper-core engine to the Tauri-based harper-desktop application. Every integration ultimately depends on the curated dictionaries and linting rules defined in the Rust core.
Core Rust Engine and Language Parsers
harper-core: The Grammar-Checking Foundation
harper-core is the fundamental engine responsible for lexing, parsing, rule evaluation, spell-checking, and dictionary handling. As implemented in Automattic/harper, all other crates build on top of this library. The primary entry point is harper-core/src/lib.rs, which exposes the Document, Linter, and dialect handling APIs.
The crate also consumes specialized format parsers and the Brill-style tagger to produce a unified Document representation. You can use the engine directly in Rust:
use harper_core::{Dialect, Document};
use harper_core::parsers::PlainEnglish;
use harper_core::linting::{LintGroup, Linter};
use harper_core::spell::FstDictionary;
let text = "This is an test.";
let parser = PlainEnglish;
let document = Document::new_curated(text, &parser);
let dict = FstDictionary::curated();
let mut linter = LintGroup::new_curated(dict, Dialect::American);
for lint in linter.lint(&document) {
println!("{:?}", lint);
}
harper-brill: Part-of-Speech Tagging
harper-brill implements a Brill-style tagger used for part-of-speech tagging in the core pipeline. Its implementation lives in harper-brill/src/lib.rs.
Format-Specific Parsers
Small dedicated crates turn markup languages into the core Document representation. These include:
harper-html–harper-html/src/lib.rsharper-asciidoc–harper-asciidoc/src/lib.rsharper-typst–harper-typst/src/lib.rs
harper-comments: Linting Inside Source Code
harper-comments provides language-specific comment parsers for Rust, Python, JavaScript, and other languages. This allows the engine to lint prose embedded in source-code comments. The implementation resides in harper-comments/src/lib.rs.
Language Server and CLI Tooling
harper-ls: LSP Implementation for Editors
harper-ls is the Language Server Protocol implementation that powers the VS Code, Neovim, Helix, Emacs, and Zed integrations. The server entry point is harper-ls/src/main.rs. It consumes harper-core diagnostics and translates them into LSP-compatible messages for real-time highlighting and suggestions.
harper-cli: Stand-Alone Debugging and Linting
harper-cli offers a command-line interface for debugging the core engine, testing parsers, and running lint jobs manually. Its front-end code is located in harper-cli/src/main.rs.
WebAssembly and JavaScript Bindings
harper-wasm: Core Engine Compiled to WASM
harper-wasm is the low-level WebAssembly build of the core engine. According to the Automattic/harper source code, harper-wasm/src/lib.rs builds the .wasm artifact that powers browser and Node.js usage.
harper-js: Browser and Node.js API
harper-js wraps harper-wasm with a thin JavaScript API, making the engine accessible in browsers or Node.js applications. The following example demonstrates linting a string with harper.js:
import { Linter, Document, PlainEnglish, FstDictionary, Dialect } from "harper.js";
const text = "She don't like it.";
const doc = new Document(text, new PlainEnglish());
const dict = await FstDictionary.curated();
const linter = new Linter(dict, Dialect.American);
const lints = await linter.lint(doc);
console.log(lints);
Desktop Application and Web Interface
harper-desktop: Native Tauri Application
harper-desktop is a native desktop app built with Tauri v2 and SvelteKit. It provides an offline editor, a system-wide overlay highlighter, and a settings UI. The SvelteKit-based editor view lives at harper-desktop/src/lib/EditorView.svelte.
packages/web: Documentation Site and Live Demo
packages/web hosts the public documentation site at writewithharper.com, built with Vite and SvelteKit. It also hosts the live demo. See packages/web/README.md for build details.
Editor Integrations and Shared UI
VS Code, Chrome, Firefox, and Obsidian Plugins
The repository contains integration glue for popular editors and platforms, including VS Code, Chrome, Firefox, Obsidian, and WordPress:
- VS Code –
packages/vscode-plugin/src/extension.tsinterfaces withharper-ls. - Chrome/Firefox –
packages/chrome-plugin/src/background.tshandles browser-level linting. - Obsidian –
packages/obsidian-plugin/src/main.tsconnects the core engine to the Obsidian note-taking app.
VS Code users can configure the language server through settings:
{
"harper.lintOnSave": true,
"harper.enabledRules": ["spelling", "comma-style"]
}
lint-framework: Shared Web UI Components
lint-framework contains shared web UI components—such as spans, highlights, and suggestion pop-ups—used by both the website demo and the desktop overlay. Its source is tracked in packages/lint-framework/README.md.
Workspace Coordination
The entire ecosystem is coordinated through a Cargo workspace defined by Cargo.toml at the repository root and a PNPM workspace declared in pnpm-workspace.yaml. This setup makes it possible to share core engine code, dictionary data, and build artifacts across Rust binaries, WebAssembly targets, and JavaScript packages.
Summary
harper-coreis the Rust foundation that handles lexing, parsing, linting, and spell-checking.harper-lsexposes grammar diagnostics to editors via the Language Server Protocol.harper-wasmandharper-jsmake the engine portable to browsers and Node.js.harper-desktopdelivers an offline, native editing experience with Tauri.- Integration plugins for VS Code, Obsidian, Chrome, and Firefox connect the engine to user workflows.
- Format-specific parsers—including
harper-html,harper-asciidoc, andharper-typst—extend linting to markup languages. - The Cargo and PNPM workspaces unify the Rust and JavaScript build graphs.
Frequently Asked Questions
What is the core grammar engine in Automattic Harper?
The core engine is harper-core, implemented in harper-core/src/lib.rs. It manages lexing, parsing, rule evaluation, spell-checking, and dictionary handling, and it exposes the Document and Linter APIs that all other components consume.
How does Harper integrate with code editors?
Harper integrates through harper-ls, a Language Server Protocol implementation whose entry point is harper-ls/src/main.rs. Editor-specific plugins—such as the VS Code extension at packages/vscode-plugin/src/extension.ts—communicate with this server to provide real-time diagnostics.
Can Harper run inside a web browser?
Yes. The harper-wasm crate compiles the core engine to WebAssembly via harper-wasm/src/lib.rs, and the harper-js package wraps it for use in browsers or Node.js. The public site at writewithharper.com also hosts a live browser demo.
What desktop application does Harper provide?
Harper provides harper-desktop, a native application built with Tauri v2 and SvelteKit. It includes an offline editor, a system-wide overlay highlighter, and a settings UI, with the primary view implemented in harper-desktop/src/lib/EditorView.svelte.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →