Giter Club home page Giter Club logo

sails-firebase's Introduction

sails-firebase

Sails.js/Waterline adapter for Firebase.

Build Status npm version

Warning

This adapter is still under active development and in no manner is advised using it in a production environment.

Check the project issues board for announcements, bug reports, upcoming features and discussions.

Only mandatory semantic interface methods were implemented. The next steps is bringing queryable and associations to life asap.

Introduction

Overview

The Firebase Realtime Database synchronized in realtime to every connected client.

It allows you build cross-platform apps with our iOS and Android, all of your clients share one Realtime Database instance and automatically receive updates with the newest data.

However the current Firebase architecture force the developers to implement a lof of business logic as part of the mobile applications, leading to some side-effects:

  • Business logic code duplication among Android, iOS, Windows and all mobile platforms
  • Due version fragmentation, business logic is affected by apps being (not) updated.

Sails.js and Waterline as Mobile Orchestrator

This Waterline Firebase Adapter provides missing piece to Sails.js become a mobile orchestrator. The server application read and writes directly into Firebase, which updates all mobile devices connected to it in realtime; just like a message passing distributed system.

Configure and Install

Dependencies

At your Sails.js project, install the adapter library:

$ npm install sails-firebase --save

Configure

Create an application at Firebase admin console, then access the project settings menu:

https://console.firebase.google.com/project/<YOUR PROJECT NAME>/settings/general/

Go to the account services menu and create download a server private key, which will contain valid credential and databaseUrl.

You will add an adapter atribute and copy it into connection.js configuration file:

// ./config/connections.js
module.exports.connections = {

  firebase: {
    adapter: 'sails-firebase',

    credential: {
      "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
      "auth_uri": "https://accounts.google.com/o/oauth2/auth",
      "client_email": "<YOUR EMAIL CLIENT>",
      "client_id": "<YOUR CLIENT ID>",
      "client_x509_cert_url": "<YOUR CLIENT X509 CERTIFICATE>",
      "private_key": "<YOUR PRIVATE KEY>",
      "private_key_id": "<YOUR PRIVATE KEY ID>",
      "project_id": "<YOUR PROJECT ID>",
      "token_uri": "https://accounts.google.com/o/oauth2/token",
      "type": "service_account",
    },

    databaseURL: "https://<YOUR PROJECT NAME>.firebaseio.com",
  }

};

and also configure your model:

// ./config/models.js
module.exports.models = {
   'connection': 'firebase'
};

Contributing

If you wish to contribute to Waterline Firebase Adapter, first we would like to thank you for dedicating your time on this project.

Before create a pull request, keep some things in mind:

  • Be polite with other community developers.
  • Run the integration tests locally and be sure they pass.
  • Keep the code style.
  • Create awesome commit messages (use emojis and read Udacity Git Style Guide)

The adapter currently provides only semantic inteface. If you are submitting other interfaces, add it to the package.json file:

{
  "waterlineAdapter": {
    "type": "sails-firebase",
    "interfaces": [
      "semantic"
    ],
    "waterlineVersion": "~0.12.1"
  }
}

sails-firebase's People

Contributors

jpventura avatar mikermcneil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sails-firebase's Issues

Encountered an unexpected error

Am getting this particular error (screenshot below) anytime I attempt to do this

I want to add a customer to an already existing business, I want many customers to one business.

What's the solution to this problem

Warm Regards

image

Init fails when there's a function in the definition

When using a function as a value of a definition property like 'defaultTo' in the definition, I get the following:

Failed to initialise models Error: Firebase.set failed: First argument contains a function in property 'definitions.action.id.defaultsTo' with contents: defaultsTo() { return uuid.v4() }

I am using the waterline orm directly though, rather than through sails, so not sure if there's normally some kind of sanitization that you're expecting by that point?

Migrate to Sails.js V1

Hi,

I have been using this datastore, with previous versions of sails, but this datastore is not working at all with latest sails version.

Could you migrate please?

Thanks

Usage -- Sails-Firebase

Hello there!
Been trying to integrate firebase into our sails application.
Is the Sails-Firebase Waterline adapter ok for use in a project?

How to write the Model.js

Hi

It project is great, Can you please say me how write a model (attributes, fields, etc) a example of this file

Thanks

Roadmap question

Hi,

I'm looking for an firebase-sails adapter, that's ready for production. Given it's clearly stated that this adapter is not ready for production, is there any plans to continue development of this adapter to encourage it's use in production code?

If not, does anyone know of any suitable alternatives?

Appreciate your time,

Not compatible with newest version of sails?

Error:
-----------------------------------------

The adapter used by the firebase datastore is not compatible with
the current version of Sails/Waterline.

The adapter should expose a valid adapterApiVersion.

If you're using Sails โ‰ฅ1.0, try:
npm install sails-firebase@latest --save

I ran the suggested command and nothing happened. Still the same error.

Typo on documentation

README.md has

You will add an adapter atribute and copy it into connection.js configuration file:

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.