Scala.js compiles Scala code to JavaScript, allowing you to write your web application entirely in Scala! Take a look at the project gallery to see what kind of things you can build with Scala.js.

Get started

Start the Tutorial     Try it in the Browser

The easiest way to get started is to follow our tutorial. You can also fork the bootstrapping skeleton and follow the instructions in its readme or try it out in the browser. There's also an e-book Hands-on Scala.js which contains a lot of introductory material to help you get started.

We also have a standalone distribution that doesn't require SBT.

Important notice! Scala.js is still experimental! Although this is a project of LAMP/EPFL for which we will continue to provide best-effort improvements and bug fixes, it is not supported by Typesafe, and not part of any of their support contracts. You have been warned!

Noteworthy features

  • Support all of Scala (including macros!), modulo a few semantic differences
  • Very good interoperability with JavaScript code. For example, use jQuery and HTML5 from your Scala.js code, either in a typed or untyped way. Or create Scala.js objects and call their methods from JavaScript.
  • Integrated with sbt (including support for dependency management and incremental compilation)
  • Can be used with your favorite IDE for Scala
  • Generates Source Maps for a smooth debugging experience (step through your Scala code from within your browser supporting source maps)
  • Integrates Google Closure Compiler for producing minimal code for production. Compiled blobs range from 170-400kb

Resources

Presentations:

Libraries

This is a collection of libraries known to work with Scala.js. Some of them, like scala-js-dom and scala-js-jquery, are specific to Javascript and don't make sense on the JVM. Some others, such as scala-async, are pure-macro projects, and thus work with Scala.js out of the box. Most of them, though, are cross-compiling over JVM and JS, and thus have separate artifacts to run on each platform.

Static types for JavaScript libraries

Testing frameworks

All these testing frameworks cross-compile on the JVM and JS.

HTML templating libraries

  • Scalatags: cross-compiling HTML templating library/DSL that works on both Scala/JVM and Scala.js

UI frameworks

Serialization/pickling libraries

  • uPickle: cross-compiling statically-typed pickling (via typeclasses/macros) for both Scala/JVM and Scala.js
  • Prickle: cross-compiling statically-typed pickling library with support for pickling object graphs containing shared objects and cycles
  • Scala.js Pickling: cross-compiling pickling library based on explicit registration of picklers

Client-server communication

  • autowire: cross-compiling statically-typed Ajax calls and RPCs

FRP/reactive extensions

  • Scala.Rx: cross-compiling change-propagation/FRP library
  • Monifu: cross-compiling reactive extensions (Rx) with back-pressure, atomic references and other multi-threading primitives

Ports of well-known Scala libraries

  • NICTA/rng: Pure-functional random value generation.
  • Monocle: Optics library strongly inspired by Haskell Lens.
  • Scalaz: Library for functional programming.
  • Shapeless: Generic programming for Scala.

Miscellaneous

Skeletons

Tools

Miscellaneous

Contribute

Want to contribute to Scala.js? Check out the list of contributing opportunities.

Built with Scala.js

List of websites using Scala.js:

Version History

Hall of Fame

Fork me on GitHub