Firebase:将多个应用程序连接到单个Firestore [英] Firebase: multiple Apps connected to single firestore

查看:66
本文介绍了Firebase:将多个应用程序连接到单个Firestore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这故意是一个非常广泛的问题.抱歉.

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

我第一次尝试使用Firebase.我想使用Firebase,React和Next构建一个小的电子商务Webapp.我想将应用程序分为两个不同的应用程序:一个管理应用程序(用于创建产品和执行其他管理工作)和实际的商店应用程序.这些应用程序应托管在两个不同的域上,但它们应与同一云Firestore对话.

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.

什么是实现此体系结构的良好设置?目前,我正在考虑为管理员和shop应用创建单独的firebase项目,以便可以将它们托管在不同的域中.云存储库将与所有与管理相关的云功能等一起存在于admin项目中.shop应用程序(或客户端应用程序)将拥有自己的托管项目,并从admin项目连接到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.

推荐答案

您无需执行任何特殊操作.每个应用程序(移动设备,Web应用程序或其他应用程序)均连接到Firebase实例/项目.您可以将它们全部设置为使用相同的Firebase项目(.plist文件等),并且都可以使用.这种设计的优点是管理员和客户端都可以访问相同的数据,这大概是您需要的. (如果找不到,请在Firebase控制台->设置->项目设置上;添加将为每种设备类型生成适当凭证文件的应用程序.)

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.

这篇关于Firebase:将多个应用程序连接到单个Firestore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆