Firebase Real-time database with expertise
Firebase had provided us with many life saving tools and one of them is the Well-Known Firebase Real-time database. If you don’t know anything about Real-time database then check out this link. So lets carry on with our topic.
As you all know there are many usage served by real-time database and the best part is its JSON based database not a SQL one. One of the many usage is for chat purpose like we are using. But the problem is that we don’t emphasis on some points to make our life even easier while using Real-time database.
Points to Remember
- Structuring the database : While implementing Firebase database we generally forgot one point or probably the most important point Structuring the database. Our database is JSON based so here will be nesting and the more the nesting , more the time needed to access the data so maintaining a structure is as important as saving the data. The database should be structured so that the nesting will be less and depending upon the format of data you need like in my case I created an chat application with user messages and user details where user details shown on one page and on clicking one particular user, showing all the messages of that user . So I followed this structure
- Setting Permission: You can and should add necessary permissions to your database so that your database is safe and secure. Also it helps maintaining the authenticity of the data as no-one without permission can add data to your database.
- Connection with Firebase Authentication: You can add a permission so that only Firebase authenticated users can add/ access data in your database. There are plenty of methods for authentication even if you have your own server, then also you can try Password authentication (check here). There are even Social logins available. You can use these methods to create a Firebase User and then providing access according to that.
So these are the points may be there are more which I hadn’t cover be sure to comment them if you find one. With Firebase database we can achieve so much more but we have to be sure to remember some points to make it secure and futuristic.
. . .