Skip to main content
Multilingual TursoDB, MVCC & AI Agent database guides Read Engine Guide →
Turso Cloud SDKs SQL over HTTP

Turso Quickstart (SQL over HTTP)

Get started with SQL over HTTP for Turso in a few simple steps.

In this quickstart we will learn how to:

  • Connect to a remote Turso database
  • Execute SQL queries using SQL over HTTP
@tursodatabase/serverless @libsql/client Raw HTTP
Use with Turso databases libSQL databases Any database
Dependencies Uses only fetch — zero native dependencies Requires Node.js or /web subpath None (any HTTP client)
ORM support Not yet supported Drizzle, Prisma, and others N/A

Match the driver to your database engine: @tursodatabase/serverless for Turso databases, @libsql/client for libSQL databases.

The @tursodatabase/serverless package connects to Turso using only the fetch API — no native dependencies, making it the smallest option for edge and serverless runtimes.

1. Install

npm install @tursodatabase/serverless

2. Connect and query

import { connect } from "@tursodatabase/serverless";

const conn = connect({
  url: process.env.TURSO_DATABASE_URL,
  authToken: process.env.TURSO_AUTH_TOKEN,
});

const stmt = await conn.prepare("SELECT * FROM users WHERE id = ?");
const row = await stmt.get([123]);

For compatibility with the libSQL client API, use the compat module:

import { createClient } from "@tursodatabase/serverless/compat";

const client = createClient({
  url: process.env.TURSO_DATABASE_URL,
  authToken: process.env.TURSO_AUTH_TOKEN,
});

const result = await client.execute("SELECT * FROM users WHERE id = ?", [123]);
Synced from official Turso documentation ( tursodatabase/turso-docs · MIT License) Official Docs ↗
Search
Press Esc to close · Powered by Pagefind