pauljamescleary/scala-pet-store

Create Front End Application

pauljamescleary opened this issue ยท 11 comments

The front end application should communicate securely (i.e. secure cookies / jwt / etc) to the backend api.

This will require some kind of authorization middleware to be setup.

The front end application should be a ScalaJS app and mimic the existing pet store app.

@pauljamescleary Out of interest - as this is intended to be an example of a production scala application, why not go for a scala.js front end e.g. using scala-js-react and diode? I'd be happy to contribute to such an effort.

@hugofirth Definitely would welcome a scala-js-react / diode front end.

I was thinking about taking the existing code and moving it to a sub-module, like "typelevel-tagless-final" and then have the front end to be a separate sub-module. This way, we could use the same front end with different backends.

I was thinking about creating a Free backend, may want to do eff, who knows what else.

Also, sorry for not responding earlier :(

Just dropping this in: https://github.com/OutWatch/outwatch

I think it is another interesting technology to look into.

๐Ÿ‘ regarding the module split

To make it a little bit more complex to decide which framework to use I'll also drop https://github.com/outr/youi here :-)

Thank you for this project, @pauljamescleary !

I think there are opportunities for several front ends. I haven't quite figured out if we should have a multi-module monolithic repo or perhaps an org with several repos of different flavors. This is small, so for the time being a multi-module project seems like a logical next step.

From a reference guide in scala standpoint, I think ScalaJS makes the most sense. The other viable alternative is a straight up javascript front end built in something like Vue.js.

Well I'm afraid I don't know the other frameworks mentioned, so I'll just start slowly chipping away at a scala-js-react app in a fork (probably next week) and let you know here when there is something worth looking at.

You're right that there are several possible options for front and back end frameworks/patterns/languages. If you were soliciting votes on the approaches (which you are aren't ๐Ÿ˜„ ) then mine would go to the "1 full stack application per repo" option.

You could encode all of the variations as sub-projects in this repo but for me the core value of something like this is as a packaged example of how I might write a production app using functional libraries. Including sub-projects would add noise to the project folder structure and build.sbt which could be unhelpful to somebody with that goal.

At the end of the day, someone can always build a fork using Free, Finch and Vue (for example). If they did you could even create a Scala Pet Store github org and encourage those contributors to "donate" the fork to the org for improved discoverability. You could imagine ending up with a matrix on each Readme which links to the fork for each combination.

Sounds good

Another good lib in the same style as scala-js-react is binding.scala : https://github.com/ThoughtWorksInc/Binding.scala

I think the syntax is a bit easier to read than scala-js-react and it's a pure scala.js framework.

Thanks for the tip @loicdescotte . I will be sure to check it out :)

Might make sense to get the authentication in before this. Would be sweet to have an SPA with JWT for authentication against the user store all fully functional :)

We have some authentication bits in, at least the login bits. TSec is still developing, and I haven't been back to make the JWT pieces work yet.