superapp
BackendDatabases

LibSQL / Turso

Connect to Turso or LibSQL databases.

Chat in Claude

Connect to Turso or any LibSQL database. Supports both local files and remote edge replicas.

import { createEngine } from '@superapp/backend'
import { libsqlProvider } from '@superapp/backend/databases/libsql'

const engine = createEngine({
  providers: [libsqlProvider],
  connections: {
    main: {
      type: 'libsql',
      url: process.env.TURSO_URL!,
      authToken: process.env.TURSO_AUTH_TOKEN!,
    },
  },
})

Install

npm install @libsql/client

Connection Modes

ModeURL formatUse case
Remotelibsql://your-db.turso.ioProduction with Turso
Local filefile:./data/local.dbDevelopment
In-memory:memory:Testing
Embedded replicafile:./data/local.db + syncUrlEdge with local cache

Connection Options

OptionTypeDescription
urlstringDatabase URL
authTokenstringTurso auth token (required for remote)
syncUrlstringRemote URL for embedded replicas
syncIntervalnumberSync interval in seconds

On this page