{"_id":"@atechhub/firebase","_rev":"5-eb7f8389ac06ab0781eceb6bfd27d23b","name":"@atechhub/firebase","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@atechhub/firebase","version":"0.0.1","keywords":["firebase","react","auth","storage","database"],"author":{"name":"A Tech Hub"},"license":"MIT","_id":"@atechhub/firebase@0.0.1","maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"dist":{"shasum":"cbea02dcc1c56d0510ab1562c23c0090fefddc9e","tarball":"https://registry.npmjs.org/@atechhub/firebase/-/firebase-0.0.1.tgz","fileCount":8,"integrity":"sha512-KlxyvVPi69cXmAAR+gy2t9gEcDASMDylROWH97y9S4HX2CjvLQC3v/KY6GQjFmZcgOGLrUXy3kY9qOGvCZEhyA==","signatures":[{"sig":"MEQCIG7w+9Y6NDgP3YYRdDX5SW89Zy0zLI+gwBcHjcwN+PtxAiBfIfzUIkxUJSHmLf47cHC7G/exHTtL0JTPJYf6TocaJw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51375},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"fd0e8209b796c5435a4660e8c2a76f20ff750c7d","scripts":{"build":"tsup"},"_npmUser":{"name":"atechhub24","email":"atechhub24.7@gmail.com"},"repository":{"url":"git@github-atech:atechhub24/firebase.git","type":"git"},"_npmVersion":"11.6.0","description":"All the firebase utils once place","directories":{},"_nodeVersion":"24.6.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.2"},"peerDependencies":{"firebase":"^12.2.1"},"_npmOperationalInternal":{"tmp":"tmp/firebase_0.0.1_1758004239492_0.844141762377222","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@atechhub/firebase","version":"0.0.2","keywords":["firebase","react","auth","storage","database"],"author":{"name":"A Tech Hub"},"license":"MIT","_id":"@atechhub/firebase@0.0.2","maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"dist":{"shasum":"efcbc5859cb7712f12c83ffd18e3bbc929f914bb","tarball":"https://registry.npmjs.org/@atechhub/firebase/-/firebase-0.0.2.tgz","fileCount":8,"integrity":"sha512-OWAd8lOGUty4SYAIkQcg/DMCz+AClDWgbOys4y1GTqIlfqsPu6ez1y/9Xns3QDTB7hnAzMlOWUYYl3qZTFHxrQ==","signatures":[{"sig":"MEQCIFNK95D5ZNvBKJi55JWqrRGNA1DUmANqbkzl1WPBOl71AiBPZ+c4E8QqXPSaciy2kq7YHtRwliZ3/y9AmseDXvLa9g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56291},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"f3f0c90d9ee0c181f4747e9221104c4c555860f8","scripts":{"build":"tsup"},"_npmUser":{"name":"atechhub24","email":"atechhub24.7@gmail.com"},"repository":{"url":"git@github-atech:atechhub24/firebase.git","type":"git"},"_npmVersion":"11.6.0","description":"All the firebase utils once place","directories":{},"_nodeVersion":"24.6.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.2"},"peerDependencies":{"firebase":"^12.2.1"},"_npmOperationalInternal":{"tmp":"tmp/firebase_0.0.2_1758565081513_0.4839601875790296","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@atechhub/firebase","version":"0.0.3","keywords":["firebase","react","auth","storage","database"],"author":{"name":"A Tech Hub"},"license":"MIT","_id":"@atechhub/firebase@0.0.3","maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"dist":{"shasum":"5cf37129a9fcadcb80565b259386a0029b73b016","tarball":"https://registry.npmjs.org/@atechhub/firebase/-/firebase-0.0.3.tgz","fileCount":8,"integrity":"sha512-ne3wfLihwSuTlB0XB6tbmc9XnwylG8GaIUhK/fM5sMCzP9mu4HJpKDoOzKZle7IlXWmCi/NwD6CYh0niMojstQ==","signatures":[{"sig":"MEUCIA8tsqwUTMMunOhlg3HDt3y1qQ1fsBqmMUCsENgyXW5BAiEA+5C40G5gAMjaf06QKWdnVN/AXfdyygW//Jxe5pLQdQ8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56291},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"06edf4a339955db1c2676cdff1ea7dc403d53e9b","scripts":{"build":"tsup"},"_npmUser":{"name":"atechhub24","email":"atechhub24.7@gmail.com"},"repository":{"url":"git@github-atech:atechhub24/firebase.git","type":"git"},"_npmVersion":"11.6.0","description":"All the firebase utils once place","directories":{},"_nodeVersion":"24.6.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.2"},"peerDependencies":{"firebase":"^12.2.1"},"_npmOperationalInternal":{"tmp":"tmp/firebase_0.0.3_1758565266391_0.2922435074687393","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@atechhub/firebase","version":"0.0.4","keywords":["firebase","react","auth","storage","database"],"author":{"name":"A Tech Hub"},"license":"MIT","_id":"@atechhub/firebase@0.0.4","maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"dist":{"shasum":"4423bccda7466c9941819ae702ff35821c05902c","tarball":"https://registry.npmjs.org/@atechhub/firebase/-/firebase-0.0.4.tgz","fileCount":8,"integrity":"sha512-S6b9ZRLqXlzZpslpJqeVb7t9lH6aK/Em2b0vUNEAQ4vrRhUEkuk8HdpCzFJPqD0vkX4XjCGhZO+sjKQoKDjmKw==","signatures":[{"sig":"MEYCIQCo/BSjtmdtHD/2p0e24Bvi8GGsUPj4Grn9DRPEXJZiFwIhAPMQDmWbTVDF2iJyeCBqbc3UgE2nAhCgMsQuiJSUJCb0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":94745},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"a978316e682a87551ff3239820ed1ca8348ee715","scripts":{"build":"tsup"},"_npmUser":{"name":"atechhub24","email":"atechhub24.7@gmail.com"},"repository":{"url":"git@github-atech:atechhub24/firebase.git","type":"git"},"_npmVersion":"11.6.0","description":"All the firebase utils once place","directories":{},"_nodeVersion":"24.6.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.2"},"peerDependencies":{"firebase":"^12.2.1"},"_npmOperationalInternal":{"tmp":"tmp/firebase_0.0.4_1758565574953_0.7276965414125354","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@atechhub/firebase","version":"0.0.5","description":"All the firebase utils once place","keywords":["firebase","react","auth","storage","database"],"repository":{"type":"git","url":"git+https://github.com/atechhub24/firebase.git"},"homepage":"https://firebase.atechhub247.com/","license":"MIT","author":{"name":"A Tech Hub"},"type":"module","main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup"},"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.2"},"peerDependencies":{"firebase":"^12.2.1"},"_id":"@atechhub/firebase@0.0.5","gitHead":"8615a1d32b2db2e2db40a6e849d555e6dfb3689b","bugs":{"url":"https://github.com/atechhub24/firebase/issues"},"_nodeVersion":"24.6.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-MoT/RptS0yz2npXh6laLJf6rUkGgKqWmlZUPAGlJFejM5McvzlPPXwUb4H1r4L9BmzJtDEcCZBAP3VmBPwkQ4g==","shasum":"5d7b24bbdec2cb2fa760e0740196d8207937d615","tarball":"https://registry.npmjs.org/@atechhub/firebase/-/firebase-0.0.5.tgz","fileCount":8,"unpackedSize":104063,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDXbwsPpMTbUE6eFa7gEG3fps1JlikaYjFTorXEQbxV5wIgNl1leBTOsuQb+G3kkKmHJ+5ek7wGQ3vjEdHR4gpw0Pw="}]},"_npmUser":{"name":"atechhub24","email":"atechhub24.7@gmail.com"},"directories":{},"maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/firebase_0.0.5_1759023173222_0.3796677508565591"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-16T06:30:39.340Z","modified":"2025-09-28T01:32:53.639Z","0.0.1":"2025-09-16T06:30:39.686Z","0.0.2":"2025-09-22T18:18:01.717Z","0.0.3":"2025-09-22T18:21:06.609Z","0.0.4":"2025-09-22T18:26:15.153Z","0.0.5":"2025-09-28T01:32:53.412Z"},"author":{"name":"A Tech Hub"},"license":"MIT","keywords":["firebase","react","auth","storage","database"],"repository":{"type":"git","url":"git+https://github.com/atechhub24/firebase.git"},"description":"All the firebase utils once place","maintainers":[{"name":"atechhub24","email":"atechhub24.7@gmail.com"}],"readme":"# 🔥 @atechhub/firebase\n\n**The Ultimate Firebase Utilities Package** - Supercharge your Firebase development with powerful, ready-to-use utilities for Realtime Database and Storage operations.\n\n[![npm version](https://badge.fury.io/js/@atechhub%2Ffirebase.svg)](https://badge.fury.io/js/@atechhub%2Ffirebase)\n[![Downloads](https://img.shields.io/npm/dt/@atechhub/firebase.svg)](https://www.npmjs.com/package/@atechhub/firebase)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## ✨ Why Choose @atechhub/firebase?\n\n- 🚀 **Production Ready** - Battle-tested utilities used in real applications\n- 🎯 **Zero Config** - Works with your existing Firebase setup\n- 📝 **TypeScript First** - Full type safety and IntelliSense support\n- 🔧 **Developer Friendly** - Intuitive API with comprehensive error handling\n- 📊 **Smart Tracking** - Built-in metadata and system info for all operations\n- 🛡️ **Data Safety** - Automatic undefined field removal and validation\n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\nnpm install @atechhub/firebase\n# or\npnpm add @atechhub/firebase\n# or\nbun add @atechhub/firebase\n```\n\n### Setup\n\n```typescript\n// Initialize Firebase (your existing setup)\nimport { initializeApp } from \"firebase/app\";\nimport { getDatabase } from \"firebase/database\";\nimport { getStorage } from \"firebase/storage\";\n\nconst app = initializeApp(firebaseConfig);\nconst db = getDatabase(app);\nconst storage = getStorage(app);\n\n// Import and use our utilities\nimport { mutate, file } from \"@atechhub/firebase\";\n```\n\n## 🔐 REST Auth (Email/Password)\n\nAdd lightweight REST-based auth helpers for environments where you don't want to pull the full Firebase Auth SDK.\n\n### Configure\n\n```typescript\nimport { configureAuth } from \"@atechhub/firebase\";\n\nconfigureAuth({\n  authUrl: \"https://identitytoolkit.googleapis.com/v1/accounts\",\n  apiKey: \"your-firebase-web-api-key\",\n});\n// Or via env vars:\n// NEXT_PUBLIC_FIREBASE_AUTH_URL=https://identitytoolkit.googleapis.com/v1/accounts\n// NEXT_PUBLIC_FIREBASE_API_KEY=your-firebase-web-api-key\n```\n\n### Use\n\n```typescript\nimport {\n  createUser,\n  changePassword,\n  deleteUser,\n  FirebaseAuthError,\n} from \"@atechhub/firebase\";\n\n// Register\nconst user = await createUser(\"user@example.com\", \"securePassword123\");\n\n// Change password\nawait changePassword(\n  \"user@example.com\",\n  \"currentPassword123\",\n  \"newSecurePassword456\"\n);\n\n// Delete account\nawait deleteUser(\"user@example.com\", \"currentPassword123\");\n```\n\n### Error handling\n\n```typescript\ntry {\n  await createUser(email, password);\n} catch (error) {\n  if (error instanceof FirebaseAuthError) {\n    // error.code may be 400/401/409/429 etc.\n    console.error(\"Auth error:\", error.message, error.code);\n  }\n}\n```\n\n### Types\n\n```typescript\nimport type {\n  SignupResponse,\n  UpdateResponse,\n  DeleteResponse,\n  FirebaseAuthConfig,\n} from \"@atechhub/firebase\";\n```\n\n## 🔑 SDK Auth (Email/Password)\n\nUse Firebase Auth SDK with a clean, type-safe interface for email/password authentication.\n\n### Setup\n\n```typescript\nimport { initializeApp } from \"firebase/app\";\nimport { getAuth } from \"firebase/auth\";\n\nconst app = initializeApp(firebaseConfig);\nconst auth = getAuth(app);\n\n// Import our auth helper\nimport { firebaseAuth } from \"@atechhub/firebase\";\n```\n\n### Usage\n\n```typescript\nimport { firebaseAuth } from \"@atechhub/firebase\";\n\n// 🔐 LOGIN - Sign in existing user\nconst userCredential = await firebaseAuth({\n  action: \"login\",\n  email: \"user@example.com\",\n  password: \"securePassword123\",\n});\n\nconsole.log(\"User signed in:\", userCredential.user.uid);\n\n// 📝 SIGNUP - Create new user\nconst newUserCredential = await firebaseAuth({\n  action: \"signup\",\n  email: \"newuser@example.com\",\n  password: \"securePassword123\",\n});\n\nconsole.log(\"User created:\", newUserCredential.user.uid);\n\n// 🚪 LOGOUT - Sign out current user\nawait firebaseAuth({\n  action: \"logout\",\n});\n\n// 🔄 CHANGE PASSWORD - Update user password\nawait firebaseAuth({\n  action: \"changePassword\",\n  newPassword: \"newSecurePassword456\",\n});\n```\n\n### Error Handling\n\n```typescript\ntry {\n  await firebaseAuth({\n    action: \"login\",\n    email: \"user@example.com\",\n    password: \"wrongPassword\",\n  });\n} catch (error) {\n  if (error.code === \"auth/user-not-found\") {\n    console.error(\"User does not exist\");\n  } else if (error.code === \"auth/wrong-password\") {\n    console.error(\"Incorrect password\");\n  } else if (error.code === \"auth/invalid-email\") {\n    console.error(\"Invalid email format\");\n  } else {\n    console.error(\"Authentication error:\", error.message);\n  }\n}\n```\n\n### React Hook Example\n\n```typescript\nimport { useState } from \"react\";\nimport { firebaseAuth } from \"@atechhub/firebase\";\n\nexport const useAuth = () => {\n  const [loading, setLoading] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n\n  const login = async (email: string, password: string) => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      const result = await firebaseAuth({\n        action: \"login\",\n        email,\n        password,\n      });\n      setLoading(false);\n      return result;\n    } catch (err: any) {\n      setError(err.message);\n      setLoading(false);\n      throw err;\n    }\n  };\n\n  const signup = async (email: string, password: string) => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      const result = await firebaseAuth({\n        action: \"signup\",\n        email,\n        password,\n      });\n      setLoading(false);\n      return result;\n    } catch (err: any) {\n      setError(err.message);\n      setLoading(false);\n      throw err;\n    }\n  };\n\n  const logout = async () => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      await firebaseAuth({ action: \"logout\" });\n      setLoading(false);\n    } catch (err: any) {\n      setError(err.message);\n      setLoading(false);\n      throw err;\n    }\n  };\n\n  const changePassword = async (newPassword: string) => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      await firebaseAuth({\n        action: \"changePassword\",\n        newPassword,\n      });\n      setLoading(false);\n    } catch (err: any) {\n      setError(err.message);\n      setLoading(false);\n      throw err;\n    }\n  };\n\n  return {\n    login,\n    signup,\n    logout,\n    changePassword,\n    loading,\n    error,\n  };\n};\n```\n\n### Types\n\n```typescript\nimport type {\n  LoginAction,\n  SignupAction,\n  LogoutAction,\n  ChangePasswordAction,\n  AuthActionPayload,\n} from \"@atechhub/firebase\";\n```\n\n## 📊 Realtime Database Operations\n\n### The Power of `mutate()` Function\n\nOne function, infinite possibilities. Handle all your database operations with a single, powerful method:\n\n```typescript\nimport { mutate } from \"@atechhub/firebase\";\n\n// 📝 CREATE - Add new data\nawait mutate({\n  action: \"create\",\n  path: \"users/user123\",\n  data: {\n    name: \"John Doe\",\n    email: \"john@example.com\",\n    role: \"admin\",\n  },\n  actionBy: \"admin-panel\",\n});\n\n// 📝 CREATE WITH AUTO-ID - Let Firebase generate unique IDs\nconst newUserId = await mutate({\n  action: \"createWithId\",\n  path: \"users\",\n  data: {\n    name: \"Jane Smith\",\n    email: \"jane@example.com\",\n  },\n});\n\n// ✏️ UPDATE - Modify existing data\nawait mutate({\n  action: \"update\",\n  path: \"users/user123\",\n  data: {\n    lastLogin: new Date().toISOString(),\n    status: \"active\",\n  },\n  actionBy: \"user-login\",\n});\n\n// 📖 READ - Fetch data\nconst userData = await mutate({\n  action: \"get\",\n  path: \"users/user123\",\n});\n\n// 🗑️ DELETE - Remove data\nawait mutate({\n  action: \"delete\",\n  path: \"users/user123\",\n  actionBy: \"admin-cleanup\",\n});\n\n// 👁️ REAL-TIME LISTENING - Subscribe to changes\nconst unsubscribe = await mutate({\n  action: \"onValue\",\n  path: \"users\",\n  actionBy: \"dashboard\",\n});\n```\n\n### 🎯 Smart Features\n\n**Automatic System Tracking** - Every operation includes:\n\n```typescript\n{\n  timestamp: \"2024-01-15T10:30:00.000Z\",\n  actionBy: \"your-identifier\",\n  userAgent: \"Mozilla/5.0...\",\n  platform: \"MacIntel\",\n  language: \"en-US\",\n  screenResolution: \"1920x1080\",\n  browser: \"Chrome\"\n}\n```\n\n**Data Sanitization** - Automatically removes undefined fields:\n\n```typescript\nconst messyData = {\n  name: \"John\",\n  age: undefined, // ❌ Will be removed\n  email: \"john@example.com\",\n  profile: {\n    bio: undefined, // ❌ Will be removed\n    avatar: \"url\",\n  },\n};\n\n// Clean data is automatically saved ✨\nawait mutate({\n  action: \"create\",\n  path: \"users/clean\",\n  data: messyData, // Only defined fields will be saved\n});\n```\n\n## 📁 Storage Operations\n\n### File Upload with Progress Tracking\n\n```typescript\nimport { file } from \"@atechhub/firebase\";\n\n// 📤 UPLOAD with progress tracking\nconst result = await file.upload({\n  file: selectedFile,\n  path: \"uploads/documents/contract.pdf\",\n  metadata: {\n    department: \"legal\",\n    confidential: \"true\",\n  },\n  onProgress: (progress) => {\n    console.log(`Upload: ${progress}% complete`);\n    // Update your progress bar here\n  },\n  uploadedBy: \"user123\",\n});\n\nconsole.log(result);\n// Returns:\n// {\n//   url: \"https://firebasestorage.googleapis.com/...\",\n//   path: \"uploads/documents/contract.pdf\",\n//   name: \"contract.pdf\",\n//   type: \"application/pdf\",\n//   size: 1024000,\n//   metadata: {\n//     department: \"legal\",\n//     confidential: \"true\",\n//     uploadedBy: \"user123\",\n//     uploadedAt: \"2024-01-15T10:30:00.000Z\"\n//   }\n// }\n```\n\n### File Management\n\n```typescript\n// 📋 LIST files with metadata\nconst files = await file.list(\"uploads/images/\");\n\nfiles.forEach((file) => {\n  console.log({\n    name: file.name,\n    url: file.url,\n    size: file.size,\n    uploadedAt: file.customMetadata?.uploadedAt,\n    uploadedBy: file.customMetadata?.uploadedBy,\n  });\n});\n\n// 🗑️ DELETE files\nawait file.delete(\"uploads/old-file.jpg\");\n```\n\n## 🎨 Real-World Use Cases\n\n### 1. User Management System\n\n```typescript\n// User registration with tracking\nconst userId = await mutate({\n  action: \"createWithId\",\n  path: \"users\",\n  data: {\n    email: \"user@example.com\",\n    displayName: \"John Doe\",\n    role: \"user\",\n    preferences: {\n      theme: \"dark\",\n      notifications: true,\n    },\n  },\n  actionBy: \"registration-form\",\n});\n\n// Update user profile\nawait mutate({\n  action: \"update\",\n  path: `users/${userId}`,\n  data: {\n    lastActive: new Date().toISOString(),\n    profileComplete: true,\n  },\n  actionBy: \"profile-update\",\n});\n```\n\n### 2. Document Management\n\n```typescript\n// Upload document with metadata\nconst uploadResult = await file.upload({\n  file: document,\n  path: `documents/${userId}/reports/annual-report.pdf`,\n  metadata: {\n    category: \"reports\",\n    year: \"2024\",\n    department: \"finance\",\n    confidential: \"true\",\n  },\n  uploadedBy: userId,\n});\n\n// Save document reference in database\nawait mutate({\n  action: \"create\",\n  path: `users/${userId}/documents/${Date.now()}`,\n  data: {\n    fileName: uploadResult.name,\n    fileUrl: uploadResult.url,\n    fileSize: uploadResult.size,\n    category: \"reports\",\n    tags: [\"annual\", \"finance\", \"2024\"],\n  },\n  actionBy: \"document-upload\",\n});\n```\n\n### 3. Real-time Chat System\n\n```typescript\n// Send message\nawait mutate({\n  action: \"createWithId\",\n  path: \"chats/room123/messages\",\n  data: {\n    text: \"Hello everyone!\",\n    senderId: \"user456\",\n    timestamp: new Date().toISOString(),\n    type: \"text\",\n  },\n  actionBy: \"chat-send\",\n});\n\n// Listen for new messages\nconst unsubscribe = await mutate({\n  action: \"onValue\",\n  path: \"chats/room123/messages\",\n  actionBy: \"chat-listener\",\n});\n```\n\n### 4. E-commerce Inventory\n\n```typescript\n// Add product\nawait mutate({\n  action: \"create\",\n  path: \"products/prod123\",\n  data: {\n    name: \"Wireless Headphones\",\n    price: 99.99,\n    stock: 50,\n    category: \"electronics\",\n    images: [\"url1\", \"url2\"],\n    specifications: {\n      battery: \"20 hours\",\n      connectivity: \"Bluetooth 5.0\",\n    },\n  },\n  actionBy: \"inventory-manager\",\n});\n\n// Update stock after purchase\nawait mutate({\n  action: \"update\",\n  path: \"products/prod123\",\n  data: {\n    stock: 49,\n    lastSold: new Date().toISOString(),\n  },\n  actionBy: \"checkout-system\",\n});\n```\n\n## 🛠️ Advanced Features\n\n### Error Handling\n\n```typescript\ntry {\n  const result = await mutate({\n    action: \"get\",\n    path: \"users/nonexistent\",\n  });\n} catch (error) {\n  if (error.message === \"Firebase not initialized\") {\n    // Handle initialization error\n  }\n  // Handle other errors\n}\n```\n\n### Batch Operations\n\n```typescript\n// Multiple operations in sequence\nconst operations = [\n  { action: \"create\", path: \"users/1\", data: { name: \"User 1\" } },\n  { action: \"create\", path: \"users/2\", data: { name: \"User 2\" } },\n  { action: \"create\", path: \"users/3\", data: { name: \"User 3\" } },\n];\n\nfor (const op of operations) {\n  await mutate(op);\n}\n```\n\n## 📋 API Reference\n\n### `mutate(options)`\n\n| Parameter  | Type     | Required | Description                                                                |\n| ---------- | -------- | -------- | -------------------------------------------------------------------------- |\n| `action`   | `string` | ✅       | `\"create\"`, `\"createWithId\"`, `\"update\"`, `\"delete\"`, `\"get\"`, `\"onValue\"` |\n| `path`     | `string` | ✅       | Database path (e.g., `\"users/123\"`)                                        |\n| `data`     | `object` | ⚠️       | Data to write (required for create/update)                                 |\n| `actionBy` | `string` | ❌       | Identifier for tracking (default: `\"anonymous\"`)                           |\n\n### `file.upload(options)`\n\n| Parameter    | Type       | Required | Description           |\n| ------------ | ---------- | -------- | --------------------- |\n| `file`       | `File`     | ✅       | File object to upload |\n| `path`       | `string`   | ✅       | Storage path          |\n| `metadata`   | `object`   | ❌       | Custom metadata       |\n| `onProgress` | `function` | ❌       | Progress callback     |\n| `uploadedBy` | `string`   | ❌       | Uploader identifier   |\n\n### `file.list(path)` & `file.delete(path)`\n\nSimple methods for listing and deleting files.\n\n## 🤝 Contributing\n\nWe welcome contributions!\n","readmeFilename":"README.md","homepage":"https://firebase.atechhub247.com/","bugs":{"url":"https://github.com/atechhub24/firebase/issues"}}