10

This is intentionally a very broad question. Sorry about that.

I'm experimenting with firebase for the first time. I would like to build a little e-commerce webapp using firebase, React and Next. I would like to split the App in two different apps: one admin app (used to create products and do other admin stuff) and the actual shop app. The Apps should be hosted on two different domains but they should talk to the same cloud firestore.

What would be a good setup to implement this architecture? Currently I am thinking about creating separate firebase projects for the admin and the shop app so I can host them on different domains. The cloud firestore would live in the admin project together with all admin related cloud functions etc. The shop app (or client app) would have its own project for hosting and would be connected to the firestore from the admin project.

Does that sound like a reasonable architecture or am I completely on the wrong path. Any suggestions are appreciated. And again sorry for the broadness of the question.

3
  • 1
    This sounds like you are adding a bunch of complexity for little reason. I would suggest looking into a single Firebase project that you map multiple domains onto.
    – abraham
    Apr 13, 2018 at 14:32
  • 1
    Ah, nice. I didn't know this was possible! I didn't find anything in the docs. Could you maybe point me to some resource that describes how to establish this. Thanks! Apr 13, 2018 at 14:43
  • 1
    @MartinReiche What approach have you chosen finally?
    – Ayyappa
    Apr 19, 2018 at 6:25

1 Answer 1

12

You don't need to do anything special. Each app (mobile, web,whatever) connects to a firebase instance/project. You can just set them all up to use the same firebase project (.plist file etc) and it will all work. The advantage of this design is that both admin and client access the same data, which presumably you need. (If you haven't found it, on the Firebase Console -> Settings -> Project Settings; add applications which will generate the appropriate credential files for each device type.)

Since you will have a shared/common authentication space, you may find that you want to add a flag/limitation to login so that only specified users can access the admin side. There's a few ways this can be accomplished.

4
  • Well, i guess I'm completely stupid :) Thank you very much for enlightening me :) Apr 13, 2018 at 15:12
  • 5
    Nope, not stupid. New to it and there's a lot of ground to cover. We've all been there! Good luck-
    – joelm
    Apr 13, 2018 at 20:17
  • 2
    What about iOS apps that have different BUNDLE_ID. Can 2 different iOS apps with different BUNDLE_ID still point to the same Firebase database? Apr 26, 2018 at 4:47
  • Firebase provides flexibility in configuration, have a read of firebase.google.com/docs/configure
    – Dom
    May 3, 2018 at 23:50

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.