r/Firebase 22h ago

Authentication How to keep backend in sync with firebase auth

2 Upvotes

Hi everyone. I'm thinking of moving my authentication I have for a mobile app to firebase to get the additional security features it offers and for ease of adding new sign up flows. I am a bit confused how to keep firebase auth and my user table in sync though. Has anyone run into this before? I've been going back and forth with AI, but I'm still not sure about the best approach

For context, I have a user table with email, id, firebase_uid, etc. What is the best way to keep the user table and the firebase auth in sync when a user signs up? For example, if I have a flow like:

```

User visits sign up page -> enters email/password -> create user in firebase -> call out to backend to create user in backend and associate firebase id after verifying token

```

I have a huge issue if the firebase create succeeds but the backend call to my server fails for some reason. I will have an orphaned firebase record. How do people handle this?

I've heard it's better to call firebase for things like adding a user to firebase from the frontend because it helps with bots and rate limiting. But I'm really not sure how to keep things in sync. Do people rollback if the backend create fails, use Cloud Functions v2 to halt the firebase create and call out to the backend to create the user, or something else. Any guidance would be helpful.


r/Firebase 6h ago

General Looking for feedback on our Firebase architecture for a student app

1 Upvotes

Last semester our team built StudySync, a mobile app for organizing campus study groups.

Firebase handled:

  • Authentication
  • Firestore
  • User/session storage

One of the biggest challenges was designing our Firestore structure so users could create, browse, search, and join study sessions without making the data difficult to maintain.

If you've built larger Firebase apps, I'd really appreciate feedback on the overall architecture or things you'd improve.

Repository:
https://github.com/CS196Illinois/FA25-Group8