Skip to content

Instantly share code, notes, and snippets.

@kobiebotha
Last active August 4, 2025 19:19
Show Gist options
  • Save kobiebotha/f8718a6f850fd5ac8c208bcb4ba6e284 to your computer and use it in GitHub Desktop.
Save kobiebotha/f8718a6f850fd5ac8c208bcb4ba6e284 to your computer and use it in GitHub Desktop.
PowerSync Expo Go Twoliner

Quickstart:

  1. npx create-expo-app@latest my-app
  2. cd my-app && npm run ios
  3. Open a new terminal tab:
  4. npm install @powersync/react-native @powersync/adapter-sql-js
  5. Replace code in app/(tabs)/index.tsx:
import { SQLJSOpenFactory } from "@powersync/adapter-sql-js";
import { PowerSyncDatabase, Schema } from "@powersync/react-native";
import { useEffect, useState } from "react";
import { Text } from "react-native";

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

export default function HomeScreen() {
  const [version, setVersion] = useState<string | null>(null);

  useEffect(() => {
    powerSync.get("select powersync_rs_version();").then((r) => {setVersion(JSON.stringify(r))});
  }, []);

  return (
      <>{version && <Text style={{fontSize: 24, fontWeight: 'bold'}}>PowerSync Initialized - {version}</Text>}</>
  );
}

At this point everything should work 😃

Next steps:

  1. Implement your SQLite client schema
  2. Connect to PowerSync and your backend - instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment