Why engineers are moving Firestore from source of truth to read-only cache
A software engineer has shared an architectural pattern that repositions Firestore as a read-optimized cache rather than the primary database for production applications. In this approach, Cloud SQL serves as the authoritative source of truth, with all writes routed through a Next.js and Cloud Run backend that updates both Cloud SQL and Firestore in the same write path. A Cloud Run reconciliation job, queued before each write begins, automatically detects and repairs any inconsistency between the two stores if a write fails midway. The setup preserves Firestore's strengths — real-time push via onSnapshot and flexible data modeling — while offloading transactional consistency and complex queries to SQL. The author argues that for services intended to grow over years, treating Firestore as a rebuildable cache from the outset is far cheaper than migrating away from it later.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in