lvarayut / relay-fullstack

:point_up::running: Modern Relay Starter Kit - Integrated with Relay, GraphQL, Express, ES6/ES7, JSX, Webpack, Babel, Material Design Lite, and PostCSS
https://lvarayut.github.io/relay-fullstack/
MIT License
985 stars 126 forks source link

Consider use of MongoDB, Mongoose #15

Closed keon closed 8 years ago

keon commented 8 years ago

MongoDB, Mongoose, and Graffiti all work perfectly well when used with GraphQL. the mongoose schema using MongoDB and Mongoose would look like the one I did in the fork.

lvarayut commented 8 years ago

Thanks for your suggestion. I saw the Graffiti for a while but didn't look at it in details. It seems to be used when you already have your existing models and you don't want to rewrite everything from scratch. So, you could embrace Graffiti middleware in order to convert your existing models into a GraphQL schema and exposes it over HTTP. I didn't see how it fits in our project.

AhmadEl-Banna commented 8 years ago

@keonkim @lvarayut you should have a look at this repo https://github.com/RisingStack/graffiti-mongoose

sachgits commented 8 years ago

@lvarayut thats true graffiti doesn't really fit in this project but mongoose at least for the login and signup part of it in way that works with relay and graphQL, thanks

jamesroseman commented 8 years ago

I personally think purposely leaving out dictated data storage is part of what makes this repo so valuable. How you start up a React/Relay project will more or less be the same every time, but how you store the data will change a lot depending on intricacies of the project itself. I think if you want boilerplate Mongo code blended in you should fork or make a Mongo branch.

keon commented 8 years ago

@jamesroseman node.js server projects almost always go with mongo (at least in my experiences). For example, MEAN stack included mongodb boilerplate as their storage and this was what made it so popular. But at the same time I also think that it should be modularized so that users can easily change their storage backend. More thoughts?

lvarayut commented 8 years ago

Both of you have valid points. That's why I'm trying to include the database as an option, by using Yeoman. So, people can choose whether or not they want to include the database. Even better, we could provide many database options; MongoDB, Postgresql, and MySQL, in the generator.

jamesroseman commented 8 years ago

@lvarayut I'd also urge you to include the option to keep it reading from database.js, so that if you were to use a more esoteric approach (I'm working on apps that use RethinkDB, Firebase, some that rely on other app's APIs as their data source) you could still easily spin up a project and unplug the current data dependency.