Prerequisites

Before you start, make sure you:

1

Install the libSQL SDK and its Prisma driver

2

Retrieve 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=
3

Enable the `driverAdapters` preview feature flag:

prisma/schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["driverAdapters"]
}
4

Generate Prisma client

5

Update your Prisma Client Instance

6

Query

const response = await prisma.table_name.findMany();