electric-sql / pglite

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

React native support #87

Open Ashraf-Ali-aa opened 6 months ago

Ashraf-Ali-aa commented 6 months ago

Hi I was wondering if this supported react native

sqpollen commented 3 months ago

Any updates on this?

chris-garrett commented 3 months 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 3 months ago

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

looks like react native can support web assembly

samwillis commented 3 months 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 2 months ago

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

evelant commented 2 months 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 months 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)

thruflo commented 3 weeks ago

@samwillis is this the best place to track support for Expo and React Native? I assume it is.

evelant commented 2 weeks ago

Any progress on getting pglite running on react-native? A status update would be appreciated or some pointers to areas where help is needed.

samwillis commented 2 weeks ago

Hey @evelant

We're making good progress, RN support depends on our "libpglite" project. This is going well, we have a good understanding of what's needs and have some early prototyping that showing that it's feasible.

we have two priorities right now: pg_dump (prerequisite to any PG version bump) and RN support.

There's a chain of things to do to get there, but we have a firm plan: libpglite -> retarget to native C -> Kotlin and Swift wrappers -> React native.

Andarius commented 2 weeks ago

Hey @evelant

We're making good progress, RN support depends on our "libpglite" project. This is going well, we have a good understanding of what's needs and have some early prototyping that showing that it's feasible.

we have two priorities right now: pg_dump (prerequisite to any PG version bump) and RN support.

There's a chain of things to do to get there, but we have a firm plan: libpglite -> retarget to native C -> Kotlin and Swift wrappers -> React native.

Did you consider using Nitro ? https://github.com/mrousavy/nitro