---
title: "How We Built the Turso Shell in the Browser"
description: "Turso's SQLite-compatible database can run entirely in the browser via WebAssembly, persisting data to OPFS with no backend."
url: "https://swe.quest/articles/how-we-built-the-turso-shell-in-the-browser-3b4c7642ce66be0b"
canonical: "https://turso.tech/blog/how-we-built-the-turso-shell-in-the-browser"
source: "Turso"
published: "2025-10-14"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["webassembly","sqlite","react","frontend","browsers"]
---

# How We Built the Turso Shell in the Browser

A post on [Turso](https://swe.quest/sources/turso.md), published 2025-10-14, 9 min read, How-to. Original: [https://turso.tech/blog/how-we-built-the-turso-shell-in-the-browser](https://turso.tech/blog/how-we-built-the-turso-shell-in-the-browser)

## Summary

Turso's SQLite-compatible database can run entirely in the browser via WebAssembly, persisting data to OPFS with no backend. The walkthrough builds a SQL shell with Vite, React and TypeScript. It covers importing from the @tursodatabase/database-wasm/vite export to work around a Vite dev-server WASM issue, and setting COOP/COEP headers so SharedArrayBuffer is available. It then builds a query executor that maps prepared-statement results into a table, and upgrades the textarea to a CodeMirror editor with SQL highlighting, autocomplete and a Mod-Enter keybinding.

Written by swe.quest, not by the author.

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

## Topics

- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)

## Prerequisites

- React hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- TypeScript basics ([easy posts on TypeScript](https://swe.quest/tags/typescript.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

Turso, OPFS, Vite, CodeMirror, SharedArrayBuffer, @tursodatabase/database-wasm

## Related posts

- [Introducing Turso in the Browser](https://swe.quest/articles/introducing-turso-in-the-browser-111a711a5e4d489d.md): Turso · 2025-10-08 · Medium · 3 min read · SQLite, WebAssembly, Browsers, Local-first & sync, JavaScript
  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.
- [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 ...
- [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.
- [Write that blog… with Turso!](https://swe.quest/articles/write-that-blog-with-turso-eb57ed9c715594d8.md): Turso · 2024-10-08 · Medium · 4 min read · SQLite, Databases, Frontend
  WriteThatBlog!, an aggregator of engineering blog posts tagged by writing pattern, is a single static HTML page on GitHub Pages that queries a replicated Turso database directly from the browser over HTTP, with no backend functions or proxies.
- [Postgres WASM by Snaplet and Supabase](https://swe.quest/articles/postgres-wasm-by-snaplet-and-supabase-a942df855beab1df.md): Supabase · 2022-10-03 · Medium · 9 min read · PostgreSQL, WebAssembly, Virtualization, Browsers, Networking
  postgres-wasm runs a full PostgreSQL 14 server in the browser by emulating an x86 machine with v86 rather than compiling Postgres to WASM directly.

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)
