Git Product home page Git Product logo

admin-bro-firebase's Introduction

AdminBro Firebase Adapter

Build status Maintainability Rating

Adapter for AdminBro which allows to add your own Firebase resources

Prerequisites

You will need AdminBro panel configured for your project. See AdminBro Repository for instructions

You have to initialize your Firebase app before connecting resources to AdminBro. That means you have to write something like:

// Your firebase config see https://firebase.google.com/docs/web/setup
export const firebaseConfig = {
  // [...]
};

Firebase.initializeApp(firebaseConfig);

Installing

To connect adapter to your AdminBro instance all you need is to:

  1. Register this adapter into AdminBro instance
  2. Write resource with schema
  3. Pass resource to AdminBro config object

Check example folder for full example application!

import * as firebase from "firebase";
import AdminBroExpress from 'admin-bro-expressjs';
import AdminBroFirebase from 'admin-bro-firebase';
import AdminBro from 'admin-bro'; 

const setupAdmin = async expressApp => {
  AdminBro.registerAdapter(AdminBroFirebase);
  const adminBro = new AdminBro({
    branding: {
      companyName: 'Firebase example',
    },
    resources: [
      {
        collection: firebase.firestore().collection('Users'),
        schema: {
          name: 'string',
          isAdmin: 'boolean',
          location: 'mixed',
          attributes: {
            type: 'mixed',
            schema: {
              birthdate: 'date',
              height: 'number',
              eyeColors: 'mixed',
            },
          },
        },
      },
    ],
  });

  const router = await AdminBroExpress.buildRouter(adminBro);
  app.use(adminBro.options.rootPath, router);
};

Authors

Known Issues

Described in Issues tab.

Feel free to contribute.

License

This project is licensed under the MIT License

admin-bro-firebase's People

Contributors

bayu-skyshi avatar jonaszjestem avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.