More Databases Inside One Firebase Project

In the new console in the Firebase project, in the Project Settings section of the Database tab , there is a Databases shortcut.

However, I did not find any action to create more than one database within a single Firebase project.

Is it possible to create more databases within a single Firebase project?

enter image description here

+6
source share
2 answers

Multi-database is a new feature that allows you to create multiple database instances.

To get started, you need to be in the Blaze plan. In the data viewer, you can click the triple point icon to create new database instances:

enter image description here

To access data from a secondary instance, you use an absolute URL when creating the database instance.

const app = firebase.initializeApp({ // use your main config databaseUrl: "https://multi-db.firebaseio.com/" }); const db1 = app.database(); // This is the default DB const db2 = app.database("https://multi-db501c7.firebaseio.com/"); 

Because these databases are in the same project, they use the same authentication session.

Each database instance also has its own set of security rules, and databases can handle different structures.

+3
source

Currently, you can only have one database for each project. You can create several projects, each with its own instance of the database, and use them in one application, but you need to create a separate instance of FirebaseApp (FIRApp on iOS) in your code for each database.

+5
source

All Articles