API Reference
Configuration
Section titled “Configuration”| Export | Description |
|---|---|
initFirekit(config) | Initialize Firebase. Call once before your app renders. |
getFirekitConfig() | Return the active Firebase config object. |
isFirekitConfigured() | Return true if initFirekit has been called. |
Authentication
Section titled “Authentication”firekitAuth
Section titled “firekitAuth”Singleton service for auth operations.
| Method | Signature | Description |
|---|---|---|
signInWithEmail | (email, password) → Promise<UserCredential> | Sign in with email & password |
signInWithGoogle | () → Promise<UserCredential> | Sign in with Google (popup) |
signInWithGithub | () → Promise<UserCredential> | Sign in with GitHub (popup) |
signInWithFacebook | () → Promise<UserCredential> | Sign in with Facebook (popup) |
signInWithApple | () → Promise<UserCredential> | Sign in with Apple (popup) |
signInWithTwitter | () → Promise<UserCredential> | Sign in with Twitter (popup) |
signInWithMicrosoft | () → Promise<UserCredential> | Sign in with Microsoft (popup) |
signInWithGoogleRedirect | () → Promise<void> | Sign in with Google (redirect) |
getRedirectResult | () → Promise<UserCredential | null> | Resolve pending redirect |
signInWithSAML | (providerId) → Promise<UserCredential> | Sign in with SAML provider |
signInWithOIDC | (providerId, scopes?) → Promise<UserCredential> | Sign in with OIDC provider |
signInWithPhoneNumber | (phone, containerId) → Promise<{ confirm }> | Start phone sign-in |
signInAnonymously | () → Promise<UserCredential> | Anonymous sign-in |
signInWithCustomToken | (token) → Promise<UserCredential> | Sign in with a custom token |
registerWithEmail | (email, password, displayName?) → Promise<UserCredential> | Create an account |
updateUserProfile | (profile) → Promise<void> | Update display name / photo URL |
updateEmail | (newEmail) → Promise<void> | Change email address |
updatePassword | (newPassword, currentPassword) → Promise<void> | Change password |
sendPasswordReset | (email) → Promise<void> | Send password reset email |
sendEmailVerification | () → Promise<void> | Send verification email |
signOut | () → Promise<void> | Sign out |
deleteAccount | (password?) → Promise<void> | Delete the current account |
startPhoneMFAEnrollment | (phone, containerId) → Promise<string> | Begin phone MFA enrollment |
completeMFAEnrollment | (verificationId, code, displayName?) → Promise<void> | Finish MFA enrollment |
getMFAEnrolledFactors | () → MultiFactorInfo[] | List enrolled MFA factors |
unenrollMFA | (factor) → Promise<void> | Remove an MFA factor |
getMFAResolver | (error) → MultiFactorResolver | Get resolver from MFA error |
startMFASignIn | (resolver, factorIndex, containerId) → Promise<string> | Start MFA sign-in challenge |
completeMFASignIn | (resolver, verificationId, code) → Promise<UserCredential> | Complete MFA sign-in |
firekitUser
Section titled “firekitUser”Reactive singleton reflecting the current auth state.
| Property | Type | Description |
|---|---|---|
user | UserProfile | null | Current user profile |
loading | boolean | true until the first auth state is received |
isAuthenticated | boolean | Signed in and not anonymous |
isAnonymous | boolean | Anonymous session |
initialized | boolean | true after the first auth state |
| Method | Signature | Description |
|---|---|---|
waitForAuth | () → Promise<UserProfile | null> | Resolves when auth state is known |
Firestore
Section titled “Firestore”firekitDoc(path, constraints?, options?)
Section titled “firekitDoc(path, constraints?, options?)”Returns a FirekitDoc<T> instance.
| Property | Type | Description |
|---|---|---|
data | T | null | Document data |
loading | boolean | Loading state |
error | Error | null | Error state |
exists | boolean | Whether the document exists |
metadata | SnapshotMetadata | null | Firestore snapshot metadata |
| Method | Signature | Description |
|---|---|---|
setPath | (path: string) → void | Switch to a new document path |
firekitDocOnce(path, constraints?, options?)
Section titled “firekitDocOnce(path, constraints?, options?)”One-time fetch. Same properties as firekitDoc, no live listener.
firekitCollection(path, constraints?, options?)
Section titled “firekitCollection(path, constraints?, options?)”Returns a FirekitCollection<T> instance.
| Property | Type | Description |
|---|---|---|
data | T[] | Document array |
loading | boolean | Loading state |
error | Error | null | Error state |
count | number | Number of documents |
currentPage | number | Active page (when paginated) |
hasMore | boolean | Whether more pages exist |
| Method | Signature | Description |
|---|---|---|
setPagination | (pageSize: number) → Promise<void> | Enable pagination |
nextPage | () → Promise<void> | Load next page |
prevPage | () → Promise<void> | Load previous page |
loadMore | () → Promise<void> | Append next page |
resetPagination | () → Promise<void> | Return to page 1 |
firekitCollectionOnce(path, constraints?, options?)
Section titled “firekitCollectionOnce(path, constraints?, options?)”One-time collection fetch.
firekitCollectionGroup(collectionId, constraints?, options?)
Section titled “firekitCollectionGroup(collectionId, constraints?, options?)”Reactive collection group query. Same interface as firekitCollection.
FirekitQueryBuilder<T>
Section titled “FirekitQueryBuilder<T>”| Method | Description |
|---|---|
.where(field, op, value) | Add a where filter |
.orderBy(field, dir?) | Sort by field |
.limit(n) | Limit results |
.limitToLast(n) | Last N results |
.startAt(...values) | Cursor start (inclusive) |
.startAfter(...values) | Cursor start (exclusive) |
.endAt(...values) | Cursor end (inclusive) |
.endBefore(...values) | Cursor end (exclusive) |
.build() | Return QueryConstraint[] |
firekitMutations
Section titled “firekitMutations”| Method | Signature | Description |
|---|---|---|
add | (path, data, options?) → Promise<DocumentReference> | Add document |
set | (path, data, options?) → Promise<void> | Set document |
update | (path, data, options?) → Promise<void> | Update fields |
delete | (path) → Promise<void> | Delete document |
exists | (path) → Promise<boolean> | Check existence |
batchOps | (ops: FirekitBatchOp[], options?) → Promise<FirekitBatchResult> | Batch write |
transaction | (fn) → Promise<void> | Run a transaction |
increment | (n) → FieldValue | Atomic increment |
arrayUnion | (...values) → FieldValue | Array union |
arrayRemove | (...values) → FieldValue | Array remove |
deleteField | () → FieldValue | Delete field |
serverTimestamp | () → FieldValue | Server timestamp |
Realtime Database
Section titled “Realtime Database”firekitNode(path)
Section titled “firekitNode(path)”Returns a FirekitNode<T> instance.
| Property/Method | Type | Description |
|---|---|---|
data | T | null | Current value |
loading | boolean | Loading state |
set(value) | Promise<void> | Replace value |
update(partial) | Promise<void> | Merge partial update |
fetchOnce() | Promise<T | null> | One-time fetch |
firekitNodeList(path)
Section titled “firekitNodeList(path)”Returns a FirekitNodeList<T> instance.
| Property/Method | Type | Description |
|---|---|---|
list | T[] | Ordered list (each item has a key) |
loading | boolean | Loading state |
push(data) | Promise<void> | Push new item |
set(value) | Promise<void> | Set entire node |
update(partial) | Promise<void> | Merge partial update |
remove() | Promise<void> | Delete node |
fetchOnce() | Promise<T[] | null> | One-time fetch |
Helpers
Section titled “Helpers”| Export | Description |
|---|---|
rtdbServerTimestamp() | RTDB server timestamp |
rtdbIncrement(delta) | Atomic RTDB increment |
Storage
Section titled “Storage”firekitDownloadUrl(path)
Section titled “firekitDownloadUrl(path)”| Property | Type | Description |
|---|---|---|
url | string | null | Resolved download URL |
loading | boolean | Loading state |
error | Error | null | Error state |
firekitUploadTask(path, file, metadata?)
Section titled “firekitUploadTask(path, file, metadata?)”| Property/Method | Type | Description |
|---|---|---|
progress | number | 0–100 |
state | UploadState | Current upload state |
downloadURL | string | null | Available on success |
error | Error | null | Error state |
bytesTransferred | number | Bytes uploaded |
totalBytes | number | Total file size |
pause() | void | Pause upload |
resume() | void | Resume upload |
cancel() | void | Cancel upload |
firekitStorageList(path)
Section titled “firekitStorageList(path)”| Property | Type | Description |
|---|---|---|
items | StorageReference[] | Files in the directory |
prefixes | StorageReference[] | Sub-directories |
loading | boolean | Loading state |
Utilities
Section titled “Utilities”| Export | Signature | Description |
|---|---|---|
deleteFile | (path) → Promise<void> | Delete a file |
getFileMetadata | (path) → Promise<FullMetadata> | Read file metadata |
updateFileMetadata | (path, metadata) → Promise<FullMetadata> | Update metadata |
Firebase AI
Section titled “Firebase AI”firekitGenerate(options)
Section titled “firekitGenerate(options)”| Property/Method | Type | Description |
|---|---|---|
text | string | Generated text |
loading | boolean | Generating |
error | Error | null | Error state |
generate(prompt) | Promise<void> | Run generation |
firekitStream(options)
Section titled “firekitStream(options)”| Property/Method | Type | Description |
|---|---|---|
text | string | Accumulated tokens |
streaming | boolean | true while streaming |
error | Error | null | Error state |
generate(prompt) | Promise<void> | Start streaming generation |
firekitChat(options)
Section titled “firekitChat(options)”| Property/Method | Type | Description |
|---|---|---|
history | ChatMessage[] | Full conversation |
pendingText | string | Partial streaming response |
streaming | boolean | Streaming in progress |
error | Error | null | Error state |
send(message) | Promise<void> | Send a message |
clearHistory() | void | Reset conversation |
Content helpers
Section titled “Content helpers”| Export | Description |
|---|---|
textPart(text) | Create a text content part |
imagePart(base64, mimeType) | Create an image content part from base64 |
imageUrlPart(url) | Create an image content part from URL |
FirekitAIOptions
Section titled “FirekitAIOptions”| Field | Type | Description |
|---|---|---|
model | string | Model ID (e.g. 'gemini-2.0-flash') |
backend | 'googleai' | 'vertexai' | AI backend (default: 'googleai') |
generationConfig | GenerationConfig | Temperature, topP, max tokens, etc. |
safetySettings | SafetySetting[] | Safety thresholds |
Cloud Functions
Section titled “Cloud Functions”firekitCallable<I, O>(name)
Section titled “firekitCallable<I, O>(name)”| Property/Method | Type | Description |
|---|---|---|
loading | boolean | Call in flight |
error | Error | null | Error state |
result | O | null | Last successful result |
call(input) | Promise<O> | Invoke the function |
firekitCallableFromURL<I, O>(url)
Section titled “firekitCallableFromURL<I, O>(url)”Same interface as firekitCallable.
Platform services
Section titled “Platform services”| Export | Key methods/properties |
|---|---|
firekitAnalytics | logEvent, setUserId, setUserProperties, logScreenView, setConsent |
firekitMessaging | requestPermission, onMessage, token, permission, supported |
firekitInAppMessaging | suppress, unsuppress, suppressed, supported |
firekitRemoteConfig(options) | fetchAndActivate, getString, getBoolean, getNumber, getValue |
firekitPerformance | startTrace, measure |
firekitPresence | initialize, setPresence, getStats, dispose |
firekitAppCheck | initialize, getToken |
Firestore Bundles
Section titled “Firestore Bundles”| Export | Signature | Description |
|---|---|---|
loadFirestoreBundle | (stream: ReadableStream) → Promise<void> | Load a bundle into the local cache |
getNamedQuery<T> | (name: string) → Promise<Query<T> | null> | Retrieve a named query |