Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Firebase Data Connect
plat_iosplat_androidplat_webplat_flutter
Giải pháp cơ sở dữ liệu quan hệ đầu tiên của Firebase dành cho những nhà phát triển muốn tạo ứng dụng an toàn và có thể mở rộng bằng Cloud SQL cho PostgreSQL và SDK web và thiết bị di động an toàn về kiểu. Tìm hiểu thêm.
Firebase Data Connect là một dịch vụ cơ sở dữ liệu quan hệ dành cho ứng dụng web và di động, cho phép bạn xây dựng và mở rộng quy mô bằng cách sử dụng cơ sở dữ liệu PostgreSQL được quản lý hoàn toàn do Cloud SQL cung cấp. Công cụ này cung cấp tính năng quản lý truy vấn, biến đổi và giản đồ an toàn bằng cách sử dụng công nghệ GraphQL tích hợp tốt với Firebase Authentication. Bạn có thể nhanh chóng tích hợp sản phẩm này vào ứng dụng web và di động nhờ tính năng hỗ trợ SDK trong Kotlin Android, iOS, Flutter và web.
Data Connect cho phép bạn khai báo mô hình dữ liệu của ứng dụng và các truy vấn chính xác mà ứng dụng của bạn cần. Khi sử dụng mô hình dữ liệu của bạn, chúng tôi sẽ tự động tạo một giản đồ cơ sở dữ liệu PostgreSQL phù hợp với mô hình dữ liệu, các điểm cuối máy chủ bảo mật giao tiếp với cơ sở dữ liệu và các SDK an toàn về loại cho ứng dụng khách giao tiếp với các điểm cuối máy chủ. Nó giống như một "máy chủ ứng dụng tự lái" được tạo theo yêu cầu cho ứng dụng cụ thể của bạn.
Các chức năng chính
Được hỗ trợ bởi Cloud SQL cho PostgreSQL
Hãy tin tưởng vào một dịch vụ cơ sở dữ liệu được quản lý hoàn toàn giúp bạn thiết lập, duy trì, quản lý và quản trị cơ sở dữ liệu quan hệ PostgreSQL trên Google Cloud.
Tìm kiếm vectơ
Data Connect hỗ trợ tính năng tìm kiếm vectơ để nhà phát triển có thể xây dựng các ứng dụng dựa trên AI.
SDK nhiều nền tảng
Firebase Data Connect cung cấp SDK đa nền tảng cho Kotlin Android, iOS, Flutter và web.
Xác thực dựa trên người dùng
Data Connect hỗ trợ xác thực người dùng cuối, đảm bảo rằng chỉ những người dùng được uỷ quyền mới có thể truy cập vào dữ liệu.
Tiện ích Visual Studio Code
Cung cấp tính năng phát triển giản đồ, quản lý truy vấn và đột biến ngay trong trình chỉnh sửa Visual Studio Code bằng GraphQL.
Trình mô phỏng
Firebase Data Connect bao gồm một trình mô phỏng cho phép bạn kiểm thử ứng dụng bằng cơ sở dữ liệu cục bộ mà không cần triển khai sang môi trường phát hành công khai.
Trợ lý AI của Gemini trong Firebase
Sử dụng Gemini trong Firebase để tạo truy vấn và đột biến theo yêu cầu bằng ngôn ngữ tự nhiên và kiểm thử trực tiếp các truy vấn và đột biến đó trong bảng điều khiển Firebase. Tìm hiểu thêm tại bài viết Sử dụng AI assistance for Data Connect cho các truy vấn và đột biến.
Tính năng này hoạt động như thế nào?
Tài nguyên cấp cao nhất cho Firebase Data Connect là một dịch vụ, đại diện cho một API GraphQL được quản lý mà nhà phát triển có thể xác định và người dùng cuối có thể gọi. Giản đồ là mô hình dữ liệu ứng dụng cho một dịch vụ, được biểu thị chủ yếu dưới dạng một tập hợp các tệp nguồn GraphQL, cũng như cấu hình cụ thể cho các nguồn dữ liệu đính kèm (chẳng hạn như các phiên bản Cloud SQL). Mỗi dịch vụ chỉ có thể có một giản đồ. Cuối cùng, trình kết nối là tập hợp các truy vấn và đột biến đã được xác định để hoạt động theo giản đồ của dịch vụ. Có thể có nhiều trình kết nối cho mỗi dịch vụ (ví dụ: nếu bạn có ứng dụng "người đi xe" và ứng dụng "tài xế" cho công ty đi chung xe).
Giản đồ Data Connect liên kết rõ ràng đến một giản đồ cơ sở dữ liệu PostgreSQL cơ bản cụ thể. Data Connect bao gồm các công cụ để tự động tạo DDL SQL cần thiết để di chuyển giản đồ dựa trên các thay đổi đối với giản đồ ứng dụng. Dựa trên giản đồ ứng dụng, Data Connect sẽ tự động tạo thêm giản đồ GraphQL để truy vấn và thao tác với mô hình dữ liệu.
Sau khi xác định giản đồ ứng dụng, bạn có thể viết các truy vấn và đột biến được xác định trước được thực thi để đọc và ghi dữ liệu trong ứng dụng.
Các truy vấn và đột biến Data Connect không được mã ứng dụng gửi và thực thi trên máy chủ. Thay vào đó, khi được triển khai, các thao tác Data Connect này sẽ được lưu trữ trên máy chủ, chẳng hạn như Hàm trên đám mây. Điều này giúp đơn giản hoá việc quản lý mã và phát triển mã ứng dụng. Trong các môi trường đặc quyền, chẳng hạn như bảng điều khiển Firebase và sử dụng tiện ích Data Connect VS Code, bạn có thể thực thi các thao tác đặc biệt bằng thông tin xác thực IAM của Google thích hợp cho các thao tác quản trị.
Đối với mã ứng dụng, mỗi nền tảng được hỗ trợ đều có một SDK cốt lõi xử lý việc kết nối với phần phụ trợ, đưa ra yêu cầu và xử lý phản hồi. Các SDK này không nhận biết được giản đồ và phải được cung cấp tên toán tử và biến dưới dạng dữ liệu không có cấu trúc. Mỗi nền tảng được hỗ trợ cũng có một SDK được tạo. Khi bạn xác định mô hình dữ liệu và các thao tác, công cụ trên máy sẽ tự động tạo các SDK được xác định kiểu mạnh dành riêng cho ứng dụng. Các SDK này sẽ "gói" các SDK cốt lõi để đảm bảo an toàn về kiểu, tính công thái học và các tính năng khác như xác thực dữ liệu, v.v.
Đường dẫn triển khai
Tạo nguyên mẫu giản đồ
Tạo bản mô hình cho giản đồ cơ sở dữ liệu, bao gồm cả các thiết kế sử dụng loại vectơ, bắt đầu trong môi trường cục bộ bằng công cụ
Tạo nguyên mẫu cho hoạt động
Tạo các thao tác truy vấn và đột biến được xác định trước cho ứng dụng khách dựa trên các truy vấn và đột biến được tạo tự động
Tạo SDK an toàn về kiểu
Tạo và kiểm thử SDK an toàn về loại từ giản đồ và hoạt động, sau đó triển khai mã phía máy khách
Triển khai giản đồ và hoạt động
Triển khai giản đồ và các thao tác cho dịch vụ Firebase Data Connect
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["Firebase Data Connect \nplat_ios plat_android plat_web plat_flutter \nFirebase's first relational database solution for\ndevelopers who want to create secure and scalable apps with Cloud SQL for\nPostgreSQL and type-safe mobile and web SDKs. [Learn more](https://firebase.google.com/products/data-connect).\n\nFirebase Data Connect is a relational database service for mobile and web\napps that lets you build and scale using a fully-managed PostgreSQL\ndatabase powered by Cloud SQL. It provides secure schema, query and\nmutation management using GraphQL technology that integrates well with\nFirebase Authentication. You can quickly integrate this product into your mobile and\nweb apps with SDK support in Kotlin Android, iOS, Flutter, and web.\n\nData Connect lets you declare your application's data model and the\nexact queries needed by your application. Using your data model we automatically\ncreate a PostgreSQL database schema to fit your data model, secure server\nendpoints that talk to the database, and type-safe SDKs for your client\napplication that talk to the server endpoints. It's like a \"self-driving app\nserver\" made-to-order for your specific application.\n\nKey capabilities\n\n|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Backed by Cloud SQL for PostgreSQL | Rely on a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud. |\n| Vector search | Data Connect supports vector search for developers to build AI-powered applications. |\n| Multiple platform SDKs | Firebase Data Connect offers multi-platform SDKs, for Kotlin Android, iOS, Flutter, and web. |\n| User-based authentication | Data Connect supports end-user authentication, ensuring that only authorized users can access the data. |\n| Visual Studio Code extension | Offers easy schema development, and query and mutation management, directly from your Visual Studio Code editor using GraphQL. |\n| Emulator | Firebase Data Connect includes an emulator that lets you test your app with a local database without having to deploy to production. |\n| AI assistance from Gemini in Firebase | Use Gemini in Firebase to generate queries and mutations on-demand using natural language and test them directly in the Firebase console. Learn more at [Use AI assistance for Data Connect for queries and mutations](/docs/data-connect/ai-assistance). |\n\nHow does it work?\n\nThe top-level resource for Firebase Data Connect is a *service* , which\nrepresents a managed GraphQL API that can be defined by developers and called by\nend users. Your *schema* is the app data model for a service, represented\nprimarily as a collection of GraphQL source files, as well as specific\nconfiguration for attached datasources (such as Cloud SQL instances). There can\nbe only one schema per service. Finally, your *connectors* are collections of\nqueries and mutations that have been defined to operate against a service's\nschema. There can be many connectors per service (for instance if you have a\n\"rider\" app and a \"driver\" app for your rideshare company).\n\nYour Data Connect schema maps explicitly to a specific underlying\nPostgreSQL database schema. Data Connect includes tooling to\nautomatically generate the SQL DDL needed to perform schema migrations based on\nchanges to the app schema. Based on your app schema, Data Connect\nautomatically generates additional GraphQL schema to query and manipulate the\ndata model.\n\nOnce your app schema is defined, you can write predefined queries and mutations\nthat are executed to read and write data in the application.\nData Connect queries and mutations are not submitted by client code\nand executed on the server. Instead, when deployed, these Data Connect\noperations are stored on the server, like Cloud Functions. This simplifies code\nmanagement, and development of your client code. In privileged environments,\nlike the Firebase console and using our Data Connect VS Code extension,\nyou can execute ad hoc operations with appropriate Google IAM credentials for\nadministrative operations.\n\nFor client code, each supported platform has a *core SDK* that handles\nconnecting to the backend, issuing requests, and processing responses. These\nSDKs are not schema-aware and must be supplied with operation names and\nvariables as unstructured data. Each supported platform also has a\n*generated SDK*. As you define your data model and operations, tooling on your\nmachine will automatically generate strongly-typed SDKs specific to the\napplication. These SDKs will \"wrap\" the core SDKs for type safety, ergonomics,\nand other features such as data validation and more down the road.\n\nImplementation path\n\n|---|------------------------------|-----------------------------------------------------------------------------------------------------------------------|\n| | Prototype your schema | Prototype your database schema, including designs using vector types, starting in a local environment with tooling |\n| | Prototype your operations | Build predefined query and mutation operations for client apps based on automatically-generated queries and mutations |\n| | Generate type-safe SDKs | Generate and test type-safe SDKs from your schema and operations, then implement client-side code |\n| | Deploy schema and operations | Deploy the schema and operations for your Firebase Data Connect service |\n| | Deploy clients | Deploy your client code |\n\nNext steps\n\n- Try out Data Connect right now: explore a quickstart app repository and build a fully-featured Data Connect app by following our [codelab for web](/codelabs/firebase-dataconnect-web), [codelab for iOS](/codelabs/firebase-dataconnect-ios), or [codelab for Android](/codelabs/firebase-dataconnect-android).\n- If you'd like to see the Firebase Data Connect development flow in action, read through the [Get started guide](/docs/data-connect/quickstart).\n- Learn about Data Connect [pricing and billing](/docs/data-connect/pricing)."]]