Draft
Conversation
This was referenced Aug 27, 2025
Author
|
Just added initial iOS build proof of concept. PGLite runs on android and ios as a native C library! |
|
🚀 subscribed |
Author
|
Fixed a bunch of bugs with the shared memory communication between react native and pglite. The basic tests in the example app seem to work properly now on both iOS and Android when setting up a new db or loading an existing one. |
Author
|
The basics seem to work now, I think this is proof of concept achieved. To make it production usable there's still some todos:
|
|
Can we have progress for pglite-react-native? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(very) WIP react native support.
Warning: this is definitely not complete or entirely correct. It is proof-of-concept level. There is a lot of leftover verbose logging and incorrect/unused code from iterating upon this. I don't have much C/C++ experience so I used claude code to help write and debug this.
This adds a pglite-react-native package and at least the beginnings of the changes needed for pglite to run on react native. See react-native.md in the corresponding postgres-pglite PR for an overview.
So far the following works:
The following needs work:
To try it out
pnpm installandpnpm build(first time only)npm installinpackages/pglite-react-native/examplenpx expo run:androidinpackages/pglite-react-native/exampleto start an android emulator, then ctrl+c to stop the rest./rebuild-mobile.shinpackages/pglite-react-native/exampleto compile everything, build the mobile app, and install it on the simulatornpx expo start -cto start dev serverThe rebuild-mobile.sh script automates a lot of the following steps, but you can do these manually if you have problems
postgres-pgliterunPLATFORM=android ABI=arm64-v8a PG_BRANCH=REL_17_5_WASM ./mobile-build/build-mobile.shto build pglite static libs for android. You need nix installed.packages/pglite-react-nativedopnpm installpackages/pglite-react-native/examplenpm installto install deps (first run only)npx expo run:androidto start android sim (first run only)rm -rf androidto clean generated android project (if needed)npx expo prebuild -p android --cleanto generate native android projectcd android./gradlew assembleDebugto build the apkadb install app/build/outputs/apk/debug/app-debug.apkto install on devicecd ..npx expo start -cto start the react native dev serveradb logcatto view android system logs for more detail.adb rootto get root adbadb shellto open a shell on devicerun-as com.evelant.exampleto run as app usercat files/pglite/runtime/initdb.stderr.logto see backend logsrm -rf files/pglite/pgdatato clear data for another run after a crashI hope this serves as a good starting point for robust react-native support!