Fuse.js

Lightweight, zero-dependency fuzzy-search library for JavaScript and TypeScript, in the browser or on the server.

Library
npm
v7.5.0
20,509 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
58 /100 Fair
Development Activity 28
Maintenance 40
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 87
Code Quality 88
Innovation 85
Learning Curve 90

Fuse.js is a lightweight, zero-runtime-dependency fuzzy-search library written in TypeScript. It implements the Bitap approximate string-matching algorithm so searches tolerate typos and partial matches without a dedicated search backend, making it a natural fit for filtering small-to-medium datasets entirely on the client.

Beyond basic fuzzy matching, Fuse.js supports weighted multi-field keys, an extended-search syntax with exact/prefix/suffix operators, logical $and/$or query composition, match-index highlighting, and an opt-in token-search mode with BM25-style relevance ranking for multi-word queries. A companion FuseWorker build offloads indexing and search to Web Workers for large datasets without blocking the UI thread.

What You Get

  • Core Fuse class implementing Bitap fuzzy matching with configurable threshold, distance, and location tuning
  • Weighted multi-key search so fields like title can outrank fields like description in relevance scoring
  • Extended search syntax (=, ^, !, etc.) and logical $and/$or query composition for precise filtering
  • Token search mode with per-word typo tolerance and BM25-style IDF ranking for multi-word queries
  • FuseWorker build that shards documents across Web Workers for parallel search on large datasets
  • Match-index highlighting output (includeMatches) for building highlighted search-result UIs
  • Dual ESM/CJS builds plus a smaller “basic” build (fuzzy search only) for bundle-size-sensitive apps

Common Use Cases

  • Client-side search-as-you-type over a product catalog, docs site, or command palette without a backend search index
  • Fuzzy filtering of autocomplete/typeahead suggestions that tolerate user typos
  • Ranking and highlighting matches across multiple weighted fields (e.g. title vs. body) in a search results list
  • Offloading fuzzy search for large in-memory datasets to a Web Worker so the main thread stays responsive

Under The Hood

Architecture — The public entry point (src/entry.ts) wires up the Fuse class (src/core/index.ts) with pluggable search strategies registered through a strategy-pattern dispatcher (src/core/register.ts): BitapSearch is always available as the default, while ExtendedSearch (src/search/extended) and TokenSearch (src/search/token) are conditionally registered behind build-time env flags (EXTENDED_SEARCH_ENABLED, TOKEN_SEARCH_ENABLED), which is how the same source tree produces the smaller “basic” build alongside the “full” build. The Fuse instance builds a FuseIndex (src/tools/FuseIndex.ts) from the input documents plus a KeyStore for weighted search keys; queries are parsed into an AST by src/core/queryParser.ts (supporting $and/$or composition), scored per field via computeScore.ts for Bitap matches or an inverted index (src/search/token/InvertedIndex.ts) for BM25-style token scoring, and the top-N results are kept efficiently with a MaxHeap (src/tools/MaxHeap.ts) rather than sorting the full result set. src/workers/FuseWorker.ts wraps the same core to shard documents across Web Workers for parallel search.

Tech Stack — Written in TypeScript (40% of the codebase) with the remainder in JavaScript, bundled by tsdown (an esbuild-based bundler, per tsdown.config.ts) into dual ESM/CJS outputs (dist/fuse.mjs, dist/fuse.cjs) plus separate minified “basic” builds. The package ships with zero runtime dependencies — everything in package.json (vitest, eslint 9 + typescript-eslint, prettier, vitepress, husky, commitlint, standard-version) is a devDependency for testing, linting, docs, and release automation. Type-checking runs via tsc against src/tsconfig.json.

Code Quality — The test/ directory holds 20+ spec files covering fuzzy search, extended search, logical search, and token search (further split into scenario, tokenizer, and AND-logic suites), plus dedicated tests for Web Worker behavior, cache invalidation, CJS interop, and even the public TypeScript type surface (package-types.test.ts, typings.test.ts). Snapshot tests under test/__snapshots__/ pin exact result sets for regression safety, run via vitest. Error handling is centralized in src/core/errorMessages.ts as named constants rather than inline strings, and invalid option combinations (e.g. calling Fuse.match() with useTokenSearch) throw explicit, documented errors instead of failing silently.

API Design — Getting started requires only new Fuse(docs, { keys }) followed by .search(query), with sensible defaults in src/core/config.ts covering everything else. Advanced capabilities (weighted keys, extended-search operators, logical queries, token search, Web Worker offloading) are opt-in through boolean options rather than separate APIs, so the mental model stays consistent as usage scales up. Full TypeScript types are re-exported from entry.ts for options, results, and match objects, and the dedicated docs site (fusejs.io, built from the docs/ folder) supplements the README with interactive demos and a complete API reference.

Used by 65 apps in this directory

Rust
72%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,326

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
87
Repo Health
81
Technical
64
Dependency
Built with
Rust 72%
TypeScript 25%
Updated 6 days ago
TypeScript
99%
Other

Rowy

Databases · Low Code Platforms

6,842

Manage Firestore data in an Airtable-like spreadsheet UI and build Cloud Functions workflows directly in your browser—on your own GCP project.

View details
45
Repo Health
71
Technical
65
Dependency
Built with
TypeScript 99%
Updated 1 years ago
TypeScript
67%
MIT

Scalar

Developer Tools

16,313

Beautiful, interactive OpenAPI documentation with a built-in offline-first API client and multi-language code generation — all in one open-source platform.

View details
90
Repo Health
89
Technical
65
Dependency
Built with
TypeScript 67%
Vue 29%
Updated 6 days ago
Python
57%
Other

Sentry

Analytics · Developer Tools · Monitoring

45,632

Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.

View details
95
Repo Health
80
Technical
66
Dependency
Built with
Python 57%
TypeScript 42%
Updated 6 days ago
JavaScript
86%
AGPL 3.0

SillyTavern

AI Assistants

34,869

The power-user LLM frontend that unifies dozens of AI backends with a rich scripting engine, immersive Visual Novel mode, and a thriving extension ecosystem.

View details
88
Repo Health
71
Technical
63
Dependency
Built with
JavaScript 86%
Updated 4 weeks ago
TypeScript
51%
AGPL 3.0

Sink

Analytics · Bookmarks Archiving

7,231

Serverless link shortener with real-time analytics, powered by Cloudflare

View details
84
Repo Health
80
Technical
0
Dependency
Built with
TypeScript 51%
Vue 47%
Updated 1 months ago
Python
100%
Other

Sourcebot

AI Code Assistants · Developer Tools · Search

4,005

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
86
Repo Health
83
Technical
61
Dependency
Built with
Python 100%
Updated 1 weeks ago
TypeScript
92%
Other

Suna

AI Agents

20,306

Turn your company into a git repo — one config, one command center, a workforce of AI agents that runs the real work around the clock.

View details
90
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 92%
Updated 6 days ago
TypeScript
72%
Apache 2.0

Supabase

Authentication · Databases · Developer Tools

113,827

The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.

View details
90
Repo Health
91
Technical
62
Dependency
Built with
TypeScript 72%
MDX 26%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers