如果您要开发移动应用或移动 Web 应用,则应使用 Cloud Run functions for Firebase。Firebase 为移动应用开发者提供了一系列完整的以移动为中心的全托管式服务,包括 Analytics、Authentication 和 Realtime Database。Cloud Run functions 使得该产品更加完善,让您可以通过添加服务器端代码来扩展和关联 Firebase 功能的行为。
Firebase 开发者可以轻松集成外部服务,以处理付款和发送短信等操作。此外,开发者还可以添加过于庞大而不适合在移动设备上处理的自定义逻辑,或者需要在服务器上进行安全保护的自定义逻辑。详细了解典型的集成使用场景。开发者如果需要功能更全面的后端,则可借由 Cloud Run functions 使用 Google Cloud 中的强大功能。
Cloud Run functions for Firebase 针对 Firebase 开发者进行了优化:
开发者可以通过以 Cloud Run functions 函数的形式编写代码来关联和扩展 Google Cloud 服务。您可将 Cloud Run functions 用作连接层,从而通过监听并响应事件来构建各 Google Cloud 服务之间的逻辑。只需几行代码,开发者就可以使用 Google Cloud 服务实现更丰富的用途,创建更高级别的组合,而无需预配或管理服务器。如需了解详情,请参阅 Google Cloud Run functions 文档。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-22。"],[[["\u003cp\u003eCloud Run functions offer a serverless compute solution for creating event-driven applications, jointly developed by Google Cloud and Firebase teams.\u003c/p\u003e\n"],["\u003cp\u003eFor Google Cloud developers, Cloud Run functions act as a connective layer to orchestrate logic between various Google Cloud services by responding to events.\u003c/p\u003e\n"],["\u003cp\u003eFirebase developers can use Cloud Run functions for Firebase to enhance Firebase features by adding server-side code and integrating with external services.\u003c/p\u003e\n"],["\u003cp\u003eBoth Cloud Run solutions offer a fully managed environment for executing functions, eliminating the need for server management or infrastructure provisioning.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run functions for Firebase is specifically tailored for mobile app developers, offering Firebase SDK, console and CLI integration, and triggers for Realtime Database, Authentication, and Analytics.\u003c/p\u003e\n"]]],[],null,["# Cloud Run functions and Firebase\n================================\n\nCloud Run functions is Google's serverless compute solution for creating\nevent-driven applications. It is a joint product between the Google Cloud team\nand the Firebase team.\n\nFor **Google Cloud developers**, Cloud Run functions serve as a connective layer\nallowing you to weave logic between Google Cloud services by\nlistening for and responding to events.\n\nFor **Firebase developers** ,\n[Cloud Run functions for Firebase](https://firebase.google.com/docs/functions/)\nprovides a way to extend the behavior of Firebase and integrate Firebase\nfeatures through the addition of server-side code.\n\nBoth solutions provide fast and reliable execution of functions in a fully\nmanaged environment where there's no need for you to worry about managing any\nservers or provisioning any infrastructure.\n\nCloud Run functions for Firebase\n--------------------------------\n\nYou should use Cloud Run functions for Firebase if you're a developer building a\nmobile app or mobile web app. Firebase gives mobile developers access to a\ncomplete range of fully managed mobile-centric services including analytics,\nauthentication and Realtime Database. Cloud Run functions rounds out the offering\nby providing a way to extend and connect the behavior of Firebase features\nthrough the addition of server-side code.\n\nFirebase developers can integrate with external services for tasks like\nprocessing payments and sending SMS messages. Also, developers can include\ncustom logic that is either too heavyweight for a mobile device, or\nwhich needs to be secured on a server. See\nto learn more about typical integration use cases.\nFor developers that need a more full-featured backend, Cloud Run functions\nprovides a gateway to the powerful capabilities in\n[Google Cloud](https://cloud.google.com/docs/).\n\nCloud Run functions for Firebase is optimized for Firebase developers:\n\n- Firebase SDK to configure your functions through code\n- Integrated with Firebase Console and Firebase CLI\n- The same triggers as Cloud Run functions, plus Firebase Realtime Database, Firebase Authentication, and Firebase Analytics triggers\n\nCloud Run functions for Google Cloud\n------------------------------------\n\nDevelopers can connect and extend Google Cloud services by writing code in the form of a\nCloud Run function. Cloud Run functions serve as a connective layer allowing you to\nweave logic between Google Cloud services by listening for and responding to events. With\njust a few lines of code, developers can enrich their use of Google Cloud services to\ncreate higher level combinations without needing to provision or manage servers.\nSee the [Cloud Run functions\ndocumentation](/functions/1stgendocs) for more information."]]