The Firebase Realtime Database is Google's original NoSQL cloud database, predating Firestore โ the entire dataset lives as one large JSON tree that syncs live to every connected client. It ties for around #14 in real-world database usage (roughly 5% share), still used where a simple, low-latency JSON sync is all an app needs.
Instead of collections and documents, everything is one big nested JSON object, referenced by path:
import { getDatabase, ref, set, onValue } from 'firebase/database'
const db = getDatabase();
// write data at a specific path in the JSON tree
set(ref(db, 'rooms/room1/messages/msg1'), {
text: 'hey there',
sender: 'ada'
});
// listen for live changes at that path
onValue(ref(db, 'rooms/room1/messages'), (snapshot) => {
console.log(snapshot.val());
});
Enable the Realtime Database from the Firebase console on a project, then connect with the Firebase SDK:
# install the Firebase SDK
npm install firebase
# then point initializeApp() at your project's databaseURL from the console