Skip to content

unswdb/kuzu-wasm

Repository files navigation

Kùzu-Wasm

Kùzu is an embedded graph database built for query speed and scalability.

Kùzu-Wasm brings kuzu to every browser thanks to WebAssembly.

Try it out at kuzu-shell.netlify.app.

Installation

Prerequisite: Enable Cross-Origin-isolation

CDN

<script type="module">
import kuzu_wasm from 'https://unpkg.com/@kuzu/kuzu-wasm@latest/dist/kuzu-browser.js';
(async () => {
    const kuzu = await kuzu_wasm();
    window.kuzu = kuzu
    const db = await kuzu.Database()
    const conn = await kuzu.Connection(db)
    await conn.execute(`CREATE NODE TABLE User(name STRING, age INT64, PRIMARY KEY (name))`)
    await conn.execute(`CREATE (u:User {name: 'Alice', age: 35});`)
    const res = await conn.execute(`MATCH (a:User) RETURN a.*;`)
    const res_json = JSON.parse(res.table.toString());
})();
</script>

Webpack/React/Vue

npm install @kuzu/kuzu-wasm
import kuzu_wasm from '@kuzu/kuzu-wasm';
(async () => {
    const kuzu = await kuzu_wasm();
    const db = await kuzu.Database()
    const conn = await kuzu.Connection(db)
    await conn.execute(`CREATE NODE TABLE User(name STRING, age INT64, PRIMARY KEY (name))`)
    await conn.execute(`CREATE (u:User {name: 'Alice', age: 35});`)
    const res = await conn.execute(`MATCH (a:User) RETURN a.*;`)
    const res_json = JSON.parse(res.table.toString());
})();

Build from source

git clone https://github.com/unswdb/kuzu-wasm.git --recursive
make package

Repository Structure

Subproject Description Language
kuzu_wasm Wasm Library C++
@kuzu/kuzu-wasm Javascript API Javascript
@kuzu/kuzu-shell Cypher Shell React

License

By contributing to kuzu-wasm, you agree that your contributions will be licensed under the MIT License.