Skip to content

Add markdown guide for data connect internals #8831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tammam-g
Copy link
Contributor

@tammam-g tammam-g commented Jul 10, 2025

How do people feel about adding docs like these to provide quick context for contributing for llm agents (and people)?

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @tammam-g, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a foundational markdown document aimed at educating developers on the internal architecture and operational flows of the Firebase Data Connect feature within the firebase-tools CLI. Its primary goal is to enhance understanding and facilitate contributions to this specific part of the codebase.

Highlights

  • New Documentation Added: I've added a new markdown document, docs/data-connect.md, to the repository. This document serves as a comprehensive internal guide for the Firebase Data Connect feature.
  • Detailed Data Connect Internals: The new guide provides an in-depth look at Data Connect, covering its product overview, its place within the firebase-tools project structure, and its core components. It details how Data Connect interacts with the CLI's command framework, authentication system, and the Emulator Suite.
  • Interaction Flows Explained: The document clarifies the interaction flows for Data Connect, specifically differentiating between local emulation scenarios (using pg-lite) and the deployment process, including schema migration and service deployment.
  • Contribution Guide: The guide also includes practical steps and advice for developers looking to contribute to the Firebase CLI, with a particular focus on understanding and modifying the Data Connect feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new internal developer guide for Firebase Data Connect. The guide is well-structured and provides a good overview of the feature's architecture within firebase-tools. I've added a few suggestions to improve clarity and correct some minor inaccuracies in the documentation.

@@ -0,0 +1,121 @@
Firebase Data Connect, is a feature that enables developers to build GraphQL-based data APIs backed by existing SQL databases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comma after 'Firebase Data Connect' is grammatically incorrect and slightly hinders readability.

Suggested change
Firebase Data Connect, is a feature that enables developers to build GraphQL-based data APIs backed by existing SQL databases.
Firebase Data Connect is a feature that enables developers to build GraphQL-based data APIs backed by existing SQL databases.

The `firebase-tools` codebase is structured to separate core functionalities, command definitions, and emulator logic.

```
firebase-firebase-tools/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The repository name appears to be duplicated here. For accuracy, it should be firebase-tools/.

Suggested change
firebase-firebase-tools/
firebase-tools/

Comment on lines +23 to +29
│ ├── dataconnect/ # Data Connect Emulator specific logic.
│ │ └── pgliteServer.ts # Manages the in-memory pglite Postgres instance.
│ ├── storage/ # Storage Emulator implementation.
│ ├── controller.ts # Main controller to start, stop, and manage emulators.
│ ├── downloadableEmulators.ts # Handles downloading of JAR-based emulators.
│ ├── hub.ts # The central discovery service for all emulators.
│ └── registry.ts # A static registry for running emulators to discover each other.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The project structure diagram is missing the dataconnectEmulator.ts file, which is a key component mentioned later in the document. The description for the dataconnect/ directory could be more precise.

Suggested change
│ ├── dataconnect/ # Data Connect Emulator specific logic.
│ │ └── pgliteServer.ts # Manages the in-memory pglite Postgres instance.
│ ├── storage/ # Storage Emulator implementation.
│ ├── controller.ts # Main controller to start, stop, and manage emulators.
│ ├── downloadableEmulators.ts # Handles downloading of JAR-based emulators.
│ ├── hub.ts # The central discovery service for all emulators.
│ └── registry.ts # A static registry for running emulators to discover each other.
│ ├── dataconnect/ # Core logic for Data Connect feature.
│ │ ├── client.ts # Client for interacting with the Data Connect backend API.
│ │ ├── load.ts # Logic for loading and parsing dataconnect.yaml and connector.yaml.
│ │ ├── schemaMigration.ts # Handles SQL schema diffing and migration.
│ │ └── build.ts # Logic for building schema and connectors from source.
│ ├── emulator/
│ ├── auth/ # Auth Emulator implementation.
│ ├── dataconnect/ # Data Connect Emulator specific logic.
│ │ └── pgliteServer.ts # Manages the in-memory pglite Postgres instance.
│ │ └── dataconnectEmulator.ts # The Data Connect emulator.
│ ├── storage/ # Storage Emulator implementation.
│ ├── controller.ts # Main controller to start, stop, and manage emulators.
│ ├── downloadableEmulators.ts # Handles downloading of JAR-based emulators.
│ ├── hub.ts # The central discovery service for all emulators.
│ └── registry.ts # A static registry for running emulators to discover each other.

@tammam-g tammam-g requested review from joehan, mbleigh and fredzqm July 10, 2025 22:11
│ ├── controller.ts # Main controller to start, stop, and manage emulators.
│ ├── downloadableEmulators.ts # Handles downloading of JAR-based emulators.
│ ├── hub.ts # The central discovery service for all emulators.
│ └── registry.ts # A static registry for running emulators to discover each other.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would expect those FDC code be there.

  • src/deploy/dataconnect
  • src/mcp/tools/dataconnect
  • template/init/dataconnect
  • src/init/dataconnect

@fredzqm
Copy link
Contributor

fredzqm commented Jul 11, 2025

How is this created? Generated by AI?

Those kind of docs if not co-located with code will get stable and obsolete very quickly.

@tammam-g
Copy link
Contributor Author

tammam-g commented Jul 11, 2025

How is this created? Generated by AI?

Those kind of docs if not co-located with code will get stable and obsolete very quickly.

Yeah created by AI, wanted to get quick idea on how people feel about adding this. It can become obsolete but I feel like it will still capture 90+% of how things work unless there is a large refactor, in which case updating this file should be part of the PR ideally. Trying to hit a nice medium between being too specific and too general.

For context: to generate this prompt I had to use around 850k token context which if I wanted to include all in gemini-cli it will run out of tokens quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants