limbo/bindings/javascript/sync/packages/browser
Pekka Enberg f6e3beda45
Some checks are pending
Build and push limbo-sim image / deploy (push) Waiting to run
C compat Tests / test (push) Waiting to run
Dart/Flutter / test (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / test (windows-latest) (push) Waiting to run
Dart/Flutter / precompile (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / precompile (macOS-latest) (push) Waiting to run
Dart/Flutter / test (macos-latest) (push) Waiting to run
Dart/Flutter / precompile (windows-latest) (push) Waiting to run
Dart/Flutter / publish (push) Waiting to run
Run long fuzz tests on Btree / run-long-tests (push) Waiting to run
Run long fuzz tests on Btree / simple-stress-test (push) Waiting to run
Java Tests / test (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / test-sqlite (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Turso 0.2.0-pre.7
2025-09-22 20:44:08 +03:00
..
index-bundle.ts bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
index-default.ts hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00
index-turbopack-hack.ts hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00
index-vite-dev-hack.ts hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00
package.json Turso 0.2.0-pre.7 2025-09-22 20:44:08 +03:00
promise-bundle.ts bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
promise-default.ts bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
promise-turbopack-hack.ts bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
promise-vite-dev-hack.ts bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
promise.test.ts wip 2025-09-19 13:19:30 +04:00
promise.ts wip 2025-09-19 13:19:30 +04:00
README.md opfs for sync in one commit! 2025-09-10 22:35:57 +04:00
tsconfig.json opfs for sync in one commit! 2025-09-10 22:35:57 +04:00
vite.config.js bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
vitest.config.ts opfs for sync in one commit! 2025-09-10 22:35:57 +04:00
wasm-inline.ts hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00
worker.ts hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00

Turso Database for JavaScript in Browser

npm

Chat with other users of Turso on Discord


About

This package is the Turso embedded database library for JavaScript in Browser.

⚠️ Warning: This software is ALPHA, only use for development, testing, and experimentation. We are working to make it production ready, but do not use it for critical data right now.

Features

  • SQLite compatible: SQLite query language and file format support (status).
  • In-process: No network overhead, runs directly in your Node.js process
  • TypeScript support: Full TypeScript definitions included

Installation

npm install @tursodatabase/database-browser

Getting Started

In-Memory Database

import { connect } from '@tursodatabase/database-browser';

// Create an in-memory database
const db = await connect(':memory:');

// Create a table
await db.exec('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)');

// Insert data
const insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
await insert.run('Alice', 'alice@example.com');
await insert.run('Bob', 'bob@example.com');

// Query data
const users = await db.prepare('SELECT * FROM users').all();
console.log(users);
// Output: [
//   { id: 1, name: 'Alice', email: 'alice@example.com' },
//   { id: 2, name: 'Bob', email: 'bob@example.com' }
// ]

File-Based Database

import { connect } from '@tursodatabase/database-browser';

// Create or open a database file
const db = await connect('my-database.db');

// Create a table
await db.exec(`
  CREATE TABLE IF NOT EXISTS posts (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    title TEXT NOT NULL,
    content TEXT,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
  )
`);

// Insert a post
const insertPost = db.prepare('INSERT INTO posts (title, content) VALUES (?, ?)');
const result = await insertPost.run('Hello World', 'This is my first blog post!');

console.log(`Inserted post with ID: ${result.lastInsertRowid}`);

Transactions

import { connect } from '@tursodatabase/database-browser';

const db = await connect('transactions.db');

// Using transactions for atomic operations
const transaction = db.transaction(async (users) => {
  const insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
  for (const user of users) {
    await insert.run(user.name, user.email);
  }
});

// Execute transaction
await transaction([
  { name: 'Alice', email: 'alice@example.com' },
  { name: 'Bob', email: 'bob@example.com' }
]);

API Reference

For complete API documentation, see JavaScript API Reference.

License

This project is licensed under the MIT license.

Support