Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Browser Demo

LatticeDB runs entirely in the browser via WebAssembly. No server required.

Live Demo

Open the standalone HTML demo:

examples/browser-demo.html

Or download and open locally:

curl -O https://raw.githubusercontent.com/Avarok-Cybersecurity/lattice-db/main/examples/browser-demo.html
open browser-demo.html  # macOS
# or: xdg-open browser-demo.html  # Linux
# or: start browser-demo.html     # Windows

Using from CDN

Import directly from GitHub Pages:

<script type="module">
    const CDN = 'https://avarok-cybersecurity.github.io/lattice-db';

    const { LatticeDB } = await import(`${CDN}/js/lattice-db.min.js`);
    const db = await LatticeDB.init(`${CDN}/wasm/lattice_server_bg.wasm`);

    // Create a collection
    db.createCollection('vectors', {
        vectors: { size: 128, distance: 'Cosine' }
    });

    // Insert data
    db.upsert('vectors', [
        { id: 1, vector: new Array(128).fill(0.1), payload: { name: 'example' } }
    ]);

    // Search
    const results = db.search('vectors', new Array(128).fill(0.1), 5);
    console.log(results);
</script>

Available Bundles

FileFormatSizeUse Case
lattice-db.min.jsESM (minified)~15KBProduction
lattice-db.esm.jsESM~25KBDevelopment
lattice-db.jsCommonJS~25KBNode.js/bundlers
lattice_server_bg.wasmWASM~500KBRequired runtime

NPM Installation

For bundled applications, install from npm:

npm install lattice-db
import { LatticeDB } from 'lattice-db';

const db = await LatticeDB.init();

See TypeScript API for complete documentation.