The Scala Center's roadmap for a Unified Scala.js Ecosystem

Sounds great! The ecosystem is actually fantastic but I’ve noticed many people struggle to learn what’s available, and how to get started with it all.

Full-stack Scala has been my passion for around 10 years, and I’ve put a lot of work into creating missing tools and improving the experience. Would love to be involved in this.

I don’t put much effort into evangelising my stuff but here are a few quick resources of mine that I find really useful, that I think would be quite valuable to share more proactively with the community:

  • Scala Test State - IMO this is the best webapp testing experience in the Scala world. Great for both unit testing your UIs as normal Scala.js tests (you can even property-test your UIs), and doing external webapp testing on the JVM via Selenium. In fact, it’s possible to share 99% of your test code so that and reuse it in both internal unit tests and external Selenium tests.

  • scala-graal - Makes it very safe and performant to run Scala.js output (i.e. your webapp JS) on a Graal JVM. Personally, my main use case for this is React SSR (server-side rendering) which is very important for getting frontends to load extremely fast despite the massive Scala.js blobs of JS taking a while to download, parse, and run. (tutorial)

  • webapp-util - A little treasure trove of useful utilities when making full-stack Scala apps. Unfortunately it’s pretty time-consuming extracting this stuff from closed-source webapps and making it OSS; there’s much more I’d love to extract and use in all future webapps I make, and improved documentation would be great too. But I think what’s in there already is pretty useful.

There’s also other stuff like scalajs-benchmark and ScalaCSS but they come up pretty quickly in Google searches when you’re looking for a tool in that space, so don’t need to be highlighted as much. Would still be nice to be included in whatever map-of-the-ecosystem Scala Centre comes up with though.

Moving on, I’ve also noticed some common problems come up quite often with people wanting to get started with full-stack webapps:

  • lack of sbt new / giter8 templates
  • how to serve their Scala.js. Two flavours to this:
    • they just want a blank html served that loads the JS, server just serves static files
    • they want a proper Scala backend with their own logic and endpoints, but don’t know how to integrate their Scala.js output
  • having a decent dev experience in a full-stack Scala app, inevitably requires some coding on the sbt side. A bit tedious for experts and people like me who work on multiple full-stack projects, very daunting if not a showstopper for many less experienced developers. I’ve noticed that many devs don’t know how to do much with sbt beyond the very basics of module and library management. As long as this necessity exists and the onus is on devs to customise their builds so intimately, this is always going to be a significant issue for adoption. It’s not always the same code either, what you do really depends on the type of webapp and the tech involved. It might be solvable via a very flexible sbt plugin, or maybe a collection of well-documented snippets could be maintained?
  • scalajs-bunder initially seems appealing and lots of people try it out and really do try to make it work (myself including, back in the day) but I never see anyone stick with. The consensus seems to be that it doesn’t work properly and causes much more trouble (and pain, sadly) than it’s worth. I’d recommend not suggesting it to newcomers but if you’d like to plough ahead and do so, I think some time and effort is required to really understand it’s problems and improve the tool first; this includes considering how to keep it working, not just get it into a seemingly-working state once.

That’s enough of a brain-dump for now. Hope it helps

12 Likes