Skip to content

Commit

Permalink
docs: update the getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
thatfiredev committed Sep 20, 2024
1 parent f0f5ce4 commit bca483a
Showing 1 changed file with 50 additions and 27 deletions.
77 changes: 50 additions & 27 deletions dataconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,33 @@ For more information about Firebase Data Connect visit [the docs](https://fireba
Follow these steps to get up and running with Firebase Data Connect. For more detailed instructions,
check out the [official documentation](https://firebase.google.com/docs/data-connect/quickstart).

### 1. Create a New Data Connect Service and Cloud SQL Instance

1. Open [Firebase Data Connect](https://console.firebase.google.com/u/0/project/_/dataconnect) in
your project in Firebase Console and select Get Started.
2. Create a new Data Connect service and a Cloud SQL instance. Ensure the Blaze plan is active.
Pricing details can be found at [Firebase Pricing](https://firebase.google.com/pricing).
3. Select your server region, if you wish to use vector search, make sure to select `us-central1` region.
4. Allow some time for the Cloud SQL instance to be provisioned. After it's provisioned, the instance
can be managed in the [Cloud Console](https://console.cloud.google.com/sql).
### 1. Connect to your Firebase project

1. If you haven't already, create a Firebase project.
1. In the [Firebase console](https://console.firebase.google.com), click
**Add project**, then follow the on-screen instructions.

2. Upgrade your project to the Blaze plan. This lets you create a Cloud SQL
for PostgreSQL instance.

> Note: Though you set up billing in your Blaze upgrade, you won't be
charged for usage of {{data_connect_short}} or the
[default Cloud SQL for PostgreSQL configuration](https://firebase.google.com/docs/data-connect/#pricing)
during the preview.

3. Navigate to the [Data Connect section](https://console.firebase.google.com/u/0/project/_/dataconnect)
of the Firebase console and follow the setup workflow:
- Select a location for your Cloud SQL for PostgreSQL database.
- Fill in the following fields:
- Service ID: `dataconnect`
- Cloud SQL Instance: `cloud-sql-instance`
- Database name: `postgres`
4. Allow some time for the Cloud SQL instance to be provisioned. After it's provisioned, the instance
can be managed in the [Cloud Console](https://console.cloud.google.com/sql).

5. Download and then add the Firebase Android configuration file (`google-services.json`) to your app:
1. Click **Download google-services.json** to obtain your Firebase Android config file.
2. Move your config file into the module (app-level) root directory of your app.

### 2. Set Up Firebase CLI

Expand All @@ -32,24 +50,29 @@ npm install -g firebase-tools
### 3. Cloning the repository
This repository contains the quickstart to get started with the functionalities of Data Connect.

1. Clone this repository to your local machine.
1. (Private Preview only) Checkout the `fdc-quickstart` branch and open the project in Android Studio.
1. Open the a terminal window and initialize your Firebase project with `firebase init dataconnect`.
1. Overwrite only dataconnect.yaml when prompted, do not overwrite any other dataconnect files.
(Optional): If you intend on using other Firebase features, run `firebase init` instead, and select both DataConnect options as well as any feature you intend to use.
1. Allow domains for Firebase Auth in your [project console](https://console.firebase.google.com/project/_/authentication/settings) (e.g. http://127.0.0.1).

### 4. Running queries and mutations in VS Code
The VSCode Firebase Extension allows you to generate Firebase Data Connect SDK code, run queries/mutations, and deploy Firebase Data Connect with a click. Alternatively, see below for CLI commands.

1. Install [VS Code](https://code.visualstudio.com/).
2. Download the [Firebase extension](https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/vsix%2Ffirebase-vscode-latest.vsix?alt=media) and [install](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-an-extension) it.
3. Open this quickstart in VS code, and in the left pane of the Firebase extension, and log in with your Firebase account.
(Optional): If your Firebase project was not initialized in the last section, you can click `Run firebase init` and select `Data Connect` to initialize.
4. Click on deploy to deploy your schema to your cloud SQL instance. Or run `firebase deploy --only dataconnect` (this will also activate vectors search if it's enabled in the schema).
5. Running the VSCode extension should automatically start the DataConnect emulators. If you see an emulators error, try running `firebase emulators:start dataconnect` manually.

Now you should be able to deploy your schema, run mutations/queries, generate SDK code, and view your application locally.
1. Clone this repository to your local machine:
```sh
git clone https://github.com/firebase/quickstart-android.git
```

2. (Private Preview only) Checkout the `fdc-quickstart` branch (`git checkout fdc-quickstart`)
and open the project in Android Studio.

### 4. Deploy the service to Firebase and generate SDKs

1. Open the `quickstart-android/dataconnect/dataconnect` directory and deploy the schema with
the following command:
```bash
firebase deploy
```
2. Once the deploy is complete, you should be able to see the movie schema in the
[Data Connect section](https://console.firebase.google.com/u/0/project/_/dataconnect)
of the Firebase console.

3. Generate the Kotlin SDK by running:
```bash
firebase dataconnect:sdk:generate
```

### 5. Populating the database
1. Run `1_movie_insert.gql`, `2_actor_insert.gql`, `3_movie_actor_insert.gql`, and `4_user_favorites_review_insert.gql` files in the `./dataconnect` directory in order using the VS code extension,
Expand Down

0 comments on commit bca483a

Please sign in to comment.