Hi guys, We are working on a project with using Lagom. I am responsible for UI client side and BFF (Backend for Frontend). All client side web requests go to one play service and then goes appropriate private api lagom services.
I want to ask what if i use bff as lagom services ? not as play service. We are not going to use any server side rendering. We just return index.html and other than that we will use only json request, response. (No SEO concerns etc.)
Why i am asking this, play does not work well with maven. For instance, i can not use plays routes file because maven does not generate route. So i am using RoutingDsl. With RoutingDsl, i can not make any websocket connection with (play.routing.RoutingDsl). So lagom services already has exception serializer, request serializer, already has routing features (like optional binding). However, when i check online auction and chirper examples, i saw they are using play services for clientside. If i am not going to render server side for website and bff, should i still use Play or can i use it as lagom services. What is the cons and pros
as usual, it depends. Play is a building block of Lagom and as such almost anything that can be done in Play can be done in Lagom, the problem with that approach is that often the cost of disabling defaults and overriding with custom behavior is higher than using plain Play.
You already mentioned several impediments on using Play, but Play is designed for internet-facing applications and once you deploy in a production environment you could find it’s easier to setup some cross-cutting concerns like SSL handling, Authentication, etc…
We used a Play frontend on the sample apps because we needed a server-side rendered website and because Lagom was not designed to be internet-facing (though nothing forbids you from using it).
Finally, if you are implementing BFF’s it’s possible that soon enough you’ll have Frontend-specific needs (smartTV vs iPhone vs …) and most likely these will be low-level details escaping the defaults used in Lagom.
Apologies if my answer is rather ambiguous but the devil is on the details.
Cheers,
PS: there are some examples on exploiting Play features inside a Lagom service, but I don’t think there is an example of such exploits built with Maven.