Database-driven realtime architectures are becoming more and more common as evidenced by key backers and widespread use of software like Firebase and Supabase.
The two key priorities for an app following database-driven realtime messaging are long-term storage and change data capture (CDC) updates from the database.
In this two part article series, we’ll take a detailed look at a fully serverless chat app where you can edit previously published messages. The chat app uses the Ably Postgres connector to achieve this, the details of which you’ll see throughout the article. You’ll find the architecture and the example app useful if you are looking for ways to build database-driven applications that work seamlessly at scale.
While the idea of a realtime database sounds great and opens up a huge range of possible use-cases one could build with this architecture, a tight coupling of databases and realtime messaging might suffer from various issues described in the article linked above.
Moreover, not all event triggers constitute consequential payloads and thus don’t need to go into storage. Perhaps some events are just transient to make a client aware of an event occurring, not necessarily even descriptive details about that event. For example, in a chat app, I’d be interested in storing messages, timestamps, etc. but not necessarily typing indicator events.