0

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?

Jacob
  • 1

1 Answers1

1

D) The one internal facing would access the other DB.

For me it's the best method. At the customer's side you don't want to lose anything, so if you want shared access you will have a way to track it.

Second point, if the DB is in a DMZ, then it's way better to make a trust from internal -> dmz only.

Third point, if the access is a problem, then create a tracker service that read and sync that table in both database.

yagmoth555
  • 16,758
  • 4
  • 29
  • 50