Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

triggerfinger12

Well-Known Member
Apr 17, 2017
255
457
89
Rock
53 I think I did most of the stuff to allow my rp tracker project to run on firebase. (Which is an awesome technology)

Now, I need to redesign how I store data as firestore (the database) is lacking some features that I'm used to. Mainly, the ability to use SQL.
This means, no join and also no where's with OR logic.

For those that have no idea what I mean with that.
A where statement in sql is a way to filter data. For example getting every city that starts with an "A". Using the OR statement its possible to expand it and also get every city that starts with an "E".

A join is important as it allows you to combine various sets of data. In my project it allows me to easily combine characters with their creator.
Now, unlike my old database I don't have to store everything as a flat list. However, there is a limit on how big stuff can get. As such, I don't think making use of that solves my problems.
55. Is it worth the extra effort?
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
55. Is it worth the extra effort?
56 yes.

It was a good idea already to rewrite the old parts for various reasons and firestore has some really nice features.

The biggest reason to use firestore is that totally eliminates the need for the web socket server.
Alerts can just become an collection and the client subscribes to changes in this collection that have to do with the current user id.

A simple query like firebase.col("alerts").where("users."+userId,"==",true).onSnaptshot({some function here that deals with the changes}) is enough.

Making alerts also has become simpler, as I can use a similar method on the backend to trigger whenever changes to the database are made. Before this I would have to manually write code everywhere where I made changes to the database to let the websocket server know. Additionally, if the websocket server was unavailable while the normal server was not, no alerts could be made. This meant that I couldn't use the alert system as a log for what happened. Now however its impossible for one to work without the other as they are the same system.

As a nice bonus, I can use this same technique on EVERY page. Meaning that I can make every page automatically update whenever changes occur for that page. This is something that was flat out impossible previously.

And these are just the benefits from switching to the database provided by firebase bring. However, firebase has some other nice features.

Authentication -> 0auth is pretty much build in. I currently have google and normal email/password login working. Getting other providers working is just 1 line of code + an api key away from being implemented.

Storage -> using firebase gives me easy access to googles cloud. As such, allowing people to SAFELY upload files is a lot easier than before. This means that I probably will add code to allow people to upload images of their characters. However, I will add code to limit this as it is something that will cost me money.

Other stuff that I may not use -> It includes libraries for A/B testing, machine learning, various monitoring tools and other stuff. I probably don't need most of it though but still, its nice to have if I do.

Costs -> Firebase has a free plan which comes with https. The chances that I would find something for free that I could use the old system on are slim as I needed lua to be installed and a library to work with it.
For firebase the "backend" is javascript. Meaning I don't need to have lua installed but ship it with the server.
 

triggerfinger12

Well-Known Member
Apr 17, 2017
255
457
89
Rock
55. I used to like fishing with my dad on the family boat (we shared ownership with his siblings) every year or so. My favorite part was when we went fast on choppy water and the boat bounced up and down! Sadly we are no longer able to go fishing... hopefully we can do it again in the future though!
 
  • Like
Reactions: GamerwithnoGame

duckfan77

Popular Member
Mar 18, 2013
80
683
118
55 I don't enjoy fishing, but just going out on the lake can be fun. If you don't like bouncing, then a Jet Ski might not be for you.
 

triggerfinger12

Well-Known Member
Apr 17, 2017
255
457
89
Rock
54. Two of my brothers have really high fevers today :( They are currently at the hospital and the doctors were talking about having one on IV, he looked really sick like he was wasting away before our eyes :( I hope he gets well soon!