I got two web applications, one customer facing and one for internal usage. Both are using a PostgreSQL database. What are the approaches I could take to share data between these applications? Both applications would need read and write access but data doesn't need to be instantly available. Further, I would like both application to not depend on each other, one can be offline without affecting the other application.
I can think of the following options. Am I missing something?
Option A: Third Database
The easiest would be to have a third PostgreSQL database that both applications have access to. The downside I can see is that the database schema need to be the same and that both applications require a second database to be always online.
Option B: Separate API Service
Like option A but a separate service which both applications have access to and with an API to use. Still the service needs to be always available.
Option C: Message Events
Both applications have there own set of data and publish change events. A message system, like Amazon SQS, where both application would listen to messages and update there data accordingly. I like this approach but can already see how the data can get out of sync.
Is there an option D?