Need a realtime database solution (for mobile)


#1

Hey,
I know this is not directly related to AdonisJS. Sorry for that. I just need some thoughts and ideas to get me started with this framework.

I’m making a social network app, and as I was writing the backend in Laravel I realized I might run into performance issues since I’m expecting thousands users (at least) and Laravel might not do the job since I believe It’s not meant for high-demand level purposes.

I was thinking about switching to Nodejs and I heard about AdonisJS and the fact that it’s very similar to Laravel it got me excited. I’m thinking about choosing a database solution and a way to have realtime data sync between my client app and the backend (for things like feeds, posts, notifications, chat, etc…)

Do you have any recommendations and ideas that could help me ? It’s my first time doing a project like this so I will be glad if someone could put me in the right direction, about the technology stack I should be using, and all that.

Thanks in advance.

(Extra details: client is a spa app, and the mobile version will be in cordova platform)


#2

I believe the best way is to use Websockets to push real time data. Now since you are more interested in architecture first, lemme share some simple rules ( I personally follow ) when building real time apps.

Websockets

Use websockets to push realtime notifications. Also never send too much data from websockets, just use it as a way to notify your client, so that it can ask for data using the normal REST API.

I see lot of people rely on realtime events to exchange data and this is worst thing, so many times, your websockets events can be out of order or may even slow down due to internet issues.

Build a proper REST API to get and set data and think of Websocket as a medium to tell the client on when to ask for new data from the REST API.

How to do this in Adonis?

I am re-writing the websocket layer from scratch, since the existing Websocket module doesn’t allow you to scale horizontally.

It will take around a month to push the final release of AdonisJs with websockets, so please take your decisions accordingly


#3

Thanks for the reply !

I heard about socket.io and I wonder how does the websocket you mentioned fare against libraries like that? Does it come with the keep-alive/http fallback or other features they talk about on their site or is that something we should implement by ourselves?