1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Just to confirm @Frank. The doc here (firebase.google.com/docs/web/setup#namespace) mentions that Storage is not not accessible from Node.js but I need to access it for uploads from raspberry pi. So, I will have to stick to Admin SDK right?
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.