Hello. I have a couple questions regarding the architecture of using Moralis with dApps. The marketplace boilerplate is a good example to use for the questions.
In that example, the Moralis DB is syncing the “MarketItemCreated” event, which makes sense. The part I’m struggling with is when someone purchases a marketplace item, it appears that the dApp itself attempts to update the database by setting that object “MarketItemCreated” to sold. Is this really a robust strategy? What if the client crashes or closes right after the transaction is started? What if someone does a direct contract interaction to purchase an item? Won’t the dApp be out of date then?
It seems like a better strategy would be to process “MarketItemSold” event from the server side directly from the blockchain and update the database accordingly. That way it doesn’t depend on the dApp to update anything.
Am I totally off base here, or maybe missing something? If not, is there a way to design Moralis backend as stated above (use another event to update database)?