Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/surrealdb/surrealdb.wasm

SurrealDB driver for WebAssembly
https://github.com/surrealdb/surrealdb.wasm

database database-connector iot-database javascript-library javascript-module realtime-database surreal surrealdb webassembly

Last synced: 3 months ago
JSON representation

SurrealDB driver for WebAssembly

Awesome Lists containing this project

README

        




 

A WebAssembly engine for the SurrealDB JavaScript SDK.




 

 



 

 

 

# surrealdb.wasm

A WebAssembly engine for the SurrealDB [JavaScript SDK](https://github.com/surrealdb/surrealdb.js).

This library is a plugin for the SurrealDB JavaScript SDK, which can be used to run SurrealDB as an embedded database within a browser environment, not server side environments.

It enables SurrealDB to be run in-memory, or to persist data by running on top of IndexedDB. It allows for a consistent JavaScript and TypeScript API when using the `surrealdb.js` library by adding support for embedded storage engines (`memory`, `indxdb`) alongside the remote connection protocols (`http`, `https`, `ws`, `wss`).

This library works with ES modules (`import`), not CommonJS (`require`).

## Example usage

```js
import { Surreal } from 'surrealdb.js';
import { surrealdbWasmEngines } from 'surrealdb.wasm';

// Enable the WebAssembly engines
const db = new Surreal({
engines: surrealdbWasmEngines(),
});

// Now we can start SurrealDB as an in-memory database
await db.connect("mem://");
// Or we can start a persisted IndexedDB database
await db.connect("indxdb://demo");

// Now use the JavaScript SDK as normal.
```