{"id":16563969,"url":"https://github.com/carnesen/google-cloud","last_synced_at":"2026-05-19T06:05:14.308Z","repository":{"id":33118481,"uuid":"148207199","full_name":"carnesen/google-cloud","owner":"carnesen","description":"A Node.js library for deploying websites to Google Cloud Platform","archived":false,"fork":false,"pushed_at":"2023-01-28T15:29:46.000Z","size":436,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T23:24:54.750Z","etag":null,"topics":["google-cloud","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carnesen.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}},"created_at":"2018-09-10T19:22:07.000Z","updated_at":"2022-02-26T07:18:02.000Z","dependencies_parsed_at":"2023-02-15T17:15:23.457Z","dependency_job_id":null,"html_url":"https://github.com/carnesen/google-cloud","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/carnesen/google-cloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carnesen%2Fgoogle-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carnesen%2Fgoogle-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carnesen%2Fgoogle-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carnesen%2Fgoogle-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carnesen","download_url":"https://codeload.github.com/carnesen/google-cloud/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carnesen%2Fgoogle-cloud/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263603081,"owners_count":23487206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["google-cloud","nodejs","typescript"],"created_at":"2024-10-11T20:42:51.205Z","updated_at":"2026-05-19T06:05:14.269Z","avatar_url":"https://github.com/carnesen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Node.js library for deploying websites and Node.js services to Google Cloud Platform (GCP) using Google App Engine\n\n[![build status badge](https://github.com/carnesen/google-cloud/workflows/test/badge.svg)](https://github.com/carnesen/google-cloud/actions?query=workflow%3Atest+branch%3Amaster) [![npm version badge](https://badge.fury.io/js/%40carnesen%2Fgoogle-cloud.svg)](https://www.npmjs.com/package/@carnesen/google-cloud)\n\n## Features\n\nThis library can be used to automate the deployment of [static websites](https://en.wikipedia.org/wiki/Static_web_page) and [Node.js services](https://en.wikipedia.org/wiki/Node.js) to GCP with minimal configuration and just a handful of conventions. Its features include:\n\n- Custom domains\n- [https](https://en.wikipedia.org/wiki/HTTPS)\n- Version management\n- Low cost\n- High availability\n\n## Install\n\n```\nnpm install @carnesen/google-cloud\n```\nThe package includes runtime JavaScript files suitable for Node.js \u003e=8 as well as the corresponding TypeScript type declarations. There are also a number of one-time manual setup steps that you'll need to do if you haven't already:\n\n#### Create a project\n\nSign in to the [Google Cloud console](https://console.cloud.google.com) and create a new [\"project\"](https://console.cloud.google.com/project) and note its \"project ID\", which you'll need later.\n\n#### Purchase a domain name\n\nUse [Google Domains](https://domains.google) or any other [registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) to purchase a top-level domain, e.g. \"example.com\". Your sites and services will be served at the apex \"example.com\" and on subdomains \"www.example.com\". \n\n#### Create a Cloud DNS zone\n\nIn the [Google Cloud console](https://console.cloud.google.com), navigate to \"Network Services\" \u003e \"Cloud DNS\". Follow the prompts to create a new public \"zone\". Note its \"zone name\", which you'll need later.\n\n#### Delegate name resolution to Google Cloud\n\nIn the [Google Cloud console](https://console.cloud.google.com), navigate to \"Network Services\" \u003e \"Cloud DNS\". Click on the \"Registrar Setup\" link in the upper right-hand corner. This reveals the \"NS\" (name server) records for your managed zone. Copy these NS records over to your domain registrar. Details differ by provider. [Here's how to do it with Google Domains](https://support.google.com/domains/answer/3290309?hl=en).\n\n#### [Install the Google Cloud SDK](https://cloud.google.com/sdk/install)\n\nWhen the SDK is properly installed you should see, e.g.:\n```\n$ gcloud -v\nGoogle Cloud SDK 232.0.0\nbq 2.0.40\ncore 2019.01.27\ngsutil 4.35\n```\n\n#### `gcloud auth login`\n\nSets authentication credentials for the `gcloud` command-line utility\n\n#### `gcloud auth application-default login`\n\nSets [\"Application Default Credentials\"](https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application) for use by the `@google-cloud` Node.js SDKs.\n\n#### `gcloud config set project \u003cproject id\u003e`\n\nSet the current active \"project\" for the `gcloud` CLI.\n\n#### `gcloud app create`\n\nFollow the prompts to initialize your project for \"App Engine\". You'll be asked to choose a region for your app. This cannot be changed later.\n\n## Usage\n\nIn the same way that your site leverages npm to version and install the library code that it uses, `@carnesen/google-cloud` leverages npm to version and install the site code that it deploys. This usage example assumes you've already completed the setup in the \"Install\" section above. We use npm to pull down the site code that we want to deploy:\n\n```\nnpm install --save @carnesen/redirector @carnesen/www github:carnesen/meme-me @carnesen/run-and-exit\n```\n\n- [@carnesen/redirector](https://github.com/carnesen/redirector) is a Node.js service published to npm\n- [@carnesen/www](https://github.com/carnesen/www) is a static site published to npm\n- [github:carnesen/meme-me](https://github.com/carnesen/meme-me) is a Node.js site installed from GitHub as an [npm GitHub url](https://docs.npmjs.com/files/package.json#github-urls)\n- [@carnesen/run-and-exit](https://github.com/carnesen/run-and-exit) is not site code, just a little helper that runs an async function then calls `process.exit`\n\nFor deploying a single site, your deployment code might even be co-located with the application code in which case you wouldn't need to `npm install` anything beyond `@carnesen/google-cloud`.\n\nCreate a Node.js script `deploy.js` with contents:\n\n```js\nconst runAndExit = require('@carnesen/run-and-exit');\nconst { deployApp } = require('@carnesen/google-cloud');\n\n// In the context of this library is an \"App\" is a Google Cloud\n// App Engine \"App\", which is comprised of one or more websites\nrunAndExit(deployApp, {\n  projectId: '\u003cproject id\u003e',\n  zoneName: '\u003czone name\u003e',\n  defaultSite: {\n    siteType: 'nodejs',\n    packageId: '@carnesen/redirector',\n  },\n  otherSites: [\n    {\n      siteType: 'static',\n      siteName: 'www',\n      packageId: '@carnesen/www',\n    },\n    {\n      siteType: 'nodejs',\n      siteName: 'meme-me',\n      packageId: '@carnesen/meme-me',\n    },\n  ],\n});\n```\n\nAnd run it:\n\n```\n$ node deploy.js\nAppEngine : carnesen-tmp : Creating...\nAppEngine : carnesen-tmp : Already exists\nSite : default : Pre-validating...\nSite : www : Pre-validating...\nSite : meme-me : Pre-validating...\n...\n```\n\n## API\n\nThis project's API is documented in the form of TypeScript types and TSDoc strings.\n\n## Conventions\n\nThis project favors convention over configuration, and hopefully the conventions will align pretty well with what you're already doing. As mentioned above, for both Node.js and static sites, the site content must be in a place where ``require.resolve(`${packageId}/package.json`)`` will return the path of a `package.json` file. That file's containing directory is what gets uploaded to Google Cloud App Engine using `gcloud app deploy`.\n\n### nodejs\n\nThe package directory is uploaded to Google Cloud as-is. In particular that means that `npm start` should fire up your Node.js server process.\n\n### static\n\nSimilar to Node.js sites, the package directory is uploaded to Google Cloud as-is. The root of the package, however, is not what gets served by App Engine. Instead by convention it's assumed that the `dist` subdirectory that contains the static content that you want to serve. If that convention doesn't suit you, please just let me know and I'd be happy to parameterize it.\n\n## More information\n\nThis library doesn't have many unit tests, but I use it on a semi-regular basis to deploy sites to [carnesen.com](https://carnesen.com). To be sure, I don't get much traffic on those sites, but my GCP bill is typically less than a dollar a month! If you encounter any bugs or have any questions or feature requests, please don't hesitate to file an issue or submit a pull request on this project's repository on GitHub.\n\n## Related\n\n- [@carnesen/carnesen-dot-com](https://github.com/carnesen/carnesen-dot-com): Automates deployment of carnesen.com to Google Cloud Platform\n- [@carnesen/cli](https://github.com/carnesen/cli): A library for building Node.js command-line interfaces\n- [@carnesen/tslint-config](https://github.com/carnesen/tslint-config): TSLint configurations for `@carnesen` projects\n- [@carnesen/tsconfig](https://github.com/carnesen/tsconfig): TypeScript configurations for `@carnesen` projects\n\n## License\n\nMIT © [Chris Arnesen](https://www.carnesen.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarnesen%2Fgoogle-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarnesen%2Fgoogle-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarnesen%2Fgoogle-cloud/lists"}