I was writing an issue on an app using IPFS as a storage layer and came to wonder if the solution did not already exist.
Is there an abstraction layer allowing to work with both helia and a remote ipfs node?
The use case is to allow the user of my app to connect it to an existing ipfs node instead of spawning a helia instance in the browser tab. The rationale behind this is that the lifetime of the rpc node is longer that the uptime of the app, meaning that the storage resources can be shared between multiple apps and the resources uploaded in the app are still available to other apps even if the helia node is shut down.
A concrete example for that is people who run a Kubo node within their system (or their browser like Brave) would like to store the app data in the same block storage, no matter which browser their are currently visiting the app in (firefox, a chromium private window…).
An other example is people who run a Kubo node within their local network (like a LaBriqueInter.net) and want to share resources between multiple devices with limited storage capability and uptime. For example a smartphone which takes photos and goes to sleep, and laptop which retouch these photos and goes to sleep, and a pad which displays these photos in a gallery. It does not makes sense to keep a copy of these pictures on all the devices which will not need to access them anymore, but it makes sense to keep them on the local kubo node.
Having the possibility of spawning a helia node on the smartphone gives an option to use the same app in a context where no Kubo node is available on the local network while still using IPFS capabilities.
So, is there a wrapping layer over helia and rpc api allowing to have the same code in the app and change from helia to rpc with a simple switch?