{"id":28753159,"url":"https://github.com/alloc/cloud-run-functions","last_synced_at":"2026-03-04T18:03:29.537Z","repository":{"id":292542952,"uuid":"980102699","full_name":"alloc/cloud-run-functions","owner":"alloc","description":"Develop and bundle your Cloud Run functions with ease","archived":false,"fork":false,"pushed_at":"2025-05-29T18:46:57.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T00:48:01.959Z","etag":null,"topics":["cloud-run","cloud-run-functions","esbuild","google-cloud","javascript","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/alloc.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-05-08T15:07:24.000Z","updated_at":"2025-05-29T18:47:00.000Z","dependencies_parsed_at":"2025-05-10T17:01:37.107Z","dependency_job_id":"36b67b00-1073-4641-9c02-bce93231ebbc","html_url":"https://github.com/alloc/cloud-run-functions","commit_stats":null,"previous_names":["alloc/cloud-run-functions"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/alloc/cloud-run-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fcloud-run-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fcloud-run-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fcloud-run-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fcloud-run-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/cloud-run-functions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fcloud-run-functions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260377520,"owners_count":22999742,"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":["cloud-run","cloud-run-functions","esbuild","google-cloud","javascript","nodejs","typescript"],"created_at":"2025-06-17T00:38:51.391Z","updated_at":"2026-03-04T18:03:29.527Z","avatar_url":"https://github.com/alloc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloud-run-functions\n\nFile-based routing plus local dev and bundling for `@google-cloud/functions-framework`.\n\nYou point it at a directory of `.ts` or `.js` files. \\\nEach file becomes an HTTP route and its default export is treated as the handler.\n\n## Install\n\n`@google-cloud/functions-framework` is required because this package runs it under the hood.\n\n```sh\npnpm add -D cloud-run-functions @google-cloud/functions-framework\n```\n\nOptional:\n\n```sh\npnpm add -D dotenv\npnpm add -D @hattip/adapter-node\n```\n\n## Quick start\n\nCreate a function file:\n\n`functions/hello.ts`\n\n```ts\nexport default (req, res) =\u003e {\n  res.status(200).send('hello')\n}\n```\n\nRun the dev server:\n\n```sh\npnpx cloud-run-functions dev functions\n```\n\nCall it:\n\n```sh\ncurl http://localhost:8080/hello\n```\n\n## Routing\n\n- A file path becomes a URL path\n- `functions/hello.ts` becomes `/hello`\n- `functions/users/create.ts` becomes `/users/create`\n- Your file should default export a function handler\n- If you set `entrySuffix` to `.task`, then `hello.task.ts` becomes `/hello`\n\n## CLI\n\nThe binary name is `cloud-run-functions`.\n\n### dev\n\nStart the development server with hot reload.\n\n```sh\nnpx cloud-run-functions dev [root]\n```\n\n- `root` is the directory to search for function entrypoints. Default is the current working directory\n- `--port, -p \u003cport\u003e` sets the port. Default is `8080`\n- `--define, -d \u003ckey:value\u003e` can be repeated. It passes `define` values to esbuild\n\n### build\n\nBundle your functions for deployment.\n\n```sh\nnpx cloud-run-functions build [root]\n```\n\n- `root` is the directory to search for function entrypoints. Default is the current working directory\n- `--outdir, -o \u003cdir\u003e` sets the output directory. Default is `dist`\n- `--define, -d \u003ckey:value\u003e` can be repeated. It passes `define` values to esbuild\n\nOutput:\n\n- Writes `index.js` and sourcemaps into `outdir`\n- Run it with the Functions Framework using the `build` target\n\nExample:\n\n```sh\nnpx cloud-run-functions build functions\nnpx functions-framework --target=build --source dist/index.js\n```\n\n### preview\n\nPreview bundled functions locally.\n\n```sh\nnpx cloud-run-functions preview [--outDir \u003cdir\u003e]\n```\n\n- `--outDir, -o \u003cdir\u003e` sets the directory containing the bundled output. Default is `dist`\n\nThis runs the Functions Framework using the `build` target and your bundled `index.js`.\n\n## Define values\n\nThe CLI format is `--define key:value` or `-d key:value`.\n\n- If `value` looks like a number, it is used as one\n- Otherwise it is treated as a string literal\n\nExamples:\n\n```sh\nnpx cloud-run-functions dev functions -d process.env.STAGE:dev\nnpx cloud-run-functions build functions -d __BUILD_ID__:123\n```\n\nIf you need full control over esbuild `define` values, use the programmatic API.\n\n## Configuration\n\nCreate a `crf.config.json` file. \\\nIt is searched for by walking up from the `root` directory you pass to the CLI.\n\nExample:\n\n```json\n{\n  \"root\": \"functions\",\n  \"entrySuffix\": \".task\",\n  \"adapter\": \"node\",\n  \"maxInstanceConcurrency\": 5\n}\n```\n\nOptions:\n\n- `root` string. base directory when searching for entry points. default is the config directory\n- `globs` string array. globs to search within `root`. default is `[\"**/*\"]`\n- `extensions` string array. file extensions to match. default is `[\".ts\", \".js\"]`\n- `entrySuffix` string. require a suffix like `.task` before the extension\n- `adapter` `\"node\"` or `\"hattip\"`. default is `\"node\"`\n- `maxInstanceConcurrency` number or record of `{ [routeName]: number }`. default is `5`. used by `dev` to limit concurrent requests per route\n\nAdapter notes:\n\n- `adapter: \"node\"` means your default export should be a Functions Framework handler `(req, res) =\u003e ...`\n- `adapter: \"hattip\"` means your default export should be a Hattip app and it will be wrapped at runtime\n\n## Dotenv support\n\nIf `dotenv` is installed, `dev` will load the closest `.env` file under your functions root.\nValues in `.env` do not override existing `process.env` values.\n\n## Programmatic API\n\nThe package also exports the underlying functions used by the CLI:\n\n```ts\nimport { build, dev, preview } from 'cloud-run-functions'\n```\n\nSee `src/index.ts` for the current exports and `src/tools/*.ts` for option types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fcloud-run-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Fcloud-run-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fcloud-run-functions/lists"}