Recommended way to use FastAPI with Firebase (Pyrebase4 or firebase_admin) #6962
-
I want to know how to setup the comunication between FastAPI and the Firebase data storage (Firestore) through Pyrebase4. I didn't find any info or example of this case. |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 1 reply
-
Pyrebase is pretty straight forward to use/understand than firebase-admin in implementation. Currently in feature-wise, there is no much difference between both libraries. |
Beta Was this translation helpful? Give feedback.
-
Do you have some example of basic setup of FastAPI with Pyrebase4? I mean, some simple CRUD using it. I couldn't find any. |
Beta Was this translation helpful? Give feedback.
-
You can check this sample..
we will have to get those firebaseConfig details by registering in firebase.
you can save above db config details in seperate file and can import them.
for reference |
Beta Was this translation helpful? Give feedback.
-
I did the following, but for a reason that I didn't find yet, I can't reach the firebase data. I got http 200 but without the Firebase data. Any tip about that? |
Beta Was this translation helpful? Give feedback.
-
have you created api_key etc., in firebase config details and used in api? need more info |
Beta Was this translation helpful? Give feedback.
-
My project structure: my_api My app/config/database.py: My app/schemas/category.py: My app/routes/category.py: My app/main.py: Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
Just for confirmation, I have one sigle data saved for test. |
Beta Was this translation helpful? Give feedback.
-
Can you check in realtime database? If you need to work on firestore,use firebase_admin sdk. follow this link for reference... |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. Since it doesn't have support I'll change to realtime database or firebase_admin sdk. |
Beta Was this translation helpful? Give feedback.
-
@JuniorGunner, I hope you made it work. I am also in a similar situation. If your app worked, can you please share your code with me? Like, I need to understand how you made it work. Thank you. You can make it as an answer to this. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help here everyone! 👏 🙇 Thanks for reporting back and closing the issue 👍
|
Beta Was this translation helpful? Give feedback.
@JuniorGunner, I hope you made it work. I am also in a similar situation. If your app worked, can you please share your code with me? Like, I need to understand how you made it work. Thank you. You can make it as an answer to this.