Firebase Data Connect

Firebase's first relational database solution for developers who want to create secure and scalable apps with Cloud SQL for PostgreSQL and type-safe mobile and web SDKs. Learn more.

Firebase Data Connect is a relational database service for mobile and web apps that lets you build and scale using a fully-managed PostgreSQL database powered by Cloud SQL. It provides secure schema, query and mutation management using GraphQL technology that integrates well with Firebase Authentication. You can quickly integrate this product into your mobile and web apps with SDK support in Kotlin Android and web, and in the future, iOS.

Data Connect lets you declare your application's data model and the exact queries needed by your application. Using your data model we automatically create a PostgreSQL database schema to fit your data model, secure server endpoints that talk to the database, and type-safe SDKs for your client application that talk to the server endpoints. It's like a "self-driving app server" made-to-order for your specific application.

Pricing

Firebase Data Connect consists of two billable components, the Data Connect service itself, and the Cloud SQL for PostgreSQL instance that contains your project data.

If you accept the default configuration when you provision a Cloud SQL for PostgreSQL instance, you will be qualified for a 3 month free trial.

  • 5 free trials are available per billing account.
  • 1 free trial Cloud SQL for PostgreSQL instance per project, although you can have multiple non-free instances within that project.
  • There is no cost for the Data Connect service until the product enters public preview.
  • There is no cost for the default configuration of your Cloud SQL for PostgreSQL instance: 1 vCPU, 10 GB of storage, 628.74 MB of memory.

During the free trial, you can add computing resources to your Cloud SQL instance, set up a private IP for your instance, and create a read replica for your instance, at which point you will be billed according to Cloud SQL pricing.

Using Data Connect with Vertex AI will incur standard usage charges from Vertex AI for embedding generation.

Key capabilities

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.
Vector search Data Connect supports vector search for developers to build AI-powered applications.
Multiple platform SDKs Firebase Data Connect offers multi-platform SDKs, for Kotlin Android and web.
User-based authentication Data Connect supports end-user authentication, ensuring that only authorized users can access the data.
Visual Studio Code extension Offers easy schema development, and query and mutation management, directly from your Visual Studio Code editor using GraphQL.
Emulator Firebase Data Connect includes an emulator that lets you test your app with a local PostgreSQL installation without having to deploy to production.

How does it work?

The top-level resource for Firebase Data Connect is a service, which represents a managed GraphQL API that can be defined by developers and called by end users. Your schema is the app data model for a service, represented primarily as a collection of GraphQL source files, as well as specific configuration for attached datasources (such as Cloud SQL instances). There can be only one schema per service. Finally, your connectors are collections of queries and mutations that have been defined to operate against a service's schema. There can be many connectors per service (for instance if you have a "rider" app and a "driver" app for your rideshare company).

Your Data Connect schema maps explicitly to a specific underlying PostgreSQL database schema. Data Connect includes tooling to automatically generate the SQL DDL needed to perform schema migrations based on changes to the app schema. Based on your app schema, Data Connect automatically generates additional GraphQL schema to query and manipulate the data model.

Once your app schema is defined, you can write predefined queries and mutations that are executed to read and write data in the application. Data Connect queries and mutations are not submitted by client code and executed on the server. Instead, when deployed, these Data Connect operations are stored on the server, like Cloud Functions. This simplifies code management, and development of your client code. In privileged environments, like the Firebase console and using our Firebase VS Code extension, you can execute ad hoc operations with appropriate Google IAM credentials for administrative operations.

For client code, each supported platform has a core SDK that handles connecting to the backend, issuing requests, and processing responses. These SDKs are not schema-aware and must be supplied with operation names and variables as unstructured data. Each supported platform also has a generated SDK. As you define your data model and operations, tooling on your machine will automatically generate strongly-typed SDKs specific to the application. These SDKs will "wrap" the core SDKs for type safety, ergonomics, and other features such as data validation and more down the road.

Implementation path

Prototype your schema Prototype your database schema, including designs using vector types, starting in a local environment with tooling
Prototype your operations Build predefined query and mutation operations for client apps based on automatically-generated queries and mutations
Generate type-safe SDKs Generate and test type-safe SDKs from your schema and operations, then implement client-side code
Deploy schema and operations Deploy the schema and operations for your Firebase Data Connect service
Deploy clients Deploy your client code

Next steps

  • If you'd like to see the Firebase Data Connect development flow in action, read through the Get started guide.