Skip to main content

Installation Guide

Altor Vec can be installed in a few different ways depending on how you plan to use it. The most common path is the npm package, which works well in Node.js applications, modern frontend build pipelines, and test suites that need a reproducible local search engine. If you are experimenting in a browser-only prototype, you can also load a prebuilt bundle from a CDN. Teams that need to inspect the WebAssembly build, patch internals, or benchmark custom compiler flags can build the project from source.

Before installing, decide which embedding model you plan to use and confirm its output dimension. Altor Vec requires a fixed dimension for each engine instance, and mismatched vectors are a common source of runtime errors. It is also a good idea to estimate index size early. Even though Altor Vec is efficient, dense vector search still consumes memory proportional to the number of vectors, graph connectivity, and metadata you store alongside each item.

Install with npm

Use npm when you want the simplest developer workflow. The package ships with the JavaScript bindings and the WebAssembly artifact required by the runtime.

npm install altor-vec

In a TypeScript project, you can import the engine directly:

import {WasmSearchEngine} from 'altor-vec';

const engine = await WasmSearchEngine.create({dimensions: 768});

If you bundle for the browser, make sure your toolchain copies or serves the Wasm asset correctly. Vite, Next.js, and modern webpack setups usually handle this well, but older configurations may require an explicit loader rule.

Load from a CDN

For quick demos, a CDN build can be easier than setting up a full package manager workflow. This approach is useful for testing search relevance in a static HTML page or an internal proof of concept.

<script type="module">
import {WasmSearchEngine} from 'https://cdn.example.com/altor-vec/index.js';

const engine = await WasmSearchEngine.create({dimensions: 384});
console.log(engine);
</script>

When using a CDN, pin a specific version rather than a moving tag. That makes bug reports, search benchmarks, and fixture behavior reproducible over time.

Build from Source

Building from source is helpful when you need to validate the Rust and Wasm pipeline, inspect generated binaries, or test local changes before publishing. Clone the repository, install the Node.js dependencies, and run the package build scripts described in the project root. In CI, keep the Rust toolchain version pinned so benchmark comparisons remain meaningful. After building, use npm pack or a workspace link to consume the local artifact in your application. This path takes more setup, but it gives you full control over compilation and packaging.