Why I’m dumping Firebase for Web
I love Firebase, I think it&#x27;s a great tool. I actually gave a talk about Firebase when I was an intern at Google in 2015. I&#x27;ve liked it for a while. I think it&#x27;s a simple model that actually lets you build most things very quickly and in a fun way (since it&#x27;s all real-time).<p>Here&#x27;s my response to some of your points<p><i>Only easy if you implement FirebaseAuthUI, which has a UI that is out of context and intolerable if you care about UX. Phone verification for example (albeit free, requires ugly ReCaptcha) and the AccountChooser (albeit great concept) opens in a completely Google design.</i><p>To me this is a completely acceptable security requirement. IIRC the account chooser has other related elements including accepting permissions and TBH I think there&#x27;s good reason that there&#x27;s a standard UX for auth stuff. It is a lot easier to just tell people, &quot;Only trust things on google.ca, and the UI should look like Google too&quot;, etc.<p><i>Social plugins change all the time and to use the most up to date (like this awesome “Continue as {{Name}}” button) you have to implement the providers’ own JavaScript and other necessities and do a lot of work to make them work together.</i><p>You have to do this using Web too. Firebase doesn&#x27;t make it harder.<p><i>You can’t easily add claims (groups, roles, feature toggles, etc.) to user’s json web token, meaning you have to create and supplement each authentication with a call to the Real-time database.</i><p>I actually like this feature request. I see it more like something that Firebase could add, but if they are trying to make it fit in with their db, it is kind of an unprecedented feature afaik, so I don&#x27;t really expect it.<p><i>Querying on anything beside a simple key lookup is a pain in the bum. Somewhere, someone understands how indexing, pagination and multi-filtering works but I’ve given up. Don’t forget you do all of this client-side (JavaScript).</i><p>Indexing happens on the server side. It&#x27;s actually extremely powerful. You just have to start with the question: What data do I want to show to the user when it&#x27;s done? You make the entity ids of that data the value of an object in FB. Then you set up a listener that<p>1. Listens to all other relevant parts of the tree in real-time
2. Does some calculation on the values it retrieves
3. Saves a new key [ computed_value : entity_id ]<p>Then, you simply query for the top x keys, getting your entity ids, and in your UI you just instantiate your component to load the data for the entity in its own query real-time. It is fast enough to build nice UI&#x27;s, that&#x27;s why people win hackathons with it.<p><i>Firebase returns data as “snapshot”, a very weird, encoded structure that is not easily iterative. You have to navigate between forEach, snapshot.key and snapshot.val() to get what you want. I thought that’s the whole point of using JSON.</i><p>Snapshots are for things like user profiles where you actually just want to get the object at the given path (i.e. want to retrieve {&quot;name&quot;:&quot;mluggy7&quot;} from &#x2F;users&#x2F;1).<p>If you want to iterate things, you should be using the `on` query: <a href="https:&#x2F;&#x2F;firebase.google.com&#x2F;docs&#x2F;reference&#x2F;js&#x2F;firebase.database.Query#on" rel="nofollow">https:&#x2F;&#x2F;firebase.google.com&#x2F;docs&#x2F;reference&#x2F;js&#x2F;firebase.datab...</a><p>The way it works is that it it treats an object like an array of data, where the order of the array is the order of the keys in the object. It calls your callback if data is added to the array, moved around in the array, deleted from the array, or changed (but kept in the same position). You can use these callbacks to manage some internal array state where you&#x27;re holding components that are initialized with the data items.<p><i>Write errors are a pain to debug, even with debugging enabled ends up as JavaScript “permission denied” with no way knowing. You have to run your payload against the simulator to get the firebase rule line you had tripped on.</i><p>You only have to learn this once :p<p><i>There’s no easy way to cache data, especially fragments that requires high computation. Why would a call to the same unchanged node by the same user not return from cache?</i><p>Not sure what you mean by computation, and I&#x27;m not sure why you&#x27;d need caching since the protocol just sends diffs of what has changed. The real-time db is the cache. You do your computations and save them in the real-time db. You can make it O(1) to search an object in both keys and values using indices, JS doesn&#x27;t even really have that data structure.<p><i>REST interface will not use the signed-in user’s credential. You have to pass it as a token (which is just weird, especially if you planned to build a simple CRUD on top of firebase serverless REST paths)</i><p>You have to have a token, the firebase API has a token too but it manages it internally. If you use a Firebase REST SDK (of which there are many for many languages) then it will probably manage the token for you and just give you API methods to call for REST functions.<p><i>Firebase-admin is ignoring your database validation rules, who’s idea is that I have no clue but it caused me much grief.</i><p>Not sure what you mean here. You might be talking about an actual issue.<p>Cloud functions seems cool but I haven&#x27;t used it so I can&#x27;t comment.<p>(I&#x27;ve talked about Firebase on HN previously, for example [1]. I started using it at Hackathons in 2013-2015)<p>[1]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12117522" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12117522</a>