DATE:
AUTHOR:
PowerSync Product Team
React Native SDK JavaScript Packages/Libraries

Expo Go support via @powersync/adapter-sql-js (Alpha)

DATE:
AUTHOR: PowerSync Product Team

Overview

PowerSync applications are now compatible with Expo Go

Expo Go is a pre-built sandbox environment that lets you quickly prototype and test apps, but it doesn’t support native code. This means our standard SQLite adapters for React Native - OP-SQLite and Quick SQLite - don’t work in Expo Go, since they rely on native libraries to load PowerSync’s SQLite core extension. To address this, we created @powersync/adapter-sql-js: a pure JavaScript adapter built on our custom fork of SQL.js (powersync-sql-js) that supports PowerSync without any native code.

Quick start

Install @powersync/adapter-sql-js alongside the React Native SDK:

npx expo install @powersync/react-native

npm install @powersync/adapter-sql-js

Configure it as the database factory:

import { SQLJSOpenFactory } from "@powersync/adapter-sql-js";
import { PowerSyncDatabase } from "@powersync/react-native";

export const powerSync = new PowerSyncDatabase({
  schema: AppSchema,
  database: new SQLJSOpenFactory({
    dbFilename: "example.db",
  }),
});

The docs contain further details on using this package.

Important limitations

@powersync/adapter-sql-js is intended only for the Expo Go sandbox and similar JavaScript-only environments:

  • Performance is significantly slower than with native adapters.

  • SQLite’s durability guarantees do not apply; if the app is terminated during a write you may lose data or corrupt the file.

Therefore this adapter should not be used outside of Expo Go use cases. See the docs on using alternative adapters for development and production builds.

Questions & feedback

@powersync/adapter-sql-js is currently in an alpha release. We would love to hear your experience and suggestions. Please reach out on Discord or open an issue on GitHub

Powered by LaunchNotes