Skip to content
// EFFECT DAYS 2026

SqliteClient unstable

Connects Effect SQL to SQLite storage inside Cloudflare Durable Objects.

Provides SqliteClient and the generic SqlClient service. Pass db for queries only, or storage for transactions and migrations. SQLite blobs are returned as Uint8Array; updateValues is unsupported.

Transactions use storage.transaction() instead of transaction SQL, and hold the connection until storage completes. A failed or interrupted nested transaction rolls back only itself, unless the failure reaches the parent.

Fibers that inherit the transaction context must finish their transaction work before the transaction exits; later use can bypass the connection semaphore.

8 exports Since v4.0.0 Source

Constructors

make

unstable
Since v4.0.0

Creates a scoped Cloudflare Durable Object SQLite client around Durable Object SQLite storage, serializing access and converting returned ArrayBuffer values to Uint8Array.

Signature

declare function make(options: SqliteClientConfig): Effect<SqliteClient & SqlClient, never, Scope | Reactivity>

Layers

layer

unstable
Since v4.0.0

Creates a layer from a concrete Durable Object SQLite client configuration, providing both SqliteClient and SqlClient.

Signature

declare function layer(config: SqliteClientConfig): Layer<SqliteClient | SqlClient>

layerConfig

unstable
Since v4.0.0

Creates a layer from a Config-wrapped Durable Object SQLite client configuration, providing both SqliteClient and SqlClient.

Signature

declare function layerConfig(config: {
readonly db?: Config<any>;
readonly spanAttributes?: {
[key: string]: Config<unknown>;
} | Config<Record<string, unknown> | undefined>;
readonly storage?: Config<any>;
readonly transformQueryNames?: Config<(str: string) => string | undefined>;
readonly transformResultNames?: Config<(str: string) => string | undefined>;
} | Config<SqliteClientConfig>): Layer<SqliteClient | SqlClient, ConfigError>

Models

SqliteClientConfig

interface unstable
Since v4.0.0

Configuration for a Cloudflare Durable Object SQLite client, including either a SqlStorage handle or the full DurableObjectStorage for transaction support, span attributes, and query/result name transforms.

Signature

interface SqliteClientConfig {
readonly db?: any;
readonly spanAttributes?: Record<string, unknown>;
readonly storage?: any;
readonly transformQueryNames?: (str: string) => string;
readonly transformResultNames?: (str: string) => string;
}

Services

Since v4.0.0

Service tag for the Cloudflare Durable Object SQLite client service.

When to use

Use to access or provide a Durable Object SQLite client through the Effect context.

Signature

declare const SqliteClient: Service<SqliteClient, SqliteClient & SqlClient>

SqliteClient

interface unstable
Since v4.0.0

Cloudflare Durable Object SQLite client service, extending SqlClient with its configuration. updateValues is not supported.

Signature

interface SqliteClient extends Base {
readonly "~@effect/sql-sqlite-do/SqliteClient": "~@effect/sql-sqlite-do/SqliteClient";
readonly config: SqliteClientConfig;
readonly updateValues: never;
}

Type IDs

TypeId

unstable
Since v4.0.0

Runtime type identifier used to mark Cloudflare Durable Object SqliteClient values.

Signature

declare const TypeId: TypeId

TypeId

type unstable
Since v4.0.0

Type-level identifier used to mark Cloudflare Durable Object SqliteClient values.

Signature

type TypeId = "~@effect/sql-sqlite-do/SqliteClient"