# Remix + Turso

> Set up Turso in your Remix project in minutes
> Canonical HTML: https://tursodb.cn/docs/sdk/ts/guides/remix/
> Upstream Source (MIT): https://docs.turso.tech/sdk/ts/guides/remix
> Language: en

---
![Remix banner](/images/turso-docs/guides/remix-banner.png)

## Prerequisites

Before you start, make sure you:

* [Install the Turso CLI](/docs/cli/installation/)
* [Sign up or login to Turso](/docs/cli/authentication/#signup)
* Have a Remix app — [learn more](https://remix.run/docs/en/main/start/quickstart#quick-start)

**1. Install the libSQL SDK**

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



```bash npm
npm install @libsql/client
```

```bash pnpm
pnpm install @libsql/client
```

```bash yarn
yarn add @libsql/client
```

```bash deno
deno add npm:@libsql/client
```

**2. Configure database credentials**

Get the database URL:

```bash
turso db show --url <database-name>
```

Get the database authentication token:

```bash
turso db tokens create <database-name>
```

Assign credentials to the environment variables inside `.env`.

```bash
TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
```

**3. Configure libSQL Client.**

```ts Node.js
import { createClient } from "@libsql/client";

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

```ts Edge Runtimes
import { createClient } from "@libsql/client/web";

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

```ts Deno
import { createClient } from "https://esm.sh/@libsql/client@0.6.0/web";

export const turso = createClient({
  url: Deno.env.get("TURSO_DATABASE_URL"),
  authToken: Deno.env.get("TURSO_AUTH_TOKEN"),
});
```

**4. Execute SQL**

```ts 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

<div class="doc-cards">
<a class="doc-card" href="https://github.com/tursodatabase/examples/tree/master/app-the-mug-store" target="_blank" rel="noopener noreferrer"><div class="doc-card-title"><span>E-commerce Store</span><span class="doc-card-arrow" aria-hidden="true">↗</span></div><p class="doc-card-desc">See the full source code</p></a>
<a class="doc-card" href="https://github.com/tursodatabase/examples/tree/master/app-turso-crm" target="_blank" rel="noopener noreferrer"><div class="doc-card-title"><span>CRM App</span><span class="doc-card-arrow" aria-hidden="true">↗</span></div><p class="doc-card-desc">See the full source code</p></a>
</div>
