Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/resulturan/refine-firebase


https://github.com/resulturan/refine-firebase

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

![npm](https://img.shields.io/npm/v/refine-firebase)
![npm bundle size (version)](https://img.shields.io/bundlephobia/minzip/refine-firebase/1.1.1)
![npm](https://img.shields.io/npm/dt/refine-firebase)
![GitHub](https://img.shields.io/github/license/resulturan/refine-firebase)
![GitHub Repo stars](https://img.shields.io/github/stars/resulturan/refine-firebase?style=social)

# Refine-Firebase

> Firebase integration tool for your Refine app

## Install

```bash
npm i refine-firebase
```

## Usage

**1. Create a config file and initialize firebase.**

_firebaseConfig.js_

```js
import { initializeFirebase } from "refine-firebase";

export const firebaseConfig = {
apiKey: XXXXX,
authDomain: XXXXX,
projectId: XXXXX,
storageBucket: XXXXX,
messagingSenderId: XXXXX,
appId: XXXXX,
databaseURL: XXXXX,
};

export const firebaseApp = initializeFirebase(firebaseConfig);
```

**2. Create tools according to your needs.**

_firebaseConfig.js_

```js
import {
FirebaseAuth,
FirebaseDatabase,
FirestoreDatabase,
} from "refine-firebase";

export const firebaseAuth = new FirebaseAuth();

export const firestoreDatabase = new FirestoreDatabase();

export const firebaseDatabase = new FirebaseDatabase();
```

**3. Use dataProviders for Refine**

_App.js_

```js
import {firebaseAuth, firestoreDatabase }from "./firebaseConfig";


```

## API Reference

### **Functions**

| Function | Description |
| ------------------ | ----------------------------------------------- |
| initializeFirebase | Creates and initializes a FirebaseApp instance. |

### **Classes**

| Class | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| FirebaseAuth | Provider for generating [firebase-authentication] and [IAuthContext] for @pankod/refine auth-provider |
| FirestoreDatabase | Provider for initializing [Firestore] instance with the provided FirebaseApp and creating @pankod/refine [dataProvider] |
| FirebaseDatabase | Provider for initializing [Realtime-Database] instance with the provided FirebaseApp and creating @pankod/refine [dataProvider] |

## License

[MIT](http://vjpr.mit-license.org)

[firebaseoptions]: https://firebase.google.com/docs/reference/js/app.firebaseoptions.md?authuser=0#firebaseoptions_interface
[firebaseapp]: https://firebase.google.com/docs/reference/js/app.firebaseapp.md?authuser=0#firebaseapp_interface
[iauthcontext]: https://refine.dev/docs/api-references/providers/auth-provider/#api-reference
[firebase-authentication]: https://firebase.google.com/docs/reference/js/auth.md?authuser=0#functions
[dataprovider]: https://refine.dev/docs/api-references/providers/data-provider
[firestore]: https://firebase.google.com/docs/reference/js/firestore_.md?authuser=0#@firebase/firestore
[realtime-database]: https://firebase.google.com/docs/reference/js/database.md?authuser=0#database_package