You can actually use microservices to reduce the complexity of a monolith.
One example which I built just for this purpose is Barricade https://github.com/purton-tech/barricade which extracts authentication out of your app and into a container.
One example which I built just for this purpose is Barricade https://github.com/purton-tech/barricade which extracts authentication out of your app and into a container.
Those libraries generally come with lots of dependencies so splitting out the front end and back end auth code into a container can reduce the complexity of your main app and is a nice separation of concerns in my opinion.
Barricade supports OTP via email. TOTP is on the road map.
you'd have one instance for your auth token generator, one for the gateway, one for the dashboard, and so on