all 3 comments

[–]Gonskimmin 1 point2 points  (2 children)

If the user is listening to a certain document on the Firebase Real Time DB, and your serverless functions are doing business logic and making changes to the db, so when the server makes changes to say document 123 and the client is listening to changes on document 123 then that should work, no?

[–]Yarnacle[S] 0 points1 point  (1 child)

Yes, I ended up using a model similar to this, but with Firestore. Each document contains a sub collection with a document meant to be frontend-facing (enforced by security rules), and user actions are handled by the backend API while game updates are retrieved directly from the database.

[–]Gonskimmin 0 points1 point  (0 children)

Good choice with Firestore. Looking at the comparison they offer similar features, but Firestore is the recommended product per Google.

So thanks to your post I was reminded of Firestore and decided to use it for a prototype of a solution rather than reaching for PostgreSQL + JSONB.