3.1 Data Modelling

This is the most important part of any application. In my case, since I am using Hasura which is a BaaS ( Backend as a Service) platform it becomes even more important.

This data modelling is in reference to the follow prototype:


topic, resource, votes, profile.



Schema made using Lucid Chart.



A topic will have many resources. Every resource will belong to one topic.


  • Since every resource will have a different url, I have made it as the Primary Key.
  • A resource will either have certification available or not so it’s a Boolean value(true or false).
  • Similarly it may be paid(cost=true) or free (cost=false).
  • Type of a resource may be video, book, blog or guide.
A Resource card.


  • One user can vote a resource only once, so a combination of ‘user_id’ and ‘resource’ is the primary key.
  • A user may upvote or downvote a resource, so the ‘value’ column will have either +1 or -1. This is implemented using a check constrain.


All the user details is captured using the Hasura auth service, so only a link to user_id is required.

Resource_info (View)

If you take a look at the above image of the resource card, you will find that all the details are in the ‘resource’ table except total votes. This view will calculate the sum of all the votes form the ‘votes’ table and store it as a view along with all the resource info.