DEV Community

Discussion on: Leassons learned using Firebase for the first time

xyn profile image
Mydrax • Edited on

Nice post! I absolutely love firebase, a few tips from me:

  • Write tests for your security rules.
  • Setup a local development environment using the firebase emulators, this way you don't have to deal with network latency. This is specially true if your cloud functions/ firestore/buckets etc locations are far away. You get a pretty sweet ui to manage your local environment too!!! Firebase released an auth emulator recently so you can do develop locally without restrictions (no need to deploy your cloud function x times for x changes)
  • Abstract business logic from security rules to cloud functions and always remember rules don't filter they restrict.
  • Since you mentioned data duplication, you should take a look at firebase triggers. Makes syncing data seamless!
  • Server Timestamps aren't resolved immediately, so make sure to set estimate to true or listen to changes and update the value appropriately.
uf4no profile image
Antonio Author

Thanks for sharing those. I haven't used the emulators that much but I agree for testing functions they'll be super useful. I can tell you the amount of times I've deployed a Firestore triggered function just to get it right 😅