libsql-stateless
TypeScript icon, indicating that this package has built-in type declarations

2.9.1 • Public • Published

libsql-stateless

Thin libSQL stateless HTTP driver for TypeScript and JavaScript for the edge 🚀

  • Supported runtime environments: Web API (browser, serverless), Bun, Node.js (>=18)
  • Extremely thin: Has no dependency, only has a few functions that implement the Hrana v3 HTTP protocol from scratch, and has no classes (tend to duplicate memory and/or perform long memory traversals).
  • Does no extra computation.
  • Has no premature optimizations.
  • Is extremely light: 1.15kB (unpacked)* / 548B (gzipped)
  • ✅ Unlike @libsql/client/web, every function performs complete execution in exactly 1 roundtrip.
  • Is built for: Quick stateless query execution. (Mainly for serverless and edge functions.)
  • Supports everything in @libsql/client/web
  • ⚠️ Interactive transactions are not supported because this lib is stateless but transactions are supported.
  • ⚠️ The API provided by libsql-stateless is raw and explicit for reducing (computational and memory) overheads.

* The actual js that is included with your project. (Excluding the type definitions and 2 copies of the main js for esm and cjs. (because you're gonna use one of them))

For easier DX, consider using libsql-stateless-easy instead: it, however, comes with the cost of non-zero-dependency and (computational and memory) overheads potentially unneeded by you. But is still very very very slim compared to @libsql/client.

Why not just use @libsql/client/web?

  1. Not everyone needs stateful DB connection or the overheads that come with it.
  2. To provide a simpler API, @libsql/client/web does a lot of, I'd argue unnecessary, computation under the hood.
    Many people would rather use a more complex API than have worse performance.

Installation

$ npm i libsql-stateless #pnpm, yarn, etc.
# or
$ bun add libsql-stateless

Goto WIKI for Specifications and Examples

API Level

NOTE: <unix_epoch_miliseconds>-HRANA_3_SPEC.md is the current API level.
Downloaded from: https://github.com/tursodatabase/libsql/blob/main/docs/HRANA_3_SPEC.md at <unix_epoch_miliseconds>.
Servers using older API levels may not be compatible. In that case downgrade to an earlier of this package.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.9.1203latest

Version History

VersionDownloads (Last 7 Days)Published
2.9.1203
2.9.01
2.8.61
2.8.536
2.8.410
2.8.4-alpha.21
2.8.4-alpha.11
2.8.4-alpha.01
2.8.31
2.8.21
2.8.01
2.8.0-alpha.21
2.8.0-alpha.11
2.7.61
2.7.51
2.7.41
2.7.32
2.7.21
2.7.11
2.7.02
2.6.01
2.5.101
2.5.91
2.5.81
2.5.71
2.5.62
2.5.41
2.5.31
2.5.21
2.5.11
2.5.01
2.4.41
2.4.31
2.4.21
2.4.11
2.3.101
2.3.91
2.3.81
2.3.71
2.3.60
2.3.50
2.3.40
2.3.30
2.3.20
2.3.10
2.3.00
2.2.00
2.1.20
2.1.10
2.1.00
2.0.00

Package Sidebar

Install

npm i libsql-stateless

Weekly Downloads

288

Version

2.9.1

License

MIT

Unpacked Size

12.4 kB

Total Files

6

Last publish

Collaborators

  • localbox