srtucker22 / chatty

A WhatsApp clone with React Native and Apollo (Tutorial)
https://medium.com/@simontucker/building-chatty-a-whatsapp-clone-with-react-native-and-apollo-part-1-setup-68a02f7e11
MIT License
502 stars 110 forks source link

Upgrade database? #20

Open rjpalermo1 opened 7 years ago

rjpalermo1 commented 7 years ago

Hi, you say in your intro that you will be using sqlite 'for now'. Are there plans to show an upgrade to postgres or mongo, etc?

Also, FYI if you are not aware there is a very interesting project called postgraphql you might be interested in. I am leaning hard in that direction as JS isn't in my toolbox yet and by what I am seeing I can eliminate the express/ruby/python back end server all-together and query direct to graphQL at the database...

srtucker22 commented 7 years ago

Hey @rjpalermo1, I'd definitely be open to showing a migration to postgres or another DB in a future tutorial.

Right now, it's much easier to set up and run the tutorial with sqlite without additional DB setup and configuration, so that's why I took that route. The chatty tutorial is more about understanding how everything is connected under the hood. I don't really see sequelize as being a key feature of this tut, more a means to showing how you can create a gql server from whatever data source. But honestly, if you just swapped postgres for sqlite in this tut, the ORM code shouldn't really change at all and I wouldn't be surprised if everything just worked right away.

I'm a big fan of postgraphql. It's a terrific package. My only warning would be that if you're planning on making a real-time app, there are some key features that postgraphql still needs to figure out like subscriptions.

I'd also be wary of believing you can remove a backend server entirely. I've never come across a substantial app that didn't need some custom server logic or features behind it. A simple example might be storing image files -- if you wanted to use a service like S3, you need to write backend code that will shuffle those uploads there instead of Postgres. I'm all for minimizing backend code, but I doubt you'll be able to eliminate it.

Let me know your thoughts!

Karsens commented 7 years ago

,, But honestly, if you just swapped postgres for sqlite in this tut, the ORM code shouldn't really change at all and I wouldn't be surprised if everything just worked right away." I've done this, tried mysql instead of sqlite, and it worked like a charm. 👍

zillable commented 7 years ago

Refers two articles flexible database: https://www.compose.com/articles/use-all-the-databases-part-1/ https://www.compose.com/articles/use-all-the-databases-part-2/