electric-sql / pglite

Lightweight WASM Postgres with real-time, reactive bindings.
https://pglite.dev
Apache License 2.0
8.33k stars 164 forks source link

React native support #87

Open Ashraf-Ali-aa opened 4 months ago

Ashraf-Ali-aa commented 4 months ago

Hi I was wondering if this supported react native

sqpollen commented 1 month ago

Any updates on this?

chris-garrett commented 1 month ago

I'm very interested in this and can help if I can. I have no idea what is required and I don't know much about WASM but I am willing to dig in.

Ashraf-Ali-aa commented 1 month ago

https://github.com/cawfree/react-native-webassembly

looks like react native can support web assembly

samwillis commented 1 month ago

Hey,

We're looking into that (https://github.com/cawfree/react-native-webassembly) route to RN support, but it's going to require quite a bit of work as it wouldn't be compatible with the current build.

We are exploring two opens:

  1. WASM with something like above or another third party runtime integration.
  2. Having a native build of PGlite that can link to the native app and be wrapped with the TypeScript api.

Both of these will be dependent on the "libpglite" we are currently working on.

We hope to have a better idea soon, but rest assured, React native support is at the top of our to-do list.

chris-garrett commented 1 month ago

Seems like option 2 would make sense. Can we help with this? I don't see any obvious branches here.

evelant commented 3 weeks ago

The way to do it would be option 2, using turbo native modules and cross platform turbo native modules. It may be as simple as plugging PGliteInterface into react native's codegen and adding boilerplate to call the native pglite functions from the generated interface.

pmp-p commented 2 weeks ago

Seems like option 2 would make sense. Can we help with this? I don't see any obvious branches here.

@chris-garrett most likely we will be using WASI build of current code with experimental changes to wasi-sdk 23 to be tested with option 1, after success then we will just retarget assembly to C89 to make native builds for 2).

so far only blocker is wasm extensions loading which is not obvious on wasm3 ( or any wasi runtime so far)