{"id":23073543,"url":"https://github.com/nuxt-firebase/nuxt-flame","last_synced_at":"2025-08-15T16:31:10.560Z","repository":{"id":142207709,"uuid":"604916527","full_name":"nuxt-firebase/nuxt-flame","owner":"nuxt-firebase","description":"Google Firebase integration for your Nuxt 3 project","archived":false,"fork":false,"pushed_at":"2023-04-07T04:17:20.000Z","size":610,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-24T18:07:42.569Z","etag":null,"topics":["cloud-functions","cloud-storage","firebase","firebase-auth","firestore","google","nuxt","realtime-database"],"latest_commit_sha":null,"homepage":"","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/nuxt-firebase.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-02-22T03:37:19.000Z","updated_at":"2024-03-24T23:12:39.000Z","dependencies_parsed_at":"2024-11-15T21:12:19.321Z","dependency_job_id":"fe186716-72a6-4abd-b5c4-233623fbd1d9","html_url":"https://github.com/nuxt-firebase/nuxt-flame","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-firebase%2Fnuxt-flame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-firebase%2Fnuxt-flame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-firebase%2Fnuxt-flame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-firebase%2Fnuxt-flame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuxt-firebase","download_url":"https://codeload.github.com/nuxt-firebase/nuxt-flame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229883026,"owners_count":18138928,"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-functions","cloud-storage","firebase","firebase-auth","firestore","google","nuxt","realtime-database"],"created_at":"2024-12-16T08:18:13.215Z","updated_at":"2024-12-16T08:18:13.791Z","avatar_url":"https://github.com/nuxt-firebase.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Nuxt Flame logo](https://raw.githubusercontent.com/nuxt-firebase/nuxt-flame/main/playground/assets/nuxt-flame.png)\n\n# 🔥 Nuxt Flame\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n\nEasily integrate Google Firebase into your Nuxt 3 application\n\n## 🦾 Features\n\n- ⛰ \u0026nbsp;Firebase Auth, Firestore, Realtime Database, Cloud Functions and Cloud Storage\n- 🧪 \u0026nbsp;Emulators support\n- \u003cimg src=\"https://raw.githubusercontent.com/nuxt-firebase/nuxt-flame/main/playground/assets/typescript.svg\" width=\"19\" alt=\"TypeScript Logo\" /\u003e \u0026nbsp;TypeScript support\n- 🔋 \u0026nbsp;SSR Friendly\n- 🔐 \u0026nbsp;Safe\n- 🪶 \u0026nbsp;Light\n\n---\n\n- [🏗️ \u0026nbsp;Installation](#installation)\n- [⚙️ \u0026nbsp;Usage](#usage)\n  - [Apps](#firebase-apps)\n  - [Auth](#firebase-auth)\n  - [Firestore](#firestore)\n    - [Documents](#documents)\n    - [Collections](#collections)\n    - [Collection Queries](#collection-queries)\n  - [Cloud Functions](#cloud-functions)\n  - [Realtime Database](#realtime-database)\n  - [Cloud Storage](#cloud-storage)\n  - [Enable Emulators](#enable-emulators)\n- [🛣️ \u0026nbsp;Roadmap](#roadmap)\n\n## 🏗️ Installation\n\n1. Add `nuxt-flame` dependency to your project\n```bash\n# Using pnpm\npnpm add -D nuxt-flame firebase firebase-admin\n\n# Using yarn\nyarn add --dev nuxt-flame firebase firebase-admin\n\n# Using npm\nnpm install --save-dev nuxt-flame firebase firebase-admin\n```\n\n2. Add `nuxt-flame` to the `modules` section of `nuxt.config.ts` and specify Firebase credentials in `runtimeConfig`\n```ts\nexport default defineNuxtConfig({\n  modules: [\n    \"nuxt-flame\"\n  ],\n\n  runtimeConfig: {\n    firebaseAdminCredentials: {\n      projectId: process.env.FIREBASE_PROJECT_ID,\n      clientEmail: process.env.FIREBASE_CLIENT_EMAIL,\n      privateKey: process.env.FIREBASE_PRIVATE_KEY,\n    },\n\n    public: {\n      firebaseCredentials: {\n        apiKey: process.env.FIREBASE_API_KEY,\n        authDomain: process.env.FIREBASE_AUTH_DOMAIN,\n        projectId: process.env.FIREBASE_PROJECT_ID,\n        storageBucket: process.env.FIREBASE_STORAGE_BUCKET,\n        messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,\n        appId: process.env.FIREBASE_APP_ID,\n        measurementId: process.env.FIREBASE_MEASUREMENT_ID,\n      },\n    },\n  },\n})\n```\n\n3. Create `.env` file and put your credentials there\n```ts\n// Web credentials from code snippet provided by Google Firebase\nFIREBASE_API_KEY=********\nFIREBASE_AUTH_DOMAIN=********\nFIREBASE_PROJECT_ID=********\nFIREBASE_STORAGE_BUCKET=********\nFIREBASE_MESSAGING_SENDER_ID=********\nFIREBASE_APP_ID=********\nFIREBASE_MEASUREMENT_ID=********\n\n// Admin credentials from service account key (JSON)\nFIREBASE_CLIENT_EMAIL=********\nFIREBASE_PRIVATE_KEY=\"-----BEGIN PRIVATE KEY-----\n****************************************************\n****************************************************\n****************************************************\n****************************************************\n****************************************************\n****************************************************\n**************************\n-----END PRIVATE KEY-----\"\n```\n\n4. **(Optional)** Feel free to configure Nuxt Flame in `nuxt.config.ts`\n```ts\nexport default defineNuxtConfig({\n  // ...\n\n  /**\n   * Default Nuxt Flame settings\n   */\n  flame: {\n    authApiEndpoint: \"/api/__session\",\n    authCookieName: \"__session\",\n\n    emulators: {\n      enabled: false,\n\n      auth: {\n        enabled: false,\n        url: \"http://127.0.0.1:9099\",\n        options: {\n          disableWarnings: false,\n        },\n      },\n\n      firestore: {\n        enabled: false,\n        host: \"127.0.0.1\",\n        port: 8080,\n      },\n\n      database: {\n        enabled: false,\n        host: \"127.0.0.1\",\n        port: 9000,\n      },\n\n      functions: {\n        enabled: false,\n        host: \"127.0.0.1\",\n        port: 5001,\n      },\n\n      storage: {\n        enabled: false,\n        host: \"127.0.0.1\",\n        port: 9199,\n      },\n    },\n  },\n\n  // ...\n})\n```\n\nThat's it! You can now use Nuxt Flame in your Nuxt app ✨\n\n## Usage\n\nNuxt Flame exports bunch of Firebase helpers (Vue composables) that available both client and server side.\n\n\n### Firebase Apps\n```ts\nconst app = useFirebaseApp()        // client-side\nconst admin = useFirebaseAdminApp() // server-side\n```\n\n### Firebase Auth\n\nBasic usage:\n```ts\n// Firebase Auth instance (client only)\nconst auth = useAuth()\n\n// Firebase Auth instance with admin credentials (server only)\nconst auth = useServerAuth()\n\n// Get current user\n// ❗️ Client returns `User` object when server returns `DecodedIdToken` object\nconst currentUser = useCurrentUser()\n```\n\nAuthentication example using Google provider:\n```ts\nimport { GoogleAuthProvider, signInWithPopup, signOut } from \"@firebase/auth\"\nimport { useAuth, useCurrentUser } from \"#imports\"\n\nconst auth = useAuth()\nconst currentUser = useCurrentUser()\n\nconst login = async () =\u003e {\n  if (!auth) return\n\n  await signInWithPopup(auth, new GoogleAuthProvider())\n}\n\nconst logout = async () =\u003e {\n  if (!auth) return\n\n  await signOut(auth)\n}\n```\n\n### Firestore\n\nGet Firebase Firestore instance:\n```ts\nconst db = useFirestore()\n```\n\n#### Documents\n```ts\n// Get single document (SSR friendly)\nconst post = await useAsyncDocument(\"posts\", \"1\")\n\n// Get single document (async)\nconst { data, loading, error, refresh } = useDocument(\"posts\", \"1\")\n\n// Subscribe to document changes\nconst { data, loading, error, unsubscribe } = useDocumentSubscribe(\"posts\", \"1\")\n\n// Don't forget to unsubsribe\nonUnmounted(() =\u003e unsubscribe())\n```\n\n#### Collections\n```ts\n// Get collection documents (SSR friendly)\nconst posts = await useAsyncCollection(\"posts\")\n\n// Get collection documents (async)\nconst { data, loading, error, refresh } = useCollection(\"posts\")\n\n// Subscribe to collection changes\nconst { data, loading, error, unsubscribe } = useCollectionSubscribe(\"posts\")\n\n// Don't forget to unsubsribe\nonUnmounted(() =\u003e unsubscribe())\n```\n\n#### Collection Queries\n```ts\nimport { where, orderBy } from \"firebase/firestore\"\n\n// Get collection documents with query (SSR friendly)\nconst posts = await useAsyncCollection(\"posts\", {\n  conditions: [\n    where(\"author\", \"==\", \"Andrew Kodkod\"),\n    orderBy(\"createdAt\", \"desc\"),\n  ],\n})\n\n// Get collection documents with query (async)\nconst { data, loading, error, refresh } = useCollection(\"posts\", {\n  conditions: [\n    where(\"author\", \"==\", \"Andrew Kodkod\"),\n    orderBy(\"createdAt\", \"desc\"),\n  ],\n})\n```\n\n### Cloud Functions\n\nGet Firebase Cloud Functions instance:\n```ts\nconst functions = useFunctions()\n```\n\nCall https callable Cloud Function:\n```ts\nconst archivePost = useFunction(\"archivePost\")\n\nconst onArchive = async () =\u003e {\n  const result = await archivePost.performAsync({ postId: \"1\", reason: \"Spam\" })\n}\n```\n\n### Realtime Database\n\nGet Firebase Realtime Database instance:\n```ts\nconst db = useDatabase()\n```\n\n### Cloud Storage\n\nGet Firebase Cloud Storage instance:\n```ts\nconst storage = useStorage()\n```\n\n### Enable Emulators\n```ts\n// nuxt.config.ts\n\nexport default defineNuxtConfig({\n  // ...\n\n  flame: {\n    emulators: {\n      enabled: process.env.NODE_ENV !== \"production\",\n    }\n  }\n\n  // ...\n})\n```\n\n## 🛣️ Roadmap\n\n- [ ] Tests\n- [ ] TypeScript examples\n- [ ] Advanced usage examples\n- [x] Helpers for Firestore\n- [x] Helpers for Functions\n- [ ] Helpers for Storage\n- [ ] Helpers for Realtime Database\n\n## 👩‍💻 Development\n\n```bash\n# Install dependencies\npnpm install\n\n# Generate type stubs\npnpm run dev:prepare\n\n# Develop with the playground\npnpm run dev\n\n# Build the playground\npnpm run dev:build\n\n# Run ESLint\npnpm run lint\n\n# Run Vitest\npnpm run test\npnpm run test:watch\n\n# Release new version\npnpm run release\n```\n\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-flame/latest.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-version-href]: https://npmjs.com/package/nuxt-flame\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-flame.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-downloads-href]: https://npmjs.com/package/nuxt-flame\n\n[license-src]: https://img.shields.io/npm/l/nuxt-flame.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[license-href]: https://npmjs.com/package/nuxt-flame\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-firebase%2Fnuxt-flame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuxt-firebase%2Fnuxt-flame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-firebase%2Fnuxt-flame/lists"}