DatabaseClientError (src/client.ts)

slide.code · packages/db/src/client.ts · typescript · MIT
database, Database / ORM

Creates a LibSQL client and Drizzle ORM instance for a given database path.

// Source: https://github.com/longtail-labs/slide.code | License: MIT | Copyright 2025 longtail.labs
// Provided via justclaw.it.com; keep this notice with the code.
import { createClient, type Client } from '@libsql/client/node'
import { drizzle, type LibSQLDatabase } from 'drizzle-orm/libsql'
import * as schema from '@slide.code/schema'

const clientLogger = console.log

/**
 * Error class for database client errors
 */
export class DatabaseClientError extends Error {
  readonly _tag = 'DatabaseClientError'

  constructor(message: string) {
    super(message)
    this.name = 'DatabaseClientError'
  }
}

/**
 * Create a database client with the given path
 */
export const createDatabase = (dbPath: string) => {
  try {
    // Create the Turso client
    const tursoClient: Client = createCl

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key