February Update: What's New in Data Connect

New year, new features! Built on CloudSQL, Firebase Data Connect is our backend-as-a-service for Postgres. It’s a high-performance, scalable, and secure way to work with relational data using GraphQL. Since our previous update in ‘24, we’ve been hot at work to make Firebase Data Connect better to use, here’s a peek at what’s new.

What’s New?

React Web Framework Support

Using React? Now you can generate React SDKs for your projects, with bindings powered by TanStack Query, to integrate your GraphQL operations into your React based apps. More frameworks are also in the works, so keep an eye out!

Install the dependencies:

npm i --save @tanstack/react-query @tanstack-query-firebase/react

Enable generating React Hooks in connector.yaml:

generate:
  javascriptSdk:
    react: true
    outputDir: "../movies-generated"
    package: "@movie-app/movies"
    packageJsonDir: "../../"

And use!

MovieList.jsx
import { useListAllMovies } from "@movies-app/movies/react";

function Movies() {
  const { isLoading, data, error } = useListAllMovies();
  if (isLoading) {
      return <LoadingSpinner />;
  }
  if (error) {
      return <MovieListError error={error} />;
  }

  return (
      <ul>
          {data.map((movie) => (
              <MovieInfo key={movie.id} movie={movie} />
          ))}
      </ul>
  );
}
Copied!

Learn more about React support in the documentation.

Import & Export Emulator Data

Moving data just got easier. With PGLite, you can quickly import and export your database, whether you’re migrating, backing up, or setting up a fresh project.

We’ve heard your feedback! You can now see the distance from the query vector in your similarity search results by selecting the _metadata.distance field:

/dataconnect/connectors/queries.gql
query movieSimilaritySearch ($query: String!) @auth(level: PUBLIC) {
 movies_descriptionEmbedding_similarity(
   compare_embed: {model: "textembedding-gecko@003", text: $query},
   within: 2,
   where: {content: {ne: "No info available for this movie."}}, limit: 5)
   {
     id
     title
     description
     _metadata {
       distance
     }
   }
}
Copied!

This makes it easy to choose a good value for within and tune your search performance.

Query Authorization with @check

@check can now be used for queries as well as mutations! Define authorization rules with CEL expressions, allowing you to reference data from other tables and apply conditional logic for more precise access control.

/dataconnect/schema/schema.gql
query FavoriteMoviesByUserId($userId: String!) @auth(level: PUBLIC) {
  user(id: $userId) {
      privacySetting
          @check(
              expr: "this =='public'"
              message: "This user did not make their profile public."
          )
          @redact
      favoriteMovies: favorite_movies_on_user {
          movie {
              id
              title
              genre
          }
      }
  }
}
Copied!

New Android Quickstart

Android developers, we’ve got something for you! The new quickstart sample app shows you how to use Firebase Data Connect in an Android app, so you can start building right away.

Firebase Data Connect Android Quickstart
Firebase Data Connect Android Quickstart

Watch the Latest Livestream

Want a closer look? We hung out with Firebase After Hours for a live demo and some great Q&A. Check out the replay here: Firebase After Hours #9: Firebase Data Connect: SQL or NoSQL, that is no longer the question

What’s Next?

As we ramp up to Cloud Next and Google I/O, we’re working on even more content, including:

  • Angular bindings for out of the box integration
  • CEL support across all data types
  • COUNT function support for more complex queries

Don’t forget to share your thoughts

We’re hard at work to make Data Connect better in 2025, 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 with the tag “Data Connect”. We hope to hear from you!

Learn More