DEV Community

Kaushik Varanasi
Kaushik Varanasi

Posted on

How to build the backend for the messaging app in minutes 🤯

Backend on Rocketgraph

Head over to the Hasura console. You can find it here on the 2nd tab in Rocketgraph:

Rocketgraph Hasura tab

use the password to login to the console. And head over to the data column and create the following columns:

Image description

Permissions

We have to add user permissions so that the users can view only their messages.

Head over to the permissions tab in messages and create a role called user. A user is a person's role who is logged in.

Create insert permissions as follows:

Image description

Notice the column presets. WE are letting Hasura to inject custom variables automatically into our columns, so we can use them later.

Next allow select over the messages as follows:

Image description

We are telling Hasura to only allow messages to the user if he is the sender or receiver of the message.

And save:

Image description

Top comments (0)