Data Connect is now generally available!

At Google I/O 2024, we announced Firebase Data Connect and last October, it went into public preview. After a long road of ideating, implementing, and listening to your feedback and feature requests, we’re now excited to announce that Data Connect is now generally available!

Data Connect is a backend-as-a-service powered by a Cloud SQL Postgres database that’s high performance, scalable, and secure. You provide your app’s data model through a GraphQL-based schema, and Data Connect creates secure endpoints and typesafe SDKs to access your data. You’ll also define how to access and update data, and Data Connect does the rest for you - no need to define your own resolvers which is necessary in GraphQL services.

You can build rich queries with relational joins, complex conditions, and even semantic vector search that are as secure as hand-coded server endpoints. Vector search and an integration with Vertex AI enables out-of-the-box RAG (retrieval augmented generation) flows. Also, just like the rest of the Firebase ecosystem, Data Connect is well-integrated with other Firebase services like Firebase Auth.

Our team has been hard at work creating additional features and in this blog post, we’ll cover a few of those below:

  • Gemini in Firebase for schema design in the Firebase console
  • More query and mutation features
  • Support for connecting to existing Cloud SQL databases
  • Newly supported web frameworks: Angular and React
  • New Android and iOS codelabs
  • Pricing updates

Gemini code assist

Before, you could already use Gemini in Firebase to write queries and mutations for your app. Now, you can use it to write your schemas! Tell Gemini what you would like to build, and it writes the schemas for you. You can use this new feature in the Firebase console.

More Query and Mutation Features

Aggregate Fields

When you have a lot of data, you might need to perform calculations on a list of results. Aggregate fields let you do so, and for each field in your type, Data Connect generates corresponding aggregate fields depending on the field type.

Data Connect supports the following aggregations:

  • _count: returns the number of rows that match your query
  • All fields have a <field>_count field, which counts how many rows have a non-null value in that field
  • Numeric fields (int, float, int64) have <field>_min, <field>_max, <field>_sum, and <field>_avg
  • Date and timestamp fields have <field>_min and <field>_max.
  • distinct argument: get all unique values for a field (or combo of fields). You can also use distinct on aggregate fields to instead aggregate the distinct values.
  • Grouped aggregates: selecting a mix of aggregate and non-aggregate fields results in aggregate results grouped by the non-aggregate fields. where and having arguments return only groups that meet the provided criteria. where lets you filter rows based on non-aggregate fields and having lets you filter groups by aggregate fields.

To learn more about aggregate fields and see examples, check out the documentation.

Atomic Data Modifications

To ensure data consistency and prevent race conditions - especially in collaborative or high-traffic applications, Data Connect now has atomic operations that let you manage counters, lists, and other data structures:

  • inc increments the field by the specified amount.
  • dec decrements the field by the specified amount.
  • append adds to the end of a list.
  • prepend adds to the start of a list.

To learn more about atomic data modifications and see examples, check out the documentation.

Connect to Existing Cloud SQL Databases

We know that you might already be using Cloud SQL databases. Now through the Firebase CLI, you can connect existing Cloud SQL databases to Data Connect.

To do so, you can either:

  • give Data Connect control over the database to run migrations
  • connect in brownfield mode, in which you need to apply SQL changes yourself, then use the CLI to deploy the connector

In both cases, you write the corresponding GraphQL schema and implement the operations for your connector. In other words, Data Connect doesn’t create GraphQL from your existing database.

To learn more, check out the documentation.

Angular and React Support

As you design the schemas, queries, and mutations and deploy them to the Data Connect service, Data Connect automatically generates custom SDKs for you to use in your client logic. These SDKs let you call server-side queries and mutations directly from a Firebase app.

Back in February, we announced support for React, letting you generate React SDKs for your projects with bindings powered by TanStack Query to integrate your GraphQL operations into your React-based apps.

Now, we’re excited to announce support for Angular as well! You first need to install the dependencies, and then Data Connect will automatically generate Angular SDKs. You can then use these SDKs for queries and mutations in your Angular app.

To learn more and see examples, check out the documentation.

Try the new Android and iOS Codelabs

With the Data Connect web codelab out there for web users, we definitely didn’t want to leave the fun out for our Android and iOS users! We’re excited to share the new Android and iOS codelabs, designed to help you walk through implementation of a fully functioning mobile app using Data Connect.

Completed iOS Codelab app
Completed iOS Codelab app

Pricing Updates

With Data Connect now generally available, it will transition to its GA pricing structure. At a high level, Data Connect consists of two billable components: the Data Connect service itself and the PostgreSQL instance on Cloud SQL that contains your project data.

The cost for the Data Connect service is:

  • no cost for network egress up to 10 GiB/month, and then it will follow Google Cloud Internet Data Transfer Rate Premium Tier pricing. There may be potential additional costs that you can read about in the documentation - but the good news is network egress is only charged once for data going out of your database
  • no cost for operations (queries and mutations) up to 250k operations per month, and then the cost is $4.00 per 1M operations

The cost for the PostgreSQL instance on Cloud SQL is a no-cost trial for 3 months, then permanent costs as low as $9.37 per month that follows Google Cloud pricing.

Additionally, if you use Data Connect for vector similarity search, you need to integrate Vertex AI’s Embeddings API. As such, there will be associated costs for embedding generation.

To learn more, check out the documentation.

Try out Data Connect!

To learn more about Data Connect, here are some resources:

Even though Data Connect is now in GA, we’re still hard at work to make it even better, and we’re super excited to have you on the journey with us. Your requests shape what we build, so please let us know what you’d love to see next on Firebase’s UserVoice. We hope to hear from you, and we can’t wait to see what you build!