TinySearch is a lightweight, fast, full-text search engine. It is designed for static websites.
How it works
The idea of tinysearch is to generate a small, self-contained WASM module from a list of articles on your website and run it directly on the frontend inside browsers.
- Matthias Endler's personal blog
- Are you using tinysearch, too? Add your site here!
- Only searches for entire words. There are no search suggestions (yet).
- Since we bundle all search indices for all articles into one static binary, we recommend to only use it for small- to medium-size websites. Expect around 4kB (non-compressed) per article.
wasm-pack is required to build the WASM module. Install it with
cargo install wasm-pack
npm install terser -g
brew install binaryen
Alternatively, you can download the binary from the release page or use your OS package manager.
After that, you can install tinysearch itself:
cargo install tinysearch
As an input, we require a JSON file, which contains a the content you like to index. Check out this example file).
(You can take a look at the code examples for different static site generators here.)
your homepage. You can open the
demo.html from any webserver to see the
For example, Python has a built-in webserver for testing:
python3 -m http.server
then browse to http://0.0.0.0:8000/demo.html to see the result.
For advanced usage options, try
Please check what's required to host WebAssembly in production -- you will need to explicitly set mime gzip types.
If a full Rust setup, you can also use our nightly-built Docker images.
Available buid args:
- TINY_MAGIC (for a magic number see https://github.com/mre/tinysearch/issues/111)
wget https://raw.githubusercontent.com/tinysearch/tinysearch/master/fixtures/index.json docker run $PWD:/tmp tinysearch/cli index.json
Custom repo/branch build
docker build --build-arg WASM_BRANCH=master --build-arg TINY_MAGIC=64 -t tinysearch/cli .
By default most recent stable alpine rust image is used. To get nightly just run
docker build --build-arg RUST_IMAGE=rustlang/rust:nightly-alpine -t tinysearch/cli:nightly .
- Matthias Endler (@mre)
- Jorge-Luis Betancourt (@jorgelbg)
- Mad Mike (@fluential)
tinysearch is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.