{"id":18304665,"url":"https://github.com/yukinagae/genkit-firebase-functions-sample","last_synced_at":"2026-05-08T15:03:49.371Z","repository":{"id":248485552,"uuid":"827670016","full_name":"yukinagae/genkit-firebase-functions-sample","owner":"yukinagae","description":"Sample project for learning Firebase Genkit and deploying to Firebase Functions","archived":false,"fork":false,"pushed_at":"2024-11-18T13:06:53.000Z","size":650,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T04:42:56.466Z","etag":null,"topics":["firebase","firebase-functions","genkit","genkitx","openai","secret-manager"],"latest_commit_sha":null,"homepage":"https://medium.com/@yukinagae/deploying-your-firebase-genkit-application-with-firebase-functions-99c7d0044964","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukinagae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-07-12T06:17:06.000Z","updated_at":"2024-11-18T13:06:58.000Z","dependencies_parsed_at":"2024-11-05T15:34:46.339Z","dependency_job_id":"56afb3d7-0dc8-4280-86ff-29cd2baf4d69","html_url":"https://github.com/yukinagae/genkit-firebase-functions-sample","commit_stats":null,"previous_names":["yukinagae/genkit-firebase-functions-sample"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fgenkit-firebase-functions-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fgenkit-firebase-functions-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fgenkit-firebase-functions-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fgenkit-firebase-functions-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukinagae","download_url":"https://codeload.github.com/yukinagae/genkit-firebase-functions-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248021517,"owners_count":21034689,"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":["firebase","firebase-functions","genkit","genkitx","openai","secret-manager"],"created_at":"2024-11-05T15:29:54.559Z","updated_at":"2026-05-08T15:03:44.332Z","avatar_url":"https://github.com/yukinagae.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# genkit-firebase-functions-sample\n\n`genkit-firebase-functions-sample` is your starting point for learning about Firebase Genkit, an open-source framework that helps developers create AI-powered applications. This sample project not only introduces you to the basics of Genkit but also guides you through the process of integrating Firebase Functions.\n\n- [Requirements](#requirements)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Making Changes](#making-changes)\n- [License](#license)\n\n## Requirements\n\nBefore you start, make sure you have these installed:\n\n- **Node.js** version 22 or later\n- **npm**\n- **Genkit**\n- **Firebase CLI**\n\nFor Genkit installation, see the [Firebase Genkit - Get started](https://firebase.google.com/docs/genkit/get-started).\nFor Firebase CLI installation, see the [Firebase - Firebase CLI reference](https://firebase.google.com/docs/cli).\n\nCheck your installations by running:\n\n```bash\n$ node --version # the below version is on my environment\nv22.7.0\n$ npm --version # the below version is on my environment\n10.8.2\n$ genkit --version # the below version is on my environment\n0.9.1\n$ firebase --version # the below version is on my environment\n13.15.4\n```\n\n**Important**: Ensure all subsequent commands are executed within the `functions` directory. To navigate to this directory, use the command `cd functions` and verify your current working directory if necessary.\n\n## Setup\n\nInstall Project Dependencies: Open your terminal, navigate to this project's `functions` folder, and run:\n\n```bash\n$ npm install\n```\n\n## Usage\n\n### Running Genkit Locally\n\nBefore running the project locally, you need to provide your OpenAI API key. This key allows your application to communicate with OpenAI's services. Replace `your_api_key` with the actual API key you obtained from OpenAI.\n\n```bash\n$ export OPENAI_API_KEY=your_api_key\n```\n\nTo start the Genkit server on your local machine and automatically open your default web browser to http://localhost:4000, execute the following command in your terminal:\n\n```bash\n$ npm run genkit\n```\n\n### Firebase Functions Quickstart\n\n- **Setup**: Initialize your project with Firebase.\n- **Local Emulator**: Test functions locally.\n- **Deploy**: Publish your functions.\n\n#### Setup\n\nBefore deploying your application, complete the following preparatory steps:\n\n1. **Create a Firebase project**:\n\nNavigate to the Firebase Console. Click on `Create a project` and follow the prompts to create a new Firebase project.\n\n2. **Switch to the Blaze plan**:\n\nFirebase Functions require the `Blaze (Pay as you go) plan` for deployment. In the Firebase Console, select your project, then navigate to the left side bar section to change your plan.\n\n3. **Configure your Firebase project locally**:\n\nUpdate the .firebaserc file in your project's root directory to include your Firebase project name:\n\n```json\n{\n  \"projects\": {\n    \"default\": \"your_project_name\"\n  }\n}\n```\n\n#### Local Emulator\n\nTo facilitate local development and testing of Firebase Functions, use the Firebase Emulator Suite. Follow these steps to run your functions locally:\n\nTo run Firebase Functions locally using the emulator, set your OpenAI API key as an environment variable and start the emulator:\n\n```bash\n$ export OPENAI_API_KEY=your_api_key\n$ npm run emulator\n```\n\nTo test the function on the emulator, use the following `curl` command with a valid token (`token1234` in this project):\n\n```bash\n$  curl -X POST -H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer token1234\" \\\n-d '{\"data\":{\"url\":\"https://firebase.blog/posts/2024/04/next-announcements/\",\"lang\":\"English\"}}' \\\nhttp://127.0.0.1:5001/[your_project_name]/us-central1/summarizeFlow\n{\"result\":\"Firebase announced new features at Cloud Next '24, including Firestore vector search, Vertex AI SDKs, and public preview of Gemini integration.\"}\n```\n\nWith an invalid token:\n\n```bash\n$  curl -X POST -H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer invalid_token\" \\\n-d '{\"data\":{\"url\":\"https://firebase.blog/posts/2024/04/next-announcements/\",\"lang\":\"English\"}}' \\\nhttp://127.0.0.1:5001/[your_project_name]/us-central1/summarizeFlow\nUnauthorized\n```\n\n#### Deploy\n\nTo authenticate with Firebase and access your projects, use the Firebase CLI login command:\n\n```bash\n$ firebase login\n```\n\nTo keep your OpenAI API key safe when using Firebase Functions, store it as a secret in Google Clooud Secret Manger:\n\n```bash\n$ firebase functions:secrets:set OPENAI_API_KEY\n? Enter a value for OPENAI_API_KEY [input is hidden]\n```\n\nTo confirm your OpenAI API key is correctly stored as a secret, use the following command:\n\n```bash\n$ firebase functions:secrets:access OPENAI_API_KEY\nyour_api_key\n```\n\nAfter securing your API key, you're ready to deploy your application to Firebase Functions:\n\n```bash\n$ npm run deploy\n```\n\nTo monitor the behavior and troubleshoot your deployed functions, view the logs:\n\n```bash\n$ npm run logs\n```\n\nTo test your deployed function, execute the `curl` command below:\n\n```bash\n$  curl -X POST -H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer token1234\" \\\n-d '{\"data\":{\"url\":\"https://firebase.blog/posts/2024/04/next-announcements/\",\"lang\":\"English\"}}' \\\nhttps://summarizeflow-[your_function_id]-uc.a.run.app\n{\"result\":\"Firebase announced new features at Cloud Next '24, including Firestore vector search, Vertex AI SDKs, and public preview of Gemini integration.\"}\n```\n\nReplace `[your_function_id]` with your Firebase project value, found in the Firebase Console under the Functions Dashboard.\n\n## Making Changes\n\n### Building the Project\n\nAfter making changes, you might need to build the project to see your changes in action:\n\n```bash\n$ npm run build\n```\n\n### Formatting and Linting\n\nTo ensure your code follows the project's coding standards, run the formatting and linting tools:\n\n```bash\n$ npm run typecheck # type check without modifying files\n$ npm run check     # scan without modifying files\n$ npm run fix       # modify files\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinagae%2Fgenkit-firebase-functions-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukinagae%2Fgenkit-firebase-functions-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinagae%2Fgenkit-firebase-functions-sample/lists"}