Prerequisites

Before you start, make sure you:

1

Install the libSQL SDK

Begin by installing the @libsql/client dependency in your project:

2

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

Configure libSQL Client.

4

Execute SQL

app/routes/_index.ts
import type { LoaderFunction } from "@remix-run/node";

import { turso } from "~/lib/turso";

export const loader: LoaderFunction = async () => {
  const { rows } = await turso.execute("SELECT * from TABLE_NAME");

  return {
    items: rows,
  };
};

Examples