7 months ago
I've never tried Firebase until now...
Firebase lets you build apps without managing your own infrastructure. It's "infrastructure as a service", providing:
This helps you build an MVP quickly, relying on Google's infrastructure to scale.
The downside is that they might have limited features/functionality, compared to a custom infrastructure — and once you're building on it, you're kinda locked in.
Specific modules we need to care about:
Also has, or integrates with:
An interesting thing about the Firebase documentation is that you're not discouraged from exposing your apiKey in the browser client code, because on the backend, you whitelist Firebase API access from only specific domains (localhost, yourdomain.com, etc.) — this isn't the most secure thing to do, but because it's just for Auth, it's fine.
There are also 3 types of storage:
Data is synced across all clients in realtime, and remains available when your app goes offline.
Unlike Firestore, it's just one large JSON tree, and is harder to organize at scale.
Like Realtime Database, keeps your data in sync across apps through realtime listeners, with offline support. NoSQL. Key=string. Value=JSON, organized in collections.
It improves on the successes of the Realtime Database with a new, more intuitive data model. Cloud Firestore also features richer, faster queries and scales better than the Realtime Database.
Documents within the same collection can all contain different fields or store different types of data in those fields. However, it's a good idea to use the same fields and data types across multiple documents, so that you can query the documents more easily.
var alovelaceDocumentRef = db.collection('users').doc('alovelace');
Sub-collections: You can create a subcollection called "messages" for every room document in your "rooms" collection. You can nest data up to 100 levels deep.
var messageRef = db.collection('rooms').doc('roomA') .collection('messages').doc('message1');
Less of a database, more like Amazon S3: store and serve user-generated content, such as photos or videos.