When writing Node.JS application for a Raspberry Pi communicating with Firebase, which npm module should be used?

What is the ideal way of doing things when on Raspberry Pi? Is it using firebase-admin or firebase package?

What difference will it make?


My question has been answered here by Frank and I quote:

Both the regular Firebase client SDK, and the Firebase Admin SDK for servers can be used on a Raspberry Pi Node.js application. Which one to use depends on how you use the device and app.

The firebase module accesses Firebase as a regular client application, similar to how any other web app, iOS app, or Android app would access it. So with this SDK you'll typically ask the user to sign in with Firebase Authentication, and then use those credentials to access their data in Cloud Firestore.

The firebase-admin module however accesses Firebase as an administrative client. This means that it is authorized through pre-configured credentials, and can then access all data in Firestore and the rest of the Firebase project without any limitations. This SDK is used when you're creating an administrative application, that you then run on your Raspberry Pi.

So: if you're building a regular application that requires no special permissions, use the firebase module. If you're building an admin-type application that requires elevated permissions, use the firebase-admin module

And also a comment specifying:

There is no Firebase client app SDK for Cloud Storage for Node.js. But you should only use the Admin SDK if you want to allow the users of the app to have full access to your Firebase project.

  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Feb 18 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.