DEV Community

Alex Spinov
Alex Spinov

Posted on

Turso Has Free SQLite Extensions at the Edge — Here's How to Use Them

SQLite is powerful on its own, but Turso supercharges it with extensions — vector search, JSON functions, regex, and more — all running at the edge with sub-millisecond latency.

What Is Turso?

Turso is a SQLite-compatible database built on libSQL (their open-source fork of SQLite). It distributes your database to 30+ edge locations and supports extensions that make SQLite production-ready.

Free Tier

  • 9 GB total storage
  • 500 databases
  • 3 locations
  • 1 billion row reads/month

Extensions That Make SQLite Production-Ready

Vector Search (built-in)

-- Create a vector column
CREATE TABLE articles (
  id INTEGER PRIMARY KEY,
  title TEXT,
  embedding F32_BLOB(1536)
);

-- Semantic search — find similar articles
SELECT title, vector_distance_cos(embedding, ?) as distance
FROM vector_top_k('articles_idx', ?, 10)
JOIN articles ON articles.rowid = k
ORDER BY distance;
Enter fullscreen mode Exit fullscreen mode

No external vector database needed. SQLite + Turso handles it.

JSON Functions

-- Parse and query JSON directly
SELECT json_extract(metadata, '$.author') as author,
       json_extract(metadata, '$.tags') as tags
FROM articles
WHERE json_extract(metadata, '$.published') = true;
Enter fullscreen mode Exit fullscreen mode

Full-Text Search

-- Built-in FTS5
CREATE VIRTUAL TABLE articles_fts USING fts5(title, content);

SELECT * FROM articles_fts WHERE articles_fts MATCH 'serverless edge database';
Enter fullscreen mode Exit fullscreen mode

Why Turso Over Regular SQLite

Feature SQLite Turso
Replication None 30+ edge locations
Vector search Extension required Built-in
Backups Manual Automatic
Multi-tenant Complex Native (per-tenant DBs)
Access Local only HTTP API + SDKs

Multi-Tenant Architecture

Turso's killer feature for SaaS: one database per tenant, all on the free tier.

import { createClient } from '@libsql/client';

function getClientForTenant(tenantId: string) {
  return createClient({
    url: `libsql://${tenantId}-myapp.turso.io`,
    authToken: process.env.TURSO_AUTH_TOKEN,
  });
}

// Each tenant gets isolated data, zero cross-contamination
const db = getClientForTenant('acme-corp');
const result = await db.execute('SELECT * FROM settings');
Enter fullscreen mode Exit fullscreen mode

500 databases on free tier = 500 tenants at $0/month.

Get Started

# Install CLI
brew install tursodatabase/tap/turso

# Create database
turso db create my-app

# Connect
turso db shell my-app
Enter fullscreen mode Exit fullscreen mode

Need to populate your Turso database with web data? My Apify scrapers extract structured data from any site — import directly to SQLite. Email spinov001@gmail.com

Top comments (0)