4

Im new to backend dev, and I have a full fledge working React app that GETs,DELETEs and PUTs data using a fake server. Now I need to use an actual backend and I was thinking of going with Firebase as it seems really convenient. However I saw some examples using Firebase directly in the React app, and some using Node.js to do the work.. Could someone please tell me whats the best way to go with this? If there's an easier way to create REST API using express/mongo, I am also open to those :)

1
  • 1
    There are some things that you simply can't do from the client. But for the most part you can do everything from the client, it's just a few edge cases, like user management. Commented Jul 25, 2018 at 18:31

2 Answers 2

3

You have to keep in mind that anything you do from the frontend will be visible to the user, so communicating with Firebase from React will be a bad idea at least for anything involving sensitive information (passwords, credit card info, etc.). Just because you can do something doesn't mean you should. Use a Node backend and use that to communicate with your DB and other services.

To address the last part of your question, it is possible that Firebase might be more than you need. A simple setup with Express and MongoDB might be easier. MLab has a pretty good free sandbox database-as-a-service that requires very minimal setup.

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

1 Comment

Okay that sounds valid.. The reason I wanted firebase was because I already have everything working on the front end, and I am afraid that integrating node+express and mongo might break it.. Anyways, ill give it a shot!
1

I think firebase can also be a good fit, you can use Firebase auth to manage authentication and Rules in the Realtime database or in Firestore to prevent not authenticated users to manipulate your data https://firebase.google.com/docs/database/security/ And to get the best out of Firebase I would recommend using the SDKs but you can also use the REST API https://firebase.google.com/docs/reference/rest/database/

Also if you want to have functionality on the backend you can do so With Firebase Admin SDK https://firebase.google.com/docs/reference/admin/

From my point of view that is one of the advantages of firebase, you can get con going really fast without having to worry about managing infrastructure.

1 Comment

Yup this is so true.. These are pretty much the reasons why I initially started with firebase, and within 10 minutes everything was working; however the company wants a little more standardized backend hence im switching to node+mongo :)

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.