Serverless SQLite
Turso Cloud is a fast, simple, reliable and developer friendly database cloud built for massive scalability, including multi-tenancy. It’s great for all types of apps, including AI apps with on-device RAG (Retrieval-Augmented Generation), local-first vector search, offline writes, and privacy-focused data access with low-latency.
Vercel users can create hundreds of Serverless SQLite databases on Turso Cloud for free.
Get started today for free, and be production ready for as little as $4.99/month.
Connect this database to your existing project and then run vercel link in the CLI to the project locally.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Run the following command to install the Turso libSQL SDK:
npm install @libsql/clientYou can find more details and documentation on the Turso Quickstart for TypeScript.
To start using the Turso libSQL client in your project, import the client and use it in your pages or route handlers:
import { createClient } from '@libsql/client';import { NextResponse } from 'next/server';
const client = createClient({ url: process.env.TURSO_DATABASE_URL, authToken: process.env.TURSO_AUTH_TOKEN});
export const POST = async () => { // Fetch data from SQLite const result = await client.execute("CREATE TABLE todos (description);");};Connect this database to your existing project and then run vercel link in the CLI to the project locally.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Run the following command to install the Turso libSQL SDK:
npm install @libsql/clientYou can find more details and documentation on the Turso Quickstart for TypeScript.
To start using the Turso libSQL client in your project, create a libSQL client somewhere in your project (e.g. src/turso.ts:
import { createClient } from "@libsql/client/web";
export const turso = createClient({ url: import.meta.env.TURSO_DATABASE_URL, authToken: import.meta.env.TURSO_AUTH_TOKEN,});The Turso Cloud integration sets up several environment variables, and you should install the @libsql/client dependency for executing SQL queries in your connected Vercel project.
Each connected SQLite database will expose the following environment variables:
TURSO_DATABASE_URL – The connection URL for your databaseTURSO_AUTH_TOKEN – The token used to authenticate your requestsUsers on a paid plan are invoiced at signup and then on the first of each month. If you subscribe mid-month, billing is prorated. When switching to a cheaper plan, any remaining balance is credited to your account and automatically applied to future invoices.