---
title: "Introducing Turso in the Browser"
description: "Turso, a from-scratch SQLite rewrite, now runs in the browser via WebAssembly as the npm package @tursodatabase/database-wasm, with a better-sqlite3-like API whose methods are all async because of OPFS."
url: "https://swe.quest/articles/introducing-turso-in-the-browser-111a711a5e4d489d"
canonical: "https://turso.tech/blog/introducing-turso-in-the-browser"
source: "Turso"
published: "2025-10-08"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 3
tags: ["sqlite","webassembly","browsers","local-first","javascript"]
---

# Introducing Turso in the Browser

A post on [Turso](https://swe.quest/sources/turso.md), published 2025-10-08, 3 min read, Announcement. Original: [https://turso.tech/blog/introducing-turso-in-the-browser](https://turso.tech/blog/introducing-turso-in-the-browser)

## Summary

Turso, a from-scratch SQLite rewrite, now runs in the browser via WebAssembly as the npm package @tursodatabase/database-wasm, with a better-sqlite3-like API whose methods are all async because of OPFS. Query compute runs on the main UI thread, since benchmarks showed offloading to a worker cost too much in communication overhead. A Web Worker handles filesystem I/O through the synchronous OPFS interface and shares buffers with the main thread via SharedArrayBuffer, which requires COOP/COEP headers and locks a database to one tab. The code is compiled to wasm32-wasip1-threads with napi-rs v3, and there are dedicated Vite and Turbopack exports plus a CDN build that inlines the WASM as base64 at the cost of a larger bundle.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Local-first & sync](https://swe.quest/tags/local-first.md) (Architecture & design)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- SQLite basics ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- Web Workers
- JavaScript bundlers ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

Turso, SQLite, OPFS, SharedArrayBuffer, napi-rs, Vite, Turbopack, better-sqlite3

## Related posts

- [How We Built the Turso Shell in the Browser](https://swe.quest/articles/how-we-built-the-turso-shell-in-the-browser-3b4c7642ce66be0b.md): Turso · 2025-10-14 · Medium · 9 min read · WebAssembly, SQLite, React, Frontend, Browsers
  Turso's SQLite-compatible database can run entirely in the browser via WebAssembly, persisting data to OPFS with no backend.
- [Bringing SQLite to Vercel Functions with Turso](https://swe.quest/articles/bringing-sqlite-to-vercel-functions-with-turso-afed2a49c7b44020.md): Turso · 2026-02-19 · Medium · 8 min read · SQLite, Serverless, Replication, Multi-tenancy, JavaScript
  Turso's partial sync replicates a subset of SQLite database pages into Vercel Functions so reads run in-process with no network round-trip, while writes go to the remote Turso database for durability and consistency.
- [WebAssembly functions for your SQLite-compatible database](https://swe.quest/articles/webassembly-functions-for-your-sqlite-compatible-database-e23432782d9473c3.md): Turso · 2022-11-23 · Medium · 6 min read · SQLite, WebAssembly, Rust, Databases
  libSQL, Turso's open-contribution fork of SQLite, adds user-defined functions written in WebAssembly and registered directly from SQL with a CREATE FUNCTION ...
- [Introducing Databases Anywhere with Turso Sync](https://swe.quest/articles/introducing-databases-anywhere-with-turso-sync-0b3d82e805c07b9f.md): Turso · 2025-10-08 · Medium · 4 min read · Local-first & sync, SQLite, Replication, Identity & auth, JavaScript
  Turso Sync lets local SQLite-compatible Turso databases, in Node or in the browser via WASM, sync with Turso Cloud through push, pull and sync-aware checkpoint methods layered on the standard database API.
- [Introducing Fast, Native Encryption in Turso Database](https://swe.quest/articles/introducing-fast-native-encryption-in-turso-database-3bdde23a22f614e0.md): Turso · 2025-10-07 · Medium · 4 min read · SQLite, Cryptography, Storage engines, Rust, Performance engineering
  Turso Database, a Rust rewrite of SQLite, now supports native encryption at rest using AEAD ciphers (AEGIS-256 and AES-GCM).

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
