What is the preferred frontend for a Lagom App

I’m new to Lagom and I was wondering what is the easiest way to create a frontend for a Lagom based backend? I’d like to keep my services separate from the frontend. How hard is the integration with something like Reactjs. Or is there a better way like creating separate Lagom services that produce the UI HTML and cache and send it when requested?
What is easiest as far as learning curve, implementation, user experience and maintenance ? I’m afraid of using ReactJs or another Js framework because of loading speed for mobile devices and my app already uses a good bit of JS in the front. Does ScalaJs make any of this easier? I found ScalaTags and ScalaCSS which is why I asked about separate services to produce the UI.
Any experiences anyone can share are appreciated.

1 Like

Lagom is a backend microservice framework. So, you can use whatever front-end technologies you want to interface with it via REST over HTTP or websocket. There is no Lagom specific integration with React.js. It’s just another REST service.

I know this. I was just trying to get a feel for what other people in the community prefer. Sort of like what have people found to be easiest. I am also thinking of letting play handle this. I’m just interested in other peoples experiences before I settle on the front end technology. Thanks for any opinions.

Hi there,

In short, Lagom has no opinion on the subject of frontend technologies, as already mentioned. You’ll find that it always depends on the context, and if anyone tells you otherwise be very skeptical of their opinion. But I doubt this is news to you, so I will throw in my 2 cents.

What is easiest as far as learning curve, implementation, user experience and maintenance ?

Look, I hate to repeat myself, but what are you trying to build here? If you just want to send a few requests to a Lagom backend use bare-bones XHR/fetch or, pardon the heresy, jQuery. It hardly gets easier than that. If you’re working in team ask for their opinion, pick what you all like, you are the ones who’ll have to look after it.

If you are just playing or hopefully you are building the next unicorn - just use whatever you fancy. You can always change it, should you find your initial choice was not that great after all.

I’m afraid of using ReactJs or another Js framework because of loading speed for mobile devices and my app already uses a good bit of JS in the front.

If you are worried about the performance, weight-in your options the usual way - measure. Don’t trust hearsay - measure, measure, measure! And if you are happy with what you’re using already, keep using it until you no longer happy with it.

In conclusion, remember that there are plenty of successful and failure stories with each technology. Learn all of the technologies, then you can make the most informed choice, that’s my advise :slight_smile:

Thanks. The reason I ask is because I am creating an app with Lagom to help others learn and use Lagom in a fun way. Since Play is part of the Lightbend platform, I think I’ll just use it. This has the bonus of keeping things in the Scala world. Unicorns are horses with glittery dildos glued on their heads, I hope I am not creating one of those. LOL

In case it helps you, we use React and Typescript. These have proven to be a great combo. We also use Server Sent Events but would probably go with Websockets given connection error management; or possibly even RSocket.

2 Likes

Hi,
ScalaJS and binding are a good fit IMHO.
HIH

3 Likes

If you want to stay in scala land, I’d say go with scala-js. That enables the use of lagom-js, which makes talking to the backend a LOT easier:

Hello, good morning! One question, does anyone know if the js file that is generated with the command “fastOptJS” can be used in an Angular project?
Best regards…

@mpavan, if you’re referring to Lagom.js, it can not be accessed by regular JavaScript (like Angular), only in Scala.js generated JavaScript. This is the default behavior in Scala.js. However, your Scala.js code that uses Lagom.js may be exported to JavaScript.

I’m the maintainer of Lagom.js, so if you need Lagom.js to be exported to JavaScript please open an issue and I’ll look into it.