# Setup Google Cloud Firestore (Datastore mode) ## Locally You can use the GCP Datastore emulator to run locally using the instructions [here](https://cloud.google.com/datastore/docs/tools/datastore-emulator). You can then interact with the server using `localhost:8081`. ## Google Cloud Follow the instructions [here](https://cloud.google.com/datastore/docs/quickstart) to get started with setting up Firestore in Google Cloud. ## Create a Dapr component The next step is to create a Dapr component for Firestore. Create the following YAML file named `firestore.yaml`: ```yaml apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: namespace: spec: type: state.gcp.firestore metadata: - name: type value: # Required. Example: "serviceaccount" - name: project_id value: # Required. - name: private_key_id value: # Required. - name: private_key value: # Required. - name: client_email value: # Required. - name: client_id value: # Required. - name: auth_uri value: # Required. - name: token_uri value: # Required. - name: auth_provider_x509_cert_url value: # Required. - name: client_x509_cert_url value: # Required. - name: entity_kind value: # Optional. default: "DaprState" ``` The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here](../../concepts/secrets/README.md) ## Apply the configuration ### In Kubernetes To apply the Firestore state store to Kubernetes, use the `kubectl` CLI: ``` kubectl apply -f firestore.yaml ``` ### Running locally To run locally, create a `components` dir containing the YAML file and provide the path to the `dapr run` command with the flag `--components-path`.