---
title: 'Setup'
description: 'Preparing your environment for bknd'
---
import InstallBknd from '/snippets/install-bknd.mdx';

In order to use **bknd**, you need to prepare access information to your database and install
the dependencies.

<Note>
   Connections to the database are managed using Kysely. Therefore, all its dialects are
   theoretically supported. However, only the `SQLite` dialect is implemented as of now.
</Note>

## Database
### SQLite as file
The easiest to get started is using SQLite as a file. When serving the API in the "Integrations",
the function accepts an object with connection details. To use a file, use the following:
```json
{
   "url": "file:<path/to/your/database.db>"
}
```
Please note that using SQLite as a file is only supported in server environments.

### SQLite using LibSQL
Turso offers a SQLite-fork called LibSQL that runs a server around your SQLite database. To
point **bknd** to a local instance of LibSQL, [install Turso's CLI](https://docs.turso.tech/cli/introduction) and run the following command:
```bash
turso dev
```

The command will yield a URL. Use it in the connection object:
```json
{
   "url": "http://localhost:8080"
}
```

### SQLite using LibSQL on Turso
If you want to use LibSQL on Turso, [sign up for a free account](https://turso.tech/), create a database and point your
connection object to your new database:
```json
{
   "url": "libsql://your-database-url.turso.io",
   "authToken": "your-auth-token"
}
```

### Custom Connection (unstable)
<Note>
   Follow the progress of custom connections on its [Github Issue](https://github.com/bknd-io/bknd/issues/24).
   If you're interested, make sure to upvote so it can be prioritized.
</Note>
Any bknd app instantiation accepts as connection either `undefined`, a connection object like
described above, or an class instance that extends from `Connection`:
```ts
import { createApp } from "bknd";
import { Connection } from "bknd/data";

class CustomConnection extends Connection {
   constructor() {
      const kysely = new Kysely(/* ... */);
      super(kysely);
   }
}

const connection = new CustomConnection();

// e.g. and then, create an instance
const app = createApp({ connection })
```

## Installation
To install **bknd**, run the following command:
<InstallBknd />