# surrealdb-rest-ts

> Stateless SurrealDB client built for serverless architectures

Latest version **1.0.3** (published 2023-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install surrealdb-rest-ts
pnpm add surrealdb-rest-ts
yarn add surrealdb-rest-ts
bun add surrealdb-rest-ts
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-02-10 |
| First published | 2023-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | martinschaer |
| Maintainers | martinschaer |
| Keywords | surrealdb, typescript |

## Links

- npm: https://www.npmjs.com/package/surrealdb-rest-ts
- Repository: https://github.com/martinschaer/surrealdb-rest-ts
- Homepage: https://github.com/martinschaer/surrealdb-rest-ts#readme
- Issues: https://github.com/martinschaer/surrealdb-rest-ts/issues
- npm.io page: https://npm.io/package/surrealdb-rest-ts

## Dependencies (2)

- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^3.0.0
- [@types/isomorphic-fetch](https://npm.io/package/@types/isomorphic-fetch.md) ^0.0.36

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-02-10
- 1.0.2 — 2023-01-15
- 1.0.1 — 2023-01-15
- 1.0.0 — 2023-01-15

## README

# SurrealDB REST client

Stateless SurrealDB client built for serverless architectures

## Motivation

I built a Next.js app with next-auth and a [custom adapter](https://github.com/martinschaer/next-auth/tree/feature/adapter-surrealdb/packages/adapter-surrealdb) for SurrealDB. I deployed it on Vercel, and realized that I needed a stateless SureralDB client because the serverless nature of Vercel functions where losing my DB connection.

To keep the custom adapter compatible with statefull backends, and benefit from a RPC connection, I built this library following the same function signatures as the official [Node.js driver for SurrealDB](https://surrealdb.com/docs/integration/libraries/nodejs).

## To-do:

- implement all methods:
  - [ ] Sureral.Instance
  - [ ] db.connect(url)
  - [ ] db.wait()
  - [ ] db.close()
  - [ ] db.use(ns, db)
  - [ ] db.signup(vars)
  - [ ] db.signin(vars)
  - [ ] db.invalidate()
  - [ ] db.authenticate(token)
  - [ ] db.let(key, val)
  - [x] db.query(sql, vars)
  - [x] db.select(thing)
  - [x] db.create(thing, data)
  - [ ] db.update(thing, data
  - [x] db.change(thing, data)
  - [ ] db.modify(thing, data)
  - [x] db.delete(thing)
- consider fetch-h2 instead of node-fetch
- unit test with DB docker image

## Similar projects:

- [adileo/surrealdb-ts-client](https://github.com/adileo/surrealdb-ts-client)
- [theopensource-company/surrealdb-cloudflare](https://github.com/theopensource-company/surrealdb-cloudflare)

---
_Source: https://npm.io/package/surrealdb-rest-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
