BackendDatabases
sql.js
In-browser SQLite via WASM.
Run SQLite in the browser using sql.js, a WASM build of SQLite.
import { createEngine } from '@superapp/backend'
import { sqlJsProvider } from '@superapp/backend/databases/sql-js'
const engine = createEngine({
providers: [sqlJsProvider],
connections: {
main: { type: 'sql-js' },
},
})Install
npm install sql.jsUse Cases
- Browser apps -- Client-side SQL without a server
- Offline-first -- Store data locally in the browser
- Demos -- Interactive SQL sandboxes
Connection Options
| Option | Type | Description |
|---|---|---|
data | ArrayLike<number> | Initial database binary (optional) |
locateFile | (filename: string) => string | Custom path to WASM file |