Skip to content

Add Firebase AI SDK sample app #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Firebase AI SDK Quickstart

This directory contains samples for the Firebase AI SDK for Web.

## Table of Contents

1. **Firebase AI Logic Sample App (`ai-react-app/`)**: demonstrates features of the Firebase AI SDK for Web integrated into a web application built with React and TypeScript.
1 change: 1 addition & 0 deletions ai/ai-react-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
33 changes: 33 additions & 0 deletions ai/ai-react-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Firebase AI Logic Sample App

![Photo of the Firebase AI Logic Sample App](images/screenshot.png)

This sample application demonstrates features of the Firebase AI SDK for Web (`firebase/ai`), integrated into a web application built with React and TypeScript.

For more information about the Firebase AI SDK, see the [Firebase AI Logic Docs](https://firebase.google.com/docs/ai-logic).

## Setup Instructions

1. Use the guided workflow in the [Firebase AI Logic page](https://console.firebase.google.com/project/_/ailogic?_gl=1*dps5w8*_ga*NDk4MDUyODg4LjE3NDc4NTIwMDA.*_ga_CW55HF8NVT*czE3NDc5MzE2NzQkbzIkZzEkdDE3NDc5MzE3MjEkajEzJGwwJGgwJGRjVEhnTE1XMmtOQURjUXFPa18zZlRTU2JIblVCY0tTenN3) of the Firebase Console to setup your project (including enabling the required APIs for your chosen Gemini API provider), then register your app with your Firebase project.

1. Update `src/config/firebase-config.ts` with your Firebase configuration.

1. Install dependencies:

```bash
yarn
```

1. Start the development server:

```bash
yarn dev
```

## Support

- [Firebase Support](https://firebase.google.com/support/)

## License

© Google, 2025. Licensed under an [Apache-2](../LICENSE)
30 changes: 30 additions & 0 deletions ai/ai-react-app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import eslintConfigPrettier from "eslint-config-prettier/flat"

export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
eslintConfigPrettier
);
6 changes: 6 additions & 0 deletions ai/ai-react-app/firebase-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/ai-react-app/images/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions ai/ai-react-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/firebase-icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Firebase AI Sample App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading