DEV Community

Cover image for If you were going to build a chat app with Node and GraphQL?
Caleb Adepitan
Caleb Adepitan

Posted on

If you were going to build a chat app with Node and GraphQL?

I've been wondering and now I'm tired of wandering. So I'm going to ask this here, openly.

If you were going to build a chat application with Javascript (server-side, client-side) and GraphQL, what other tech stack will you use?
What database?
How will you speak to your database from your resolvers (I mean, is it with drivers or ORM, and please name the ORM or ORM-like tech)?

Your opinions are appreciated 🙏

Top comments (6)

Collapse
 
ducdev profile image
Duc Le • Edited

A chat app requires a real-time responding and I would bet in websocket.
However, apollo graphql can cover this with its subscriptions and it's a right choice.

If you're going to work with an independent mongoDB instance, let's start with mongoose.
I can name another one is prisma.io
Have a look!

Collapse
 
calebpitan profile image
Caleb Adepitan

Thanks very much.
I currently use prisma.io and yes I know websocket is a vital tool for chat apps.

I just got a feeling there may be some other tool better than prisma. Why I feel this way is because, I write my graphql schema to take input types that fits into the Prisma CRUD API.
I feel this is a bad approach because, if anything changes in the future with Prisma's API, I will need to reflect it in my schema right away. This kind of dependency is what scares me.
Navigating through Prisma's source to check type so I can reflect similar types in graphql schema—thank God there's Typescript

Collapse
 
martineboh profile image
Martin Eboh

MeteorJS fits everything these days. Scalable realtime features by default using Mongo collections and redis-oplog to scale to millions. Supports React, Vue, Blaze, Svelte, Angular and works with GraphQL.

Thread Thread
 
calebpitan profile image
Caleb Adepitan

Thanks so much.
I should probably look at Meteor

Collapse
 
pieterbergwerff profile image
Pieter Bergwerff

A option for real-time communication could be peer.js, it works with WebRTC peer-to-peer data without sending chat data through a server. In other words, you don't store the chat data, but only provide the connection between users.

But if you want to store all chat data than I personally prefer mysql. I do not know for sure if, for example, chat data better be stored in a nosql database.

Success!

Collapse
 
calebpitan profile image
Caleb Adepitan

Thanks so much, I will check peer.js.
I never knew WebRTC never goes through the server, that makes it unlike Websocket.
But for chat data I'm using PostgreSQL. I love to leverage upon "relational" in RDBMS. I prefer it to NoSQL/Document DB, too