Documentation Index
Fetch the complete documentation index at: https://docs.turso.tech/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you start, make sure you:
Install the libSQL SDK
Begin by installing the @libsql/client dependency in your project:npm install @libsql/client
Configure database credentials
Get the database URL:turso db show --url <database-name>
Get the database authentication token:turso db tokens create <database-name>
Assign credentials to the environment variables inside .env.TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
Configure libSQL client
import { createClient } from "@libsql/client";
export const turso = createClient({
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
});
Execute SQL
import { turso } from "@/lib/turso";
export default async function Page() {
const { rows } = await turso.execute("SELECT * FROM table_name");
return (
<ul>
{rows.map((row) => (
<li key={row.id}>{row.id}</li>
))}
</ul>
);
}
Examples
Full Stack App
Build with Next.js, Turso, and Drizzle ORM.