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

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

问题描述

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

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

我是第一次尝试使用 firebase.我想使用 firebase、React 和 Next 构建一个小型电子商务 web 应用程序.我想将应用程序拆分为两个不同的应用程序:一个管理应用程序(用于创建产品和执行其他管理工作)和实际的商店应用程序.应用程序应该托管在两个不同的域上,但它们应该与同一个云防火墙通信.

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.

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

推荐答案

你不需要做任何特别的事情.每个应用程序(移动、网络等)都连接到一个 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天全站免登陆