MiniSearch
Tiny, dependency-free in-memory full-text search engine for browser and Node
Repository Health
Technical Analysis
MiniSearch is a lightweight, in-memory full-text search engine for JavaScript and TypeScript that runs comfortably in both Node and the browser, including memory-constrained mobile browsers. It supports exact match, prefix search, fuzzy matching, field boosting, and auto-suggestion, making it a popular choice for client-side “search as you type” experiences that need to work offline without a server round-trip.
With zero external runtime dependencies and a compact, well-tested codebase built around an efficient SearchableMap trie-like index, MiniSearch trades the scale of a hosted search service for speed, offline capability, and simplicity — documents can be added or removed from the index at any time, and the whole index can be serialized to JSON for persistence or transfer.
What You Get
- The
MiniSearchclass for building, updating, and querying an in-memory full-text index - Exact match, prefix search, and fuzzy (edit-distance-based) matching, each independently configurable
- Field boosting and per-term/per-document custom boost functions for tuning result ranking
- An auto-suggestion engine (
autoSuggest) for query auto-completion - JSON serialization/deserialization of the whole index via
toJSON/loadJSONfor persistence or transfer between processes
Common Use Cases
- Real-time ‘search as you type’ in web and mobile apps, keeping the index client-side to avoid server round-trips
- Offline-capable search in Progressive Web Apps or Electron apps where no search backend is available
- Adding full-text search to static sites (docs, blogs) by shipping a prebuilt JSON index to the browser
- Auto-complete/auto-suggest features that need typo tolerance and field-weighted ranking without a hosted search service
Under The Hood
Architecture MiniSearch centers on a single ~2,300-line MiniSearch class (src/MiniSearch.ts) composed with a custom SearchableMap (src/SearchableMap/SearchableMap.ts), a radix-tree-like structure optimized for prefix and fuzzy lookups over string keys. Documents are tokenized per configured fields, terms are inserted into the SearchableMap alongside per-document term frequency data, and search queries combine exact/prefix/fuzzy matching strategies (each independently weighted) with a TF-IDF-style scoring and boosting pipeline (field boost, term boost, document boost) before results are ranked and returned. The whole index can be serialized to and rehydrated from JSON via toJSON/loadJSON, letting a prebuilt index be shipped to a browser instead of built client-side.
Tech Stack Written entirely in TypeScript with zero runtime dependencies, bundled via Rollup into ESM, CommonJS, and UMD builds (dist/es, dist/cjs, dist/umd) so it can be dropped into either bundler-based projects or loaded directly via unpkg/jsdelivr in a browser. Types are hand-authored and exported from dist/es/index.d.ts, and API docs are generated with TypeDoc (typedoc.json).
Code Quality The project has an 80KB Jest-style test file (src/MiniSearch.test.js) alongside dedicated tests for SearchableMap, and CI badges show coverage tracking via Coveralls — indicating a genuinely well-tested core rather than a thin smoke-test suite. The single large MiniSearch.ts file is dense but consistently documented with JSDoc comments on nearly every public option and method, which keeps the surface navigable despite its size.
API Design The public API centers on one class with a small number of well-named methods (add, addAll, remove, search, autoSuggest) and richly typed options objects (SearchOptions, Options) that let simple use cases work with defaults while exposing deep customization (custom tokenizers, term processors, per-term/per-document boost functions) for advanced needs — a classic ‘simple things simple, complex things possible’ design that keeps the getting-started boilerplate to a single new MiniSearch({ fields: [...] }) call.
Used by 13 apps in this directory
byterover-cli
AI Agents · AI Code Assistants
A portable memory layer for AI coding agents — curate structured project knowledge into a version-controlled context tree that syncs across tools, machines, and teammates.
Continue
Developer Tools · AI Development · AI Code Assistants
Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.
Docglow
Data Engineering
A next-generation documentation site generator for dbt Core projects — lineage explorer, health scoring, and full-text search for teams without access to dbt Cloud's built-in docs features.
flue
AI Agents · Developer Tools
Build autonomous AI agents and powerful workflows with a programmable TypeScript harness that gives any model sessions, tools, sandboxes, and durable execution.
GrowthBook
Developer Tools · Analytics · Monitoring
Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.
Hatchet
AI Development · Developer Tools · Automation
A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.
Hoppscotch
Developer Tools
A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.
Lokus
Note Taking · Knowledge Management
Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.
medusa
Ecommerce
The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.