You can implement any service you want fully on serverless unless you need to use Websocket (then you'd need to combine serverless API with a traditional server). To avoid race conditions you can look into transaction locking (ex: in Postgres): stackoverflow.com/questions/4… or you can set flags with a Redis caching layer. The reason why you should always close your DB connections is that functions create a new connection on each invocation. Considering that it's infinitely scalable, we get a bottleneck at the DB level. So your database solution should be ready to handle thousands of connections at the same time.
You can implement any service you want fully on serverless unless you need to use Websocket (then you'd need to combine serverless API with a traditional server). To avoid race conditions you can look into transaction locking (ex: in Postgres): stackoverflow.com/questions/4… or you can set flags with a Redis caching layer. The reason why you should always close your DB connections is that functions create a new connection on each invocation. Considering that it's infinitely scalable, we get a bottleneck at the DB level. So your database solution should be ready to handle thousands of connections at the same time.
Thank you 🙌
I have no doubts now & if I have any when I actually build it, I will ask you later on. Thanks Max :)