Firebase Data Connect: now in public preview!

At Google I/O, we announced Firebase Data Connect, 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 will do 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. On top of that, Data Connect is well integrated with other Firebase services, as is consistent across the entire Firebase ecosystem.

Back then, you had to sign up to join our private preview as we were still hard at work making sure the product is the best it can be for you before releasing it publicly. Today, we’re excited that the day has come - Firebase Data Connect is now available in Public Preview!

For an overview of what Data Connect is, feel free to peruse the announcement from Google I/O back in May. In today’s blog post, we’re assuming you understand schemas, queries, and mutations.

Strongly Typed SDKs

As you design schemas, queries, and mutations for your app, Firebase Data Connect automatically generates client SDKs that let you call your server-side queries and mutations directly from a Firebase app. We support web, Android, and iOS SDKs so regardless of which platform you build on, you can call these generated functions in your app to access and update data.

In addition, we know how important your production data is, so we have a new Node.js Admin SDK for trusted GraphQL execution. This way, you can manage your production data from a privileged server environment, important for when you want to perform initial bulk loads or updates of production data.

Flexible Schema Management

Sometimes during development, you’ll want to change the schema for the existing database, and to do so, you’ll have to migrate the schema. Data Connect schema migrations have two different schema validation modes: strict and compatible.

Strict mode keeps your PostgreSQL schema in sync with your Data Connect schema as you evolve your Data Connect Schema. Strict mode is great for new app development because you only have to manage your Data Connect Schema.

Compatible mode ensures that your Data Connect (application) schema is compatible with the underlying PostgreSQL schema. Compatible mode makes it easier for you to connect existing PostgreSQL Cloud SQL databases to your Data Connect instance because you don’t have to mirror the whole schema to Data Connect. You only need to surface the necessary data to Data Connect.

By having both of these validation modes, you have more flexibility in how you surface data from your underlying Cloud SQL instance.

Security

As is for any database with user data, security is extremely important. Data Connect is fully integrated with Firebase Authentication, so you can leverage rich data about users who are accessing your data (authentication) in your design for what data those users can access (authorization). For each query and mutation, you can decide the level of authentication and authorization needed for executing the call to your database. Data Connect uses CEL (Common Expression Language) to enforce security.

In addition to authentication and authorization, you can use attestation through Firebase App Check. By doing so, devices running your app will use an app or device attestation provider to help ensure Data Connect operations originate from your authentic app and requests originate from an authentic, untampered device. This attestation is attached to every request your app makes to Data Connect.

You can learn more about securing Data Connect with authorization and attestation, as well as see examples of how to do so.

GraphQL Language Expansions

In your schemas, you can declare the data type for each field, which will help you organize your code as you access and update these fields in the database. These scalar types determine how data is serialized to and deserialized from JSON, and we’ve built data types beyond GraphQL’s types so you don’t have to write these as your own custom types. The supported data types are: String, Int, Float, Boolean, UUID, Int64, Date, Timestamp, Vector, and Any scalars.

In addition, we’ve created a way for your GraphQL schema to drive database indexes. Whenever you declare a unique field (column) in a schema, you can then base queries on it for easier retrieval.

Pricing

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

For the Data Connect service itself:

  • The network egress has no cost up to 10 Gib/month, after that, it’s charged at Google Cloud Internet Data Transfer Rate Premium Tier pricing
  • Operation counts have no cost up to 250,000 operation counts, and beyond that, it’s charged at $4.00 per million operation counts

For Cloud SQL, there is a no-cost trial. If you accept the default configuration when you provision your first Cloud SQL instance for Data Connect in Firebase console, you will be qualified for a no-cost trial which will last for the duration of public preview. Then, starting at General Availability, there will be an additional no cost trial for 3 months. The default configuration of your Cloud SQL for PostgreSQL instance is equivalent to a db-f1-micro instance, and you can look at how pricing works there.

For more details, check out the pricing page.

Try it out!

To learn more and try out Data Connect, check out the documentation on how to get started. There are also sample apps for web and Android if you want to see Data Connect in action, and the web codelab gives you a walkthrough with descriptions and code of a working app that uses Data Connect. We can’t wait to see what you build using Data Connect!