Skip to content

The Firebase Node API Wrapper is a comprehensive package designed to simplify the integration and interaction with Firebase services in Node.js applications. This wrapper provides a streamlined interface for accessing Firebase 🔥 Authentication, Firestore, Realtime Database, Cloud Storage, and more.

License

Notifications You must be signed in to change notification settings

DevboiDesigns/firebase-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Node API Wrapper

The Firebase Node API Wrapper is a comprehensive package designed to simplify the integration and interaction with Firebase services in Node.js applications. This wrapper provides a streamlined interface for accessing Firebase Authentication, Firestore, Realtime Database, Cloud Storage, and more. It abstracts the complexity of Firebase's SDK, allowing developers to focus on building features rather than managing configurations and boilerplate code.

Key Features:

  • Easy Initialization: Quickly set up and initialize Firebase services with minimal configuration.
  • Authentication: Seamlessly integrate Firebase Authentication to manage user sign-in and sign-up processes.
  • Firestore: Access and manipulate Firestore collections and documents with ease.
  • Realtime Database: Interact with Firebase Realtime Database for real-time data synchronization.
  • Cloud Storage: Manage file uploads and downloads using Firebase Cloud Storage.
  • Environment Configuration: Support for multiple environments (development, production, testing) with environment-specific configurations.

Setup:

  1. Clone the repository.
  2. Copy the example environment file and fill in the API keys:
cp .env.example .env.test
cp .env.example .env.prod

Installation

Install the package using npm:

npm install @devboidesigns/firebase-wrapper

Usage

Import the services and models from the package:

import {
  FBService,
  GCSBucketName,
  GSCService,
  FBKeys,
  FBSubKeys,
  ERRKeys,
} from "@devboidesigns/firebase-wrapper"

Initializing the Firebase Service

Create an instance of the FBService class to interact with Firebase services:

const fbService = new FBService()

Getting a Collection

You can get a collection from Firestore using the getCollection method:

const collection = fbService.getCollection(FBKeys.users)

Getting Data from a Collection

To get data from a collection, use the getData method:

const userData = await fbService.getData("users", "userId")

Using Google Cloud Storage Service

Create an instance of the GSCService class to interact with Google Cloud Storage:

const gscService = new GSCService()

Uploading a File to a Bucket

To upload a file to a Google Cloud Storage bucket:

const bucket = gscService.storage.bucket(GCSBucketName.PUBLIC_BUCKET)
await bucket.upload("path/to/local/file", { destination: "path/in/bucket" })

Running Tests

To run the tests, use the following command:

npm test

Building the Project

To build the project, use the following command:

npm run build

This documentation provides an overview of how to set up, install, and use the package, including examples of common operations.

Star on GitHub 🤩

If you like this tool please take a moment to star this project on GitHub.

GitHub stars

About

The Firebase Node API Wrapper is a comprehensive package designed to simplify the integration and interaction with Firebase services in Node.js applications. This wrapper provides a streamlined interface for accessing Firebase 🔥 Authentication, Firestore, Realtime Database, Cloud Storage, and more.

Topics

Resources

License

Stars

Watchers

Forks

Packages