0

The question originally was:

How to create a new database instance upon user creation (per user)?

While I know that it isn't possible (yet), while I still think it is a good question - because, when looking at documentation alike Sharding and the Admin Database API, there is no way to create new Realtime Database instances through Cloud Functions, as one can do with the Firebase Console.

this is about, where I am stuck:

exports.admin_db_create = functions.database.ref('/db/{hookId}').onWrite(event => {
/* TODO: create a new database and assign the email address with the database. */
});

I've also found functions.database.instance, while this seems to return a reference to an existing database instance, but not creates one.

So let me rephrase the question:

What is the most reliable method for having isolated user-groups -

and how to harness Firebase Invites to invite into such a group?

I mean, so that a user could have his own "database" and invite his own team, without selling GSuite.

Community
  • 1
  • 1
Martin Zeitler
  • 1
  • 19
  • 155
  • 216

1 Answers1

0

There is no API to automatically create Firebase Realtime Database instances.

You'll either manually have to create a separate instance or project for each team, or separate them within a single database through security rules. If the separate teams are actually separate companies (based on your reference to GSuite), I'd highly recommend using separate Firebase projects for each of them,

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • currently I have security rules for one database - while creating countless databases in advance might be a workaround, but no practical solution. individual Firebase projects are impossible, because one cannot add the keys into an already built Android application package. the general issue is, that Firebase database "owners" might want to add/collaborate with off-domain people. merely asked this question, because with per-user (or per group owner) sharding would enable common real-world applications; with the GDPR policies, it would provide an easy way to grant the "right to be forgotten". – Martin Zeitler May 29 '18 at 09:55