# Where Are the Source Files Located in the Automattic/Harper Repository?

> Locate source files in the Automattic/harper repository. Discover the monorepo structure and discover where Rust crates and npm packages are organized under packages/.

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

---

**The Automattic/harper source files are organized in a monorepo structure with top-level directories for Rust crates and npm workspace packages under `packages/`.**

The Harper spell- and grammar-checking ecosystem is developed as a single Git repository that bundles multiple components—ranging from a Rust core engine to browser extensions and a desktop application. Understanding where the source files live in the Automattic/harper repository helps contributors navigate the codebase, import the right modules, and build specific components.

## Rust Components: Top-Level Crate Directories

Harper's foundational logic resides in several Rust crates located at the repository root. Each crate is a standard Cargo project with its own [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) and `src/` directory.

### harper-core: The Grammar-Checking Engine

The **harper-core** directory contains the core linting engine written in Rust. This is the heart of Harper—implementing tokenization, rule evaluation, and diagnostic generation.

- **Primary source**: `harper-core/src/`
- **Library entry point**: [`harper-core/src/lib.rs`](https://github.com/Automattic/harper/blob/main/harper-core/src/lib.rs)
- **Key exports**: `Linter` struct and `lint()` method for programmatic use

Downstream Rust crates reference harper-core via path dependency:

```toml
[dependencies]
harper-core = { path = "../harper-core" }

```

```rust
use harper_core::Linter;

fn main() {
    let mut linter = Linter::new_default();
    let text = "This is a smaple sentence.";
    let result = linter.lint(text);
    println!("{:?}", result);
}

```

### harper-ls: Language Server Protocol Implementation

Editor integrations rely on **harper-ls**, the LSP implementation. Located at `harper-ls/`, this crate exposes Harper's diagnostics through the Language Server Protocol used by VS Code, Neovim, and other editors.

- **Executable entry point**: [`harper-ls/src/main.rs`](https://github.com/Automattic/harper/blob/main/harper-ls/src/main.rs)
- **Protocol handlers**: Defined in `harper-ls/src/`

### harper-wasm: WebAssembly Bindings

The **harper-wasm** crate at `harper-wasm/` compiles the core engine to WebAssembly. This enables browser and Node.js usage via the [`harper.js`](https://github.com/Automattic/harper/blob/main/harper.js) package.

- **WASM entry point**: [`harper-wasm/src/lib.rs`](https://github.com/Automattic/harper/blob/main/harper-wasm/src/lib.rs)
- **Build output**: Consumed by `packages/harper.js/`

### harper-comments and harper-tex: Specialized Parsers

Two additional Rust crates provide domain-specific functionality:

- **harper-comments** (`harper-comments/`): Extracts and lints comments from source code files
- **harper-tex** (`harper-tex/`): LaTeX-specific processing utilities

Both follow the standard [`src/lib.rs`](https://github.com/Automattic/harper/blob/main/src/lib.rs) pattern for library crates.

### harper-desktop: Tauri-Based Desktop Application

The **harper-desktop** directory contains a hybrid Rust/SvelteKit application:

| Layer | Location | Entry Point |
|-------|----------|-------------|
| Rust backend | `harper-desktop/src-tauri/` | [`harper-desktop/src-tauri/src/main.rs`](https://github.com/Automattic/harper/blob/main/harper-desktop/src-tauri/src/main.rs) |
| SvelteKit frontend | `harper-desktop/src/` | `harper-desktop/src/routes/+page.svelte` |

Run the development server from the repository root:

```bash
just dev-desktop

```

## JavaScript/TypeScript Components: The `packages/` Directory

All npm-managed source files in Automattic/harper live under the `packages/` directory, configured as a pnpm workspace via [`pnpm-workspace.yaml`](https://github.com/Automattic/harper/blob/main/pnpm-workspace.yaml) at the repository root.

### harper.js: The Public JavaScript API

**packages/harper.js/** bundles the WASM module and provides a TypeScript-friendly interface:

- **Entry point**: [`packages/harper.js/src/index.ts`](https://github.com/Automattic/harper/blob/main/packages/harper.js/src/index.ts)
- **Primary class**: `LocalLinter` for in-process linting

```bash
npm i file:./packages/harper.js

```

```javascript
import { LocalLinter } from 'harper.js';

(async () => {
  const linter = await LocalLinter.create();
  const diagnostics = await linter.lint('This is a smaple sentence.');
  console.log(diagnostics);
})();

```

### Lint Framework and Editor Components

Two shared packages support multiple Harper UIs:

- **packages/lint-framework/**: UI-agnostic lint utilities and types ([`src/index.ts`](https://github.com/Automattic/harper/blob/main/src/index.ts))
- **packages/harper-editor/**: Reusable Svelte components ([`src/lib/Editor.svelte`](https://github.com/Automattic/harper/blob/main/src/lib/Editor.svelte))

### Web Site and Documentation

The **packages/web/** directory contains a SvelteKit site powering `writewithharper.com`:

- **Documentation content**: `packages/web/src/routes/docs/about/+page.md`

### Browser and Editor Extensions

Multiple plugin implementations share the `packages/` parent:

| Extension | Location | Activation File |
|-----------|----------|---------------|
| Chrome | `packages/chrome-plugin/` | [`src/background.ts`](https://github.com/Automattic/harper/blob/main/src/background.ts) |
| Firefox | `packages/firefox-plugin/` | [`src/background.ts`](https://github.com/Automattic/harper/blob/main/src/background.ts) |
| VS Code | `packages/vscode-plugin/` | [`src/extension.ts`](https://github.com/Automattic/harper/blob/main/src/extension.ts) |
| Obsidian | `packages/obsidian-plugin/` | [`src/main.ts`](https://github.com/Automattic/harper/blob/main/src/main.ts) |
| WordPress | `packages/wordpress-plugin/` | [`src/plugin.php`](https://github.com/Automattic/harper/blob/main/src/plugin.php) |

## Build Orchestration Files

The Automattic/harper repository uses two workspace systems to coordinate its multi-language structure:

- **Rust**: Root [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) with workspace members pointing to each top-level crate directory
- **JavaScript**: [`pnpm-workspace.yaml`](https://github.com/Automattic/harper/blob/main/pnpm-workspace.yaml) declaring `packages/*` as workspace packages

## Summary

- **Rust source files** live in top-level directories: `harper-core/`, `harper-ls/`, `harper-wasm/`, `harper-comments/`, `harper-tex/`, and `harper-desktop/`
- **JavaScript/TypeScript source files** are grouped under `packages/`, including [`harper.js`](https://github.com/Automattic/harper/blob/main/harper.js), browser extensions, and Svelte components
- **Key entry points** include [`harper-core/src/lib.rs`](https://github.com/Automattic/harper/blob/main/harper-core/src/lib.rs) for the engine and [`packages/harper.js/src/index.ts`](https://github.com/Automattic/harper/blob/main/packages/harper.js/src/index.ts) for the JS API
- **Documentation source** is located in `packages/web/src/routes/docs/`

## Frequently Asked Questions

### What is the main entry point for using Harper as a Rust library?

The main entry point is [`harper-core/src/lib.rs`](https://github.com/Automattic/harper/blob/main/harper-core/src/lib.rs). This file exports the `Linter` struct and related types that power all Harper linting functionality. Import `harper_core` in your [`Cargo.toml`](https://github.com/Automattic/harper/blob/main/Cargo.toml) to use it.

### How do I find the source for the VS Code extension?

The VS Code extension source is located at `packages/vscode-plugin/`. The extension activates through [`packages/vscode-plugin/src/extension.ts`](https://github.com/Automattic/harper/blob/main/packages/vscode-plugin/src/extension.ts), which launches the `harper-ls` language server as a separate process.

### Where is the WebAssembly compilation step defined?

The Rust-to-WASM compilation lives in [`harper-wasm/src/lib.rs`](https://github.com/Automattic/harper/blob/main/harper-wasm/src/lib.rs). This crate uses `wasm-bindgen` to generate JavaScript bindings. The resulting WASM binary is packaged by `packages/harper.js/` for npm distribution.

### Can I build just one component without the entire monorepo?

Yes. Each Rust crate is a standard Cargo project that builds independently with `cargo build`. JavaScript packages in `packages/` can be built individually with `pnpm --filter <package-name> build`, though some depend on the WASM output from `harper-wasm`.