In my last post, I wrote about Google's Firebase services, in particular the realtime database service. In this post, I'll be going through the process of creating a Firebase database which I will be populating with some existing JSON data in the next post. In a future post (or posts), I will then be querying this database from a small C# application to simply list all of the data in the database in a console window. Once this application is working, the fundamentals for connecting to Firebase should become clear and the bulk of the code in the C# application can be re-used in future C# applications, e.g. in a UWP or Web API project. To begin with, a Google account is essential to avail of the Firebase services. Once logged in to a Google account in your browser, navigate to firebase.google.com/. This link will bring you to the main Firebase portal and from here you can access your own personal Firebase console by clicking the GO TO CONSOLE button in the top right of the page, as shown in the image below. If this is your first time accessing Firebase, you may be required to accept the term and conditions for usage of the services. Once at the console, you will be presented with a page similar to the one in the image below. Once at the console, a project must be created before you can begin using the Firebase services. This is fairly self explanatory, so just click Add Project and a popup will be displayed asking for a project name and the country or region in which you are based. Enter a sensible project name here. For the purposes of this post, I am going to use 'my-first-firebase' and select Ireland as the country. You will now be brought to the actual console for this project, which can be seen in the image on the right. There are a number of options in the left hand sidebar and the one we are interested in is the Database one. Click on the Database option and when given the option between Realtime Database or Cloud Firestore, click Get Started under Realtime Database, show in the image below. Your database will now be created and you will be shown the current state of the database, along with the database unique URL and name. I have masked the unique ID of the database in the last image which is probably not necessary, but it can be seen that the database is empty (null) and ready to be used. In the next post, I will be populating this database with some existing JSON data which I have used in a small personal project. The data contains a number of fields per record but it is of a flat structure with no relations. The data also contains an imgur link for each image and I may use this in future if I have the time to create a webapp which also connects to this Firebase data.
Hopefully in the next few posts I will be connecting to this database with a C# console application, querying all of the records from the database and listing each record and its fields in the console.
0 Comments
Images taken from firebase.google.com/ Google's Firebase service at firebase.google.com/ allows application developers to quickly and easily integrate a data service into their apps without worrying about managing any of the infrastructure involved with traditional solutions such as MySQL database servers and a related backend solution.
Firebase makes this a breeze by providing a simple and easy to use way of managing your data from its cloud service. Connecting to this data is also made quite simple by the easy to follow setup guides for a number of common uses: webapps, Android apps and iOS apps. While these are the main platforms intended for use with Firebase, it is possible to connect other languages but a little more knowledge may be required on the part of the developer. Firebase is not only a database solution, it also offers services such as authentication, analytics, file storage, predictive technology, advertising, cloud messaging and more. In the context of this series of posts, however, I will be focusing on the database service and may touch on the authentication service briefly. Google offers Firebase as a three tiered service - a free plan called Spark, a fixed price plan called Flame and a pay as you go plan called Blaze. Comparing the plans, there is good value offered but I will be focusing on the free plan since most developers will, of course, be testing the services offered before committing to any expense. The free Spark plan is available to anyone with Google account and it offers a generous 10GB/month of data transfer along with 1GB of storage and 100 simultaneous connections. This would be plenty of data for a small, well designed application with a modest user base. Of course, if your app becomes successful enough and you need to support up to 100,000 connections , the $25/month upgrade to the Flame plan may not be too much of an issue. If your needs exceed this, the pay as you go Blaze plan may also be required but at this point, it may be worth considering different options from other providers for certain services, or even a custom backend solution. While the storage is generally quite small, a well developed app would not need such storage and it is always worth looking at other options. For example, if you need to store a lot of images, it may be worth thinking about storing and retrieving these images from another provider. In the case of a non-critical, personal or fun application, imgur.com may be enough for your needs, although reliability may be an issue from time to time. In the next post in this series, I will be looking at actually getting access to Firebase from a Google account and then creating a small database from some existing JSON data. |
Author
2nd Year B.Sc. Software Development Archives
December 2017
Categories |