https://github.com/alloc/cloud-run-functions
Develop and bundle your Cloud Run functions with ease
https://github.com/alloc/cloud-run-functions
cloud-run cloud-run-functions esbuild google-cloud javascript nodejs typescript
Last synced: 7 months ago
JSON representation
Develop and bundle your Cloud Run functions with ease
- Host: GitHub
- URL: https://github.com/alloc/cloud-run-functions
- Owner: alloc
- License: mit
- Created: 2025-05-08T15:07:24.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-05-29T18:46:57.000Z (8 months ago)
- Last Synced: 2025-06-17T00:48:01.959Z (8 months ago)
- Topics: cloud-run, cloud-run-functions, esbuild, google-cloud, javascript, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# cloud-run-functions
> ⚠️ This project is not ready for production use.
Enhances the `@google-cloud/functions-framework` package with "hot reloading" (for local development) and a bundler (for deployment).
```
pnpm add cloud-run-functions -D
```
## Development server
The dev server uses the `@google-cloud/functions-framework` package to run your functions locally. We handle _transpiling_ and _hot reloading_ for you. Just tell the dev server where to find your functions.
```sh
npx cloud-run-functions dev ./path/to/functions/
```
By default, any `.ts` or `.js` module is considered "loadable" by the dev server. This behavior is configurable with a `crf.config.json` file.
The dev server uses filesystem routing. By default, the dev server runs on port 8080. So if you do `http get :8080/hello` from your terminal, the dev server will look for a file called `hello.ts` or `hello.js` in the `./path/to/functions/` directory. If that file exists, its default export will be used as the function handler.
## Bundling
When you're ready to deploy, use the `build` command to bundle your functions.
```sh
npx cloud-run-functions build ./path/to/functions/
```
## Tips
- If you have the [dotenv](https://www.npmjs.com/package/dotenv) package installed, the dev server will import it and automatically load environment variables from the closest `.env` file. Note that environment variables in `.env` won't override existing `process.env` values.