Skip to content

Stateless SurrealDB client built for serverless architectures (like a Next.js app deployed on Vercel)

License

Notifications You must be signed in to change notification settings

martinschaer/surrealdb-rest-ts

Repository files navigation

SurrealDB REST client

Stateless SurrealDB client built for serverless architectures

Motivation

I built a Next.js app with next-auth and a custom adapter 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.

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)
    • db.query(sql, vars)
    • db.select(thing)
    • db.create(thing, data)
    • db.update(thing, data
    • db.change(thing, data)
    • db.modify(thing, data)
    • db.delete(thing)
  • consider fetch-h2 instead of node-fetch
  • unit test with DB docker image

Similar projects:

About

Stateless SurrealDB client built for serverless architectures (like a Next.js app deployed on Vercel)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published