Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dabigblob/libsql-stateless
Thin libSQL stateless HTTP driver for TypeScript and JavaScript for the edge 🚀
https://github.com/dabigblob/libsql-stateless
cloudflare-pages cloudflare-workers database http https lambda-functions libsql netlify serverless sqlite vercel webapi
Last synced: 18 days ago
JSON representation
Thin libSQL stateless HTTP driver for TypeScript and JavaScript for the edge 🚀
- Host: GitHub
- URL: https://github.com/dabigblob/libsql-stateless
- Owner: DaBigBlob
- License: mit
- Created: 2023-11-04T01:26:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-07T20:04:28.000Z (2 months ago)
- Last Synced: 2024-10-25T04:21:20.998Z (21 days ago)
- Topics: cloudflare-pages, cloudflare-workers, database, http, https, lambda-functions, libsql, netlify, serverless, sqlite, vercel, webapi
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/libsql-stateless
- Size: 232 KB
- Stars: 22
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`](https://github.com/tursodatabase/libsql/blob/main/libsql-server/docs/HRANA_3_SPEC.md) 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`](https://github.com/DaBigBlob/libsql-stateless/wiki/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`](https://github.com/DaBigBlob/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
```sh
$ npm i libsql-stateless #pnpm, yarn, etc.
# or
$ bun add libsql-stateless
```# Goto [`WIKI`](https://github.com/DaBigBlob/libsql-stateless/wiki) for Specifications and Examples
## API Level
> NOTE: -HRANA_3_SPEC.md is the current API level.
Downloaded from: https://github.com/tursodatabase/libsql/blob/main/docs/HRANA_3_SPEC.md at .
Servers using older API levels may not be compatible. In that case downgrade to an earlier of this package.