This repository contains a collection of Firebase functions snippets for various tasks.
Snippets
Function
Prefix
Description
Create User
fb:create-user
Create a new user with email and password.
Login User
fb:login
Log in an existing user with email and password.
Logout User
fb:sign-out
Log out the currently authenticated user.
Reset Password
fb:reset-password
Send a password reset email to the specified email address.
Google Login
fb:google-login
Sign in with Google provider.
Auth/User Context
fb:auth-context
Create an authentication context for React applications.
Private Route
fb:private-route
Restrict access to authenticated users for React applications.
Firebase Error
fb:pretty-error
Format Firebase error message.
Firebase Config
fb:config
Firebase configuration object.
Firebase Initialize
fb:init
Initialize Firebase app and get authentication and Firestore instances.
Add/Create Data
fb:create-data
Add new document to a collection in Firestore.
Get/Read Data Unique
fb:get-data-unique
Get data from a document with a specific ID in Firestore.
Get/Read Data All
fb:get-data-all
Get data from all documents in a collection in Firestore.
Get Data with Condition/Query
fb:get-data-condition
Get data from Firestore with a query condition.
Delete all data
fb:delete-all-data
Delete all documents from a collection in Firestore.
Delete Data with Condition/Query
fb:delete-data-conditionally
Delete documents from Firestore with a query condition.
Delete Data Unique
fb:delete-unique
Delete a document with a specific ID from a collection in Firestore.
Upload File
fb:upload-file
Upload a file in firebase bucket and get back the url + ref
Delete File
fb:delete-file
Delete file from storage with ref
Usage
To use these snippets, copy the provided code and paste it into your project where needed. Ensure that you have the Firebase SDK installed and configured in your project.