FirebaseLuau | Firestore RESTful API Wrapper

External Media

:mag_right: Source Code | :scroll: Documentation

FirebaseLuau

FirebaseLuau is a promise-based RESTful API wrapper for
accessing Firebase services from within your Roblox experience.

Currently, it only supports RESTful access to Firestore; however, in the future, we might add support for other Firebase services such as Realtime Database, although a wrapper already exists for this service.

You might be asking why would should you use this over a service like Firebase’s Real-time Database. My answer to you is simple: Firestore is cost-effective (lower rates than RTDB) and much more scalable compared to RTDB. In the end, it is up to you to make a decision.

Limitations

Before we go into scenarios where this module could come in handy, you must know the limitations of this service.

You will need a Google account to be able to use this service.

There are no limits to how many documents you can create within your Firestore.
Unless you are advanced in serializing/compressing your data, we do not suggest that you use this to store large world/placement data, rather player data, due to the smaller limit in size for entries.

Personally, we recommend that you do not use this as your main database, but to backup player data, unless you are very capable of maintaining it. This is NOT a replacement for Data Stores.

Free Tier

The Firestore free tier plan includes:
  • 1 GiB max stored data
  • 1 MB max per document (entry)
  • 10 GiB/month network egress
  • 20,000 writes/day
  • 50,000 reads/day
  • 20,000 deletes/day

Upgradable Tier

Scalable options, pay as you go:
  • $0.18 per GiB for stored data after 1 GB
  • 1 MB max per document (entry, not upgradable!)
  • Network egress pricing depends on the region where traffic is being sent to from Google’s network
  • $0.18 per 100,000 writes/month after 600,000/month
  • $0.06 per 100,000 reads/month after 1,500,000/month
  • $0.02 per 100,000 deletes/month after 600,000/month

Pricing

For a better look at estimated pricing for your preferred usage, use Firebase's pricing calculator.

Setup

First and foremost, you will need to create a Firebase project, create your Firestore Database, and retrieve your API Key & authentication parameters. This video will guide you through this step of the setup.

Next, you will want to import the wrapper into your game either through the source code listed above or with the module on Roblox.

Finally, you will require and authenticate the API using your API Key, Email, and Password that you created, as shown in the tutorial video. To do this:
local Firebase = require(PATH_TO_FIREBASELUAU)
local firebase = Firebase.init({
    ProjectId = "PROJECT_ID",
    APIKey = "WEB_API_KEY",
    Email = "EMAIL",
    Password = "PASSWORD"
})

Usage can be found in the documentation listed above.

Credits

9 Likes

Fixed post formatting, sorry about that.