Hacker News new | past | comments | ask | show | jobs | submit login
Scala.js – Does anyone use it production or plan to use it production ?
18 points by andersson42 on Aug 31, 2015 | hide | past | favorite | 22 comments
Scala is an large investment in time for most programmers, but once you get the hang of it you become very productive. So when facing the task of writing for the frontend, I would like to utilize my investment by using scala.js

Have anyone here had any experience in using Scala.js for any production system or planing to use it in production ?

I have used it for several projects.

I have written a Chrome extension[1] using it which has a thousand or so users.

I use it to make in house visualizations / web based user interfaces for commodities trading. In this use case being able to have statically checked rpcs (via autowire + some modifications) and share domain objects / business logic between client and server really helps keep things DRY & statically checked.

Currently, as a hobby project, I am using it to work on a video game built on top of phaser.js.

As a long time Scala programmer I would strongly recommend it. It's amazing being able to re-use all your domain objects between server and client, and get great performance on both sides.

1: https://github.com/benjaminjackman/looty

Do you use any packages as Angular or Polymer together with Scala.js ?

I haven't, I have used Facebook's React with it, which works fine.

My product is completely built on it. Took some ramp-up and rearchitecture time (in particular, SJS is better for a single-page-application than lots of little webpages), but it has enormously increased my productivity since then.

By now, I'm at the point where adding a whole new API and making use of it in the client can be done in minutes -- having Scala end-to-end is a huge win. And having static type checking for the client code means that there are far fewer bugs, so coding the client itself is much quicker and less frustrating. Really, it's the first time in 20+ years that I've enjoyed web programming.

That's just a tiny startup (https://www.querki.net/help/#What-is-Querki -- note that everything you see there is Scala.js), but I don't think it would have been possible without SJS...

Is there anywhere you have felt that you have to work around anything compared to writing it in javascript ? ie. it pans out great when the project is small but when it grows more and more caveats turns up and the gain maid in the start is quickly lost

I am planning to use it in production.

We are working on a system that monitors, analyzes and reacts to telemetry sent by industrial machines. Part of this project are very JS/Ajax rich interfaces (plural) that show graphs, telemetry updates and alerts in real-time, interfaces that have to be kept up and running in the same browser window for days without refresh. The problems we've experienced is that the client-side is not front-end work, where the people involved need to have UX skills and stuff like that. Oh no, this is about building a reliable UI that doesn't leak, that doesn't choke on too many updates sent by the server and that can recover after networking issues.

Scala.js is great because we can use Scala-related tooling, which are much, much saner than what you get in Javascript's ecosystem (e.g. IntelliJ IDEA, SBT, dependencies managed in Maven repositories, Google Closure tree-shaking your code by default, etc.), a statically typed programming language that can help prevent accidental errors, which is very important for us because the complexity of the business logic involved is very problematic, plus a very rich standard library. For example we don't have to wait for async/await because we already have it. The libraries you can work with are pretty cool as well. Facebook's React is a popular choice for usage in combination with an FP style and interoperability is great. Plus the ecosystem of Scala.js-specific libraries is very active. As a shameless plug, we've built our own library for dealing with reactive streams, cross-compiled to Scala and Scala.js: https://github.com/monifu/monifu

Thanks for that insightful post, may I ask, beside React, do you use any widget library or do you do the design from scratch ?

I'm in the process of introducing Scala.js to the front-end of seventh sense. My navigation and several display components are in production already, with more coming all the time. Once you understand the interop rules and get a unified toolchain in place, it "just works", and as others have said, having access to scala typing and the same, typed, codebase on both front-end and back-end is awesome.

I'm currently using Angular, React and Moment.js on the scala side, so I can confirm JS library interop is possible.

How would you describe the level of effort needed to deal with the interop ? "Is possible" can range from "Its possible" to "Very nice" :)

I'd say the language level interop is "very nice". Library level interop is still a work in progress. Many (most?) facades are incomplete, and the more complete ones often eschew compatibility with existing JS code in favor of optimizing for scala-js only. Typically figuring out exactly what the possible argument and return values are for a given js function takes a bit of trial and error, so you have to twiddle the facade a bit and be prepared to fork them and contribute changes back upstream.

That said, if you're familiar enough with both platforms to handle an app that has both, moving the interop from your head to the scala.js code isn't that big of a leap.

Thanks, I have to dig in and see how much of an issue missing library integration in my case would cause.

I've been using it in production, albeit with a small and friendly audience that puts up with missing features very kindly (I use it for a critique tool in group project courses).

The reason for using it was that as I rarely have time to spend on the code, and often months apart (when the next term comes around), I wanted something where the compiler will catch more of my mistakes.

(Generally, I've been using scalajs-react on the client side)

I am using the Scala.js for 1 year for commercial product. The quality is very good. All are very happy. The Scala.js and the React are integrate very nicely. I encourage you to try, you can never go back. You will not disappointing!

Did you use any other framework beside react ?

Before this we tried the Angular.JS but we were not happy to do so. Luckily we later discovered the ScalaJS and since that time we are very happy. But we have not tried the ScalaJS and the Angular together. Maybe the integration is good? But I think Angular is not good. Sorry don't have more helpful informations.

Your current investment will be doubled (at least) in value if you use scala-js, and the extra effort is minuscule compared with learning Scala.

I have used it in closed-source production and its awesome!

We are building a production app using Scala.js (with React as the underlying framework through https://japgolly.github.io/scalajs-react). It has been a marvelous and super-productive experience.

Here are the slides from my recent presentation at "Scala by the Bay" conference narrating our experience so far (video for the same will be released by the conference organizers soon): http://www.slideshare.net/ramnivas2/full-stack-scala

How do the endresult code size look compared to handcrafted javascript ? 2x , magnitude ?

In our case, the production JS file produced by Scala.js is about 180KB (gzipped). This size does not include third-party code such as React and other assets.

We also plan to use Scala.js in our next brand-new UI of ChatWork (https://www.chatwork.com).

Please be noted that we won't use scala-react because Scala.js can communicate with React by postMessage.

disclosure: I work for chatwork as chief front-end engineer.

Yes: for a small web app solution, using only scala libs (scalatags,autowire,scalarx)..98kb gzip and bootstrap css: https://www.stofftante.ch. Had only two js debug sessions until now :-) cause auf type safety :-)

Yup. Using in production for a rather large monitoring UI via the awesome https://github.com/japgolly/scalajs-react project. Nothing but good things to say about it.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact