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 buttransactions
are supported.โ ๏ธ The API provided bylibsql-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
.
- Not everyone needs stateful DB connection or the overheads that come with it.
- 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.
$ npm i libsql-stateless #pnpm, yarn, etc.
# or
$ bun add libsql-stateless
Goto WIKI
for Specifications and Examples
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.