TrevorSStone / boltmobiledemo

Demo project to show how to use bolt on mobile
MIT License
2 stars 0 forks source link

using with react #1

Open joeblew99 opened 8 years ago

joeblew99 commented 8 years ago

I am planning to use boltDB with a react (web, not native) on android and ios.

So, i was wondering about how to package and also how to get the boltDB layer exposing over http. The readme and code does not really mention gomobile or what to do or how ithe stack works architecturally.

I woudl be happy to contribute react front end with this code to make it easier for others to also see how to do this, if we can work it out.

TrevorSStone commented 8 years ago

Hey Joe, What do you plan on using to wrap your app? Are you just planning on making standard apps and placing a webview in them, or are you going to use something like phonegap? I would be happy to help answer any questions you have getting this working, but it isn't my area of expertise.

On the official bolt repo there are a little more instructions for getting it working, but I don't get much into how to setup gomobile or any of that. https://github.com/boltdb/bolt#mobile-use-iosandroid

Unless you have a strong use-case for using Go and bolt I would recommend not going this route for anything other than a hobbyist project. If you're looking for a good cross platform mobile db that isn't SQL, check out https://realm.io/

joeblew99 commented 8 years ago

thanks for getting back to me.

To be honest, i am not sure. Its a business app, and not graphics, so speed is not vital. I have read about people using dirrect object marshalling, and all the issues with it. I would like to use just HTTP. Here is why : The same FrontEnd will also run inside an electron app on a Desktop. So the Frontend really wants to talk over http / rest to the "backend"

"Backend" on mobile is the golang code, with a bolt DB. "backend" on desktop is EXACTLY the same.

This simple dimple architecture is what i am aiming for.

I dont want to use Realm. I like control, and if its golang all the way down its very nice.

Let me know if you can add anything / ideas / reality check.

BTW there is allot going on with the BoltDB ORM called Storm. Looking very nice.

On Wed, Jun 1, 2016 at 6:17 PM Trevor Stone notifications@github.com wrote:

Hey Joe, What do you plan on using to wrap your app? Are you just planning on making standard apps and placing a webview in them, or are you going to use something like phonegap? I would be happy to help answer any questions you have getting this working, but it isn't my area of expertise.

On the official bolt repo there are a little more instructions for getting it working, but I don't get much into how to setup gomobile or any of that. https://github.com/boltdb/bolt#mobile-use-iosandroid

Unless you have a strong use-case for using Go and bolt I would recommend not going this route for anything other than a hobbyist project. If you're looking for a good cross platform mobile db that isn't SQL, check out https://realm.io/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TrevorSStone/boltmobiledemo/issues/1#issuecomment-223045446, or mute the thread https://github.com/notifications/unsubscribe/ALcac98sNEZpeLh9ekI3clV1lXEvl0GEks5qHbCSgaJpZM4IrktF .

benbjohnson commented 8 years ago

@joeblew99 Just so I'm clear, is this a completely standalone app and you're trying to embed an HTTP server on the device or is the client app communicating with a different server that is running a Go HTTP server?

joeblew99 commented 8 years ago

both !!

The same FrontEnd (react) will run inside an electron app on a Desktop & on a mobile. Hence, in the mobile scenario the Bakend ( golang http service and boltdb) all runs on the mobile. In the Desktop scenario, the Backend ( golang http and BoltDB) all runs on the desktop.

Thats the topology i would like to get, so that i have a one for one mapping. So, because speed at runtime is not crucial, i am leaning towards http transport.

I tested how easy it is to run a http service using gomobile on android, and it works. I used this as a reference: https://godoc.org/github.com/hyangah/mgodoc SO that conforms to my architecture topology.

So, all i need to do is get boltDB running underneath that. This is why i figured i would seek your advice before diving in to see if you had any thoughts.

TrevorSStone commented 8 years ago

@joeblew99 Once again this is not my area of expertise, but it seems like this is probably a rough way to go. Any issues you see are going to be hard to debug and find help on. Also I have found just adding Go to a mobile project inflates the size of the apk by at least 15MB. There might be ways to trim that down, but it is just going to add more complexities to your app. I will be happy to answer any questions you have about getting boltDB to run though. Essentially you just need to pass in where the file path would be stored (like my example on the boltDB readme) when the app is opened and create your struct with a reference to the db connection and pass that around.

joeblew99 commented 8 years ago

Thanks. Really helpful. I will shout if I get stuck

On Mon, 6 Jun 2016, 19:14 Trevor Stone, notifications@github.com wrote:

@joeblew99 https://github.com/joeblew99 Once again this is not my area of expertise, but it seems like this is probably a rough way to go. Any issues you see are going to be hard to debug and find help on. Also I have found just adding Go to a mobile project inflates the size of the apk by at least 15MB. There might be ways to trim that down, but it is just going to add more complexities to your app. I will be happy to answer any questions you have about getting boltDB to run though. Essentially you just need to pass in where the file path would be stored (like my example on the boltDB readme) when the app is opened and create your struct with a reference to the db connection and pass that around.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TrevorSStone/boltmobiledemo/issues/1#issuecomment-224024251, or mute the thread https://github.com/notifications/unsubscribe/ALcac5l4oD0Fo54MjUIY1O5ttEwjAstHks5qJFVdgaJpZM4IrktF .