npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-surrealdb

v0.1.0

Published

Expo native module for SurrealDB for iOS, Android and Web

Downloads

89

Readme

expo-surrealdb

Features

  • Works in Expo apps and bare React Native apps (via expo-modules-core)
  • Multi platform:
    • iOS (CarPlay), iPadOS, watchOS, visionOS: powered by the Swift SDK
    • Android: powered by the Kotlin SDK
    • Web: powered by the official JS SDK (surrealdb npm package)
  • Embedded SurrealDB (iOS & Android only for now)
  • Query Builder Pattern
  • HTTP or WebSocket

Install

npm install expo-surrealdb expo-modules-core

For bare React Native projects, install Expo modules once:

npx install-expo-modules@latest

Expo example app

A minimal Expo demo app is included at examples/expo. It is configured for Expo SDK 55.

cd examples/expo
npm install
npm run start

The example imports this package using file:../.., so it always runs against your local module source.

iOS setup

This module expects the SurrealDB Swift package to be linked in your iOS app target.

  1. Open your iOS workspace in Xcode.
  2. Add a Swift Package dependency: https://github.com/ForetagInc/surrealdb.swift.
  3. Link the SurrealDBRuntime product to your app target.
  4. Run pod install and rebuild.

If this is missing, the module throws: SurrealDB Swift SDK is not linked....

Optional (Podfile automation): if you use cocoapods-spm, this podspec can map the package product automatically.

plugin 'cocoapods-spm'
spm_pkg 'SurrealDB', :url => 'https://github.com/ForetagInc/surrealdb.swift.git', :branch => 'main'

Android setup

This module depends on the Kotlin SDK artifact configured in android/build.gradle:

  • Gradle property: expoSurrealdbKotlinDependency
  • Env var override: EXPO_SURREALDB_KOTLIN_DEPENDENCY
  • Default: com.github.itsezc:surrealdb.kotlin:main-SNAPSHOT

In your Android project:

  1. Use Java 17+ for Gradle builds.
  2. Add JitPack to Gradle repositories (usually in settings.gradle).
  3. If your Kotlin SDK artifact coordinate differs, override expoSurrealdbKotlinDependency.

Example settings.gradle repository block:

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
    google()
    mavenCentral()
    maven { url 'https://jitpack.io' }
  }
}

Usage

import { createSurrealClient } from 'expo-surrealdb';

const client = await createSurrealClient({
  kind: 'http',
  endpoint: 'http://127.0.0.1:8000',
  namespace: 'test',
  database: 'test',
});

const rows = await client.query('RETURN 1;');

await client.close();

HTTP example:

const client = await createSurrealClient({
  kind: 'http',
  endpoint: 'http://127.0.0.1:8000',
  namespace: 'test',
  database: 'test',
});

await client.signin({
  kind: 'root',
  username: 'root',
  password: 'root',
});

const rows = await client.query('SELECT * FROM person LIMIT 10;');

Builder pattern example (JS-SDK style, executed by native bridge):

const people = await client
  .select('person')
  .limit(10);

const created = await client
  .create('person:ada')
  .content({ name: 'Ada' });

const query = client.queryBuilder('RETURN 1; RETURN 2;');
const responses = await query.responses();

API

createSurrealClient(options)

Creates a native client and returns a SurrealClient instance.

Android note: only http and websocket kinds are supported. Calling memory or surrealkv on Android throws an error. Web note: only http and websocket kinds are supported. Calling memory or surrealkv on web throws an error.

SurrealClient

  • query(sql, bindings?)
  • query(boundQueryLike)
  • queryBuilder(sql, bindings?)
  • select(...)
  • create(...)
  • insert(...)
  • update(...)
  • upsert(...)
  • delete(...)
  • relate(...)
  • run(...)
  • use(namespace?, database?)
  • signin(credentials)
  • signup(credentials)
  • authenticate(token)
  • invalidate()
  • close()

See src/ExpoSurrealdb.types.ts for full option and credential shapes.

Testing and CI

Run the same checks locally that CI runs:

bun run ci

This includes:

  • lint (biome check on src and tests)
  • typecheck (tsc --noEmit)
  • unit tests (vitest) covering:
    • JS client wrapper behavior
    • web adapter behavior (surrealdb npm path)
    • React Native bridge compatibility (mocked expo-modules-core)
    • iOS/Android native bridge method contract parity