Jahed Ahmed

Moving off Recompose: The Final Mile


Setting Up CORS for Firebase Storage

Firebase Storage needs CORS permissions set up if you ever want to use XHR or Fetch APIs in the browser to request files from it. However, this isn't easily available via Firebase's web interface. Instead, configuration needs to be done via the Google Cloud SDK and gsutil.


Weekly Report: 1st July 2019

Weekly Report is going to be a new series of blog posts giving an update of what I did in the current week. The aim is to share what I've done and also to help me appreciate and compare my acheivements.

While there will be FrontierNav-related updates in this series. They'll also contain unrelated updates related to my other projects. If you just want FrontierNav updates, you can wait for the monthly FrontierNav Progress Reports.


Creating a Community Forum for FrontierNav

One of the oldest feature requests for FrontierNav was to have a community forum. A place to ask questions and network with other users. I've finally decided to introduce this feature, albeit in a primitive state.


Why does FrontierNav need a forum?

FrontierNav's focus has mainly been to introduce interactive guides (e.g. maps) for games that aren't available on other websites. However, there are other ways FrontierNav can improve a user's experience. One of them is the question and answer flow.


Creating a Forum with Firebase

So you've decided to create a forum... using Firebase. Let's go through the entire process. This guide assumes you already have some knowledge using Firebase so it's mainly focused around modeling the data to work with Firebase's limited access controls.

Unlike traditional databases, Firebase's Real-time Database is accessed directly from the browser by users. This allows real-time push updates whenever the data changes without the user needing to manually reload.

Data is written individually by users. A user can attempt to write into the database, and the database can say who's allowed to write there and restrict the data with simple rules. For example, "a property can only be changed by User A and it must be a number".

However, due to the nature of Firebase, it cannot enforce complex rules. For example, "you can only add a new post if you haven't created a post in the last minute". This generally requires going through all posts for a given user and finding the timestamp of the most recent one. Not possible in Firebase.