Schema examples of popular services

Hello, I love badger, and I would really love to learn Dgraph as well. My problem is that there seem to be an absence of complete examples which makes it difficult to use, especially because it doesn’t appear to be widely used in public GitHub repos as well.

For instance, something as simple/common as a User schema consisting of Username, Email and Password seems near impossible to find. The closest thing I’ve found is this repo which for all I know is wrong because according to the official documentation, schema types can only be int, float, string, bool, id, dateTime, geo, and uid.

I do love the playground, and I think the graphoverflow is really great as well. I just wish that there were more examples like a Twitter, HN clone, making the playground with the movieset code open source (at least I think it isn’t?), etc.

1 Like

Hello,
Thanks for your comment. Soon I’ll be creating sample videos on the Dgraph Labs channel https://www.youtube.com/channel/UCghE41LR8nkKFlR3IFTRO4w
I want to take samples of open projects on github (Most in JavaScript) and modify them to use Dgraph. I just need time to organize other videos first and start this series. Would it interest you?

Are you talking about the extended type password? In fact we support pass.

Best regards.

Michel Conrado,
Dgraph Support Engineer.

Hi jack and MichelDiz,

I would like to second jack’s request and extend it hopefully without hijacking the tread. A real world example for modelling/storing and retrieving/searching for typical signup data including what jack mentioned but also first/last name, home/billing/shipping address, and other typical fields like state/country/preferred language/geo location etc would be extremely helpful.
If you could include examples for searches like people in your state/zip code/geo range that would be even more awesome.

Thank you,
Hans

Hello,
Thanks for your comment. Soon I’ll be creating sample videos on the Dgraph Labs channel https://www.youtube.com/channel/UCghE41LR8nkKFlR3IFTRO4w
I want to take samples of open projects on github (Most in JavaScript) and modify them to use Dgraph. I just need time to organize other videos first and start this series. Would it interest you?

I would be very interested :)… I only plan to use Go for Dgraph, but I think it would still be very useful for me.

Like Hans, then I would also especially appreciate if you in one of the examples can show how the entire auth process could be handled (schema to store username, email, password, token, etc., queries/mutations for registration/login and to compare token). I personally only plan to support user auth through email/username + password, but I think others might also appreciate how to support both regular auth + facebook/instagram/whatever people use nowadays…

And then have the User used for something, like ability to post text and lookup text posted by other users, have users follow each other, or maybe for an online store (by the way, I think it would be really great to have an example about how to use Stripe, or some other payment service, as well), etc.

Are you talking about the extended type password? In fact we support pass.

Get started with Dgraph 1

That’s the one, not sure how I missed it… but about that… does that mean there’s no need to hash the password with bcrypt or something before saving it to Dgraph if the password type is used?

Thanks a lot :slight_smile:

I’ve almost completely transformed the features of this kit here

Even Auth of it working perfectly just with Dgraph. I did to test and it worked. But I need to organize it in a didactic way.

In fact the team are engaged in a full Login feature. I’m just not sure if Social will be supported. But sure it will be a complete Auth.

However, you can do a very good system with what Dgraph already have.

Precisely. There is no need. Even in the example I made with the Kit I completely cut off the use of bcrypt.

PS. And you can use the concept of Schema “pass” for other purposes. Such as “PIN”, “simple Cookie”, “Validating e-mail system” or something similar.

How I told Jack. What I did in the Kit can serve as an example for you. But the video will be very informal and in JS (I have zero exp in Go, but every dgraph concept is iqual and would work for any language). Once the video passes the idea I believe that you all can already go forward in your own solutions.

The kit uses SQLite. So the ideia is transform SQLite into Dgraph queries and mutations.

Sounds great, I’ll keep an eye out for the video… thanks a lot :slight_smile:

1 Like

Will you use the dgraph-js package in node?

Yeah, that kit uses NodeJS, TypeScript, GraphQL and SQLite. I did with dgraph-js;

Thank you all for your replies. I am still tempted to try the REST interface with Julia but will most likely end up using Go since this is my first attempt to use Dgraph for a production project and I try to avoid as many potential problems as possible.
I’m looking forward to the video as I’m sure it can provide useful pointers even if it’s made for JS.

Did you publish this video? I’d like to see an example of how to store Stripe transaction data, and keep track of which users have purchased which items. This is obvious to me when thinking about how I would store this data in relational tables, but being new to graph databases, mentally converting this into predicates, edges and nodes is challenging!

Not on this topic, I know it is a lot of time. But I have focussed the major part of my time helping others here in the community. I have created 2 or 3 with other topics and edited a bunch of tutorials. We will keep feeding the channel with new content. Check the actual playlist

1 Like