{"id":38548904,"url":"https://github.com/causa-io/workspace-module-google","last_synced_at":"2026-05-22T07:14:04.089Z","repository":{"id":173597163,"uuid":"642263673","full_name":"causa-io/workspace-module-google","owner":"causa-io","description":"The Causa workspace module providing many functionalities related to GCP and its services.","archived":false,"fork":false,"pushed_at":"2026-01-14T20:46:58.000Z","size":1795,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T00:53:58.592Z","etag":null,"topics":["causa","gcp","google"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/causa-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-18T07:16:55.000Z","updated_at":"2026-01-14T20:46:46.000Z","dependencies_parsed_at":"2024-02-22T14:30:30.745Z","dependency_job_id":"893482ca-d31a-4062-8253-4dd64e13a5be","html_url":"https://github.com/causa-io/workspace-module-google","commit_stats":null,"previous_names":["causa-io/workspace-module-google"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/causa-io/workspace-module-google","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causa-io%2Fworkspace-module-google","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causa-io%2Fworkspace-module-google/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causa-io%2Fworkspace-module-google/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causa-io%2Fworkspace-module-google/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/causa-io","download_url":"https://codeload.github.com/causa-io/workspace-module-google/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causa-io%2Fworkspace-module-google/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["causa","gcp","google"],"created_at":"2026-01-17T07:29:37.570Z","updated_at":"2026-05-22T07:14:04.081Z","avatar_url":"https://github.com/causa-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@causa/workspace-google` module\n\nThis repository contains the source code for the `@causa/workspace-google` Causa module. It provides many GCP-related utilities and implementations for `cs` commands. For more information about the Causa CLI `cs`, checkout [its repository](https://github.com/causa-io/cli).\n\n## ➕ Requirements\n\nThe Google module requires [Docker](https://www.docker.com/) in order to run local emulators of GCP services.\n\nAlthough not required, the [`gcloud`](https://cloud.google.com/sdk/gcloud) CLI might be useful, e.g. to set up credentials that will be used by the Causa Google module.\n\n## 🎉 Installation\n\nAdd `@causa/workspace-google` to your Causa configuration in `causa.modules`.\n\n## 🔧 Configuration\n\nFor all the Google-related configuration in your Causa files, look at [the schema for the `GoogleConfiguration`](./src/configurations/google.ts).\n\n### Firebase\n\nIf you use Firebase functionalities and the corresponding CLI commands listed below (e.g. AppCheck, Identity Platform), you may want to set the configuration under the `google.firebase` path. This configuration is optional, but may speed up some CLI commands that would otherwise need to fetch the configuration from GCP using APIs every time they are run. Here is an example of such configuration:\n\n```yaml\ngoogle:\n  firebase:\n    adminServiceAccount: firebase-adminsdk-\u003crandom ID\u003e@\u003cGCP project\u003e.iam.gserviceaccount.com\n    apiKey: Public API key, e.g. for iOS, Android, or Web.\n    appId: Firebase App ID for iOS, Android, or Web.\n```\n\n- `adminServiceAccount` references a private service account only known to developers. While it cannot be used without the corresponding IAM credentials, you should ensure only developers with relevant access can read this configuration.\n- `apiKey`: Be sure to select a public API key. For example, keys embedded in client applications are safe because they are distributed to all users anyway.\n- `appId`: Firebase App IDs are also embedded in client applications. Any (public) app ID is safe to set in the configuration.\n\nThis makes the `google.firebase` configuration safe to commit in your repository. Getting access to this configuration does not grant any permission that is either public or has to be set separately in IAM.\n\n## ✨ Supported project types and commands\n\n### Project types\n\nThe following Causa `project.type`s are supported:\n\n- `serviceContainer`, with `google.cloudRun` as the `serviceContainer.platform`. This will ensure the built Docker images are pushed to the repository set in `google.cloudRun.dockerRepository`.\n- `serverlessFunctions`, with `google.cloudFunctions` as the `serverlessFunctions.platform`. This will push functions archives to the Cloud Storage bucket set in `google.cloudFunctions.artefactStorage`.\n\n### Emulators\n\nThe following emulators are implemented:\n\n- `google.firebaseStorage`: The Firebase Storage emulator from the Firebase tools. It supports setting the corresponding security rules. See the `cs google firebaseStorage mergeRules` documentation for more details.\n- `google.firestore`: The Firestore emulator from the `gcloud` tools. If supports setting the corresponding security rules. See the `cs google firestore mergeRules` documentation for more details.\n- `google.identityPlatform`: The Identity Platform (Firebase Auth) emulator from the Firebase tools.\n- `google.pubSub`: The Pub/Sub emulator from the `gcloud` tools. It automatically creates the topics for all event topics found in the Causa workspace. `events.broker` must be set to `google.pubSub` for this.\n- `google.spanner`: The Spanner emulator. It automatically creates all the Spanner databases defined in the Causa workspace, and sets up their DDLs. See the `google.spanner` [configuration](./src/configurations/google.ts) for more details.\n\n### Backfilling\n\nBackfilling is supported when `google.pubSub` is set as the `events.broker`. Temporary triggers can be created for Cloud Run services in two ways:\n\n- As a raw URI, using the format `[[projects/\u003cprojectId\u003e/]locations/\u003clocation\u003e/]services/\u003cname\u003e/path-to-trigger`.\n- As a project-scoped trigger, using the format `\u003cprojectPath\u003e#\u003ctriggerName\u003e[?\u003coptions\u003e]`. The referenced project must be of type `serviceContainer` with `google.cloudRun` as `serviceContainer.platform`. The HTTP path is read from `serviceContainer.triggers[\u003ctriggerName\u003e].endpoint` (whose `type` must be `http`), and the `options` query string is forwarded as URL query parameters. The target Cloud Run service name defaults to `project.name`, and can be overridden by setting `google.cloudRun.eventBackfillServiceName`.\n\nWhen no source is specified, the default is to fetch events to backfill from the BigQuery dataset configured in `google.pubSub.bigQueryStorage`. A custom BigQuery table can also be set as source using the `bq://\u003cprojectId\u003e.\u003cdatasetId\u003e.\u003ctableId\u003e` format. It should have the `data` and `attributes` columns.\n\n### Querying\n\nThis module implements the `DatabaseQueryRecords`, `ServiceContainerQueryLogs`, and `EventTopicQueryEvents` workspace functions, which expose read-only access to data stored in or emitted by deployed services:\n\n- `DatabaseQueryRecords` is supported for the `google.spanner` and `google.firestore` engines. For Spanner, the function takes a database name and a SQL query, runs it on the configured Spanner instance, and returns the matching rows (capped to 100000). For Firestore, the query is the path to a single document, fetched from the default database (or the specified one). The document data is returned as a single-element array. An empty array is returned when the document does not exist.\n- `ServiceContainerQueryLogs` is supported when `serviceContainer.platform` is `google.cloudRun`. It queries Cloud Logging for log entries emitted by the service's Cloud Run revisions. By default, only the last hour of logs and up to 1 000 entries are returned.\n- `EventTopicQueryEvents` is supported when `events.broker` is `google.pubSub`, `events.format` is `json`, and `google.pubSub.bigQueryStorage.rawEventsDatasetId` is set. It reads events from the topic's BigQuery raw events table. Same defaults as for log queries: last hour and up to 1 000 events.\n\n### Secrets backend\n\nThis module implements the `google.secretManager` secret backend, allowing fetching secrets from the Google Secret Manager service. Here are some example of how secrets with the `google.secretManager` backend should be defined:\n\n```yaml\nsecrets:\n  simpleSecret:\n    id: simple-secret\n  secretWithProject:\n    id: projects/gcp-project/secrets/my-secret\n  secretWithVersion:\n    id: projects/gcp-project/secrets/my-secret/versions/12\n```\n\nWhen the GCP project is not specified in the secret ID, it is inferred from `google.secretManager.project`, or `google.project` (in this order). This allows defining the GCP project a single time if needed.\n\nA second secret backend, `google.accessToken`, does not fetch secrets from a source but rather returns a GCP access token, which can be used to access Google services:\n\n```yaml\nsecrets:\n  gcpAccessToken:\n    backend: google.accessToken\n```\n\n### Code generation\n\nThis module provides TypeScript decorator renderers for Spanner and Firestore, which can be used to add `@SpannerTable`, `@SpannerColumn`, `@FirestoreCollection`, and `@SoftDeletedFirestoreCollection` decorators to classes generated from events. Below is an example of how to enable it for a JSONSchema object:\n\n```yaml\ntitle: MySpannerTable\ntype: object\nadditionalProperties: false\ncausa:\n  # This must be set for the decorators to be added to both the class and its properties.\n  # The content of the object will be passed as the argument to the `@SpannerTable` decorator.\n  googleSpannerTable:\n    primaryKey: [id]\nproperties:\n  id:\n    type: string\n    format: uuid\n    # In most cases, the property-level `googleSpannerColumn` attribute does not need to be set. The decorator configuration will be automatically inferred.\n    # If needed, the content of `googleSpannerColumn` will be passed as the argument to the `@SpannerColumn` decorator.\n    # causa:\n    #   googleSpannerColumn:\n    #     isJson: false\n  myProperty:\n    type: string\n\n---\ntitle: MyFirestoreDocument\ntype: object\nadditionalProperties: false\ncausa:\n  # This must be set for the decorators to be added to the class.\n  googleFirestoreCollection:\n    # Mandatory, the name of the Firestore collection.\n    name: myCollection\n    # Mandatory, determines how to create the path for a document.\n    path: [property: id]\n    # This could also contain plain strings, e.g. for `{id}/subCollection/{otherProp}`:\n    # path: [property: id, subCollection, property: otherProp]\n    # Optional, adds the `@SoftDeletedFirestoreCollection` decorator.\n    hasSoftDelete: true\nproperties:\n  id:\n    type: string\n  otherProp:\n    type: string\n```\n\nTo restrict the decorator to some schema files, you can configure the parent `typescriptModelClass` generator:\n\n```yaml\nmodel:\n  codeGenerators:\n    - generator: typescriptModelClass\n\n      # ...Rest of the configuration...\n\n      google:\n        spanner:\n          # Decorators will only be added to the schemas in those files, relative to the project directory.\n          globs:\n            - ../entities/*.yaml\n          # The name of the property / column to which the `softDelete` option should be added.\n          softDeletionColumn: deletedAt\n\n        firestore:\n          # Same as Spanner globs.\n          globs:\n            - ../firestore/*.yaml\n```\n\n## 🔨 Custom `google` commands\n\nThis modules adds a new command to the CLI: `cs google`. Here is the list of subcommands that are exposed.\n\n### App Check\n\nThe `cs google appCheck genToken` command generates an App Check token, which can be used to authenticate calls to APIs that are protected by Firebase App Check.\n\nA token is generated for a specific Firebase application. This can be set using the `-a, --app \u003capp\u003e` argument. If it is not set, any Firebase application will be selected automatically using the Firebase API.\n\nAn App Check token must be signed using an admin service account in the same project as the app. Firebase automatically creates such an account when it is initialized from a GCP project. This command can take care of automatically finding this account. However, if you want to save on API calls, the email for any service account with Firebase admin permissions can be set in `google.firebase.adminServiceAccount`.\n\n### Enable services\n\nThe `cs google enableServices` command will enable all the GCP services defined in `google.services`. This command is also exposed as an infrastructure processors, under the name `GoogleServicesEnable`.\n\n### Firebase Storage\n\nThe `cs google firebaseStorage mergeRules` command merges several Firebase security rules files together into a single file that can be used as configuration for both the Firebase Storage emulator, and the Firebase Storage production service.\n\nInput files are found using the glob patterns defined in `google.firebaseStorage.securityRuleFiles`. Input files should not include the header, i.e. they should defined what is **inside**:\n\n```\nrules_version = '2';\n\nservice firebase.storage {\n  match /b/{bucket}/o {\n    // Only include what is inside those brackets.\n  }\n}\n```\n\nThe output Firebase security rules file can be set in `google.firebaseStorage.securityRuleFile`.\n\n### Firestore\n\nThe `cs google firestore mergeRules` command merges several Firebase security rules files together into a single file that can be used as configuration for both the Firestore emulator, and the Firestore production service.\n\nThis command is extremely similar to `cs google firebaseStorage mergeRules`. Input files are defined in `google.firestore.securityRuleFiles`, and the output file is defined in `google.firestore.securityRuleFile`.\n\n### Identity Platform\n\nThe `cs google identityPlatform genToken` command generates an Identity Platform (formerly Firebase Auth) ID token, which can be used to authenticate calls to API protected by Identity Platform.\n\nThis command is similar to `cs google appCheck genToken` in that it requires a service account with Firebase admin permissions to sign the token. See the corresponding command for more information.\n\n## 🧱 Infrastructure processors\n\nThe Google module provides several infrastructure processors, which can be used to set up the Causa workspace before running infrastructure-related operations.\n\n### `GoogleFirebaseStorageMergeRules`\n\n[GoogleFirebaseStorageMergeRules](./src/functions/google-firebase-storage-merge-rules.ts) is the same underlying function as the `cs google firebaseStorage mergeRules` command. It allows preparing the Firebase Storage security rules before possibly deploying them along with the infrastructure. See the corresponding command for more details.\n\n### `GoogleFirestoreMergeRules`\n\n[GoogleFirestoreMergeRules](./src/functions/google-firestore-merge-rules.ts) is the same underlying function as the `cs google firestore mergeRules` command. It allows preparing the Firestore security rules before possibly deploying them along with the infrastructure. See the corresponding command for more details.\n\n### `GoogleServicesEnable`\n\n[GoogleServicesEnable](./src/functions/google-services-enable.ts) is the same underlying function as the `cs google enableServices` command. It enables GCP services before preparing or deploying the infrastructure.\n\nAlthough infrastructure as code tools usually expose this feature as well (e.g. the [`google_project_service`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project_service) Terraform resource), it might be more convenient to enable all the required services before running those tools. It avoids having to define dependencies between the services and all the actual resources being deployed.\n\n### `GoogleSpannerWriteDatabases`\n\n[GoogleSpannerWriteDatabases](./src/functions/google-spanner-write-databases.ts) writes a configuration file for each Spanner database, such that it can be picked up by the Causa Spanner Terraform module. This allows automatic setup of Spanner databases and their DDLs.\n\n### `GooglePubSubWriteTopics`\n\n[GooglePubSubWriteTopics](./src/functions/google-pubsub-write-topics.ts) writes a configuration file for each event topic, such that it can be picked up by the Causa Pub/Sub Terraform module. This allows automatic setup of Pub/Sub topics, and optionally of the corresponding BigQuery tables.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcausa-io%2Fworkspace-module-google","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcausa-io%2Fworkspace-module-google","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcausa-io%2Fworkspace-module-google/lists"}