Introducing Turso in the Browser
Blog post from Turso
Turso in the Browser is a new evolution of SQLite, designed to deliver database-level performance directly within web applications using WebAssembly, responding to the growing demands for instant, offline-capable user experiences. This initiative involves a complete rewrite of SQLite, focusing on browser-native capabilities and asynchronous execution methods, as supported by the new NPM package, which offers an API similar to better-sqlite3. The implementation leverages a main UI thread for database queries and a Web-Worker for filesystem operations, using SharedArrayBuffer for efficient communication, requiring specific COEP/COOP headers. Turso in the Browser can be integrated into various front-end environments, with dedicated exports for specific bundlers like Vite or Turbopack, and it offers a bundled version for use without a bundler, though this increases bundle size. This technology enables the creation of fast, reliable, and scalable web applications, suitable for offline-first productivity tools and real-time collaboration, regardless of network connectivity.