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.

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 that 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 are such as scala-async are pure-macro projects, and thus work with Scala.js out of the box. Most of them, though, started off as Scala-JVM projects and were ported over, and thus have separate artifacts to run on each platforms. The SBT snippets given are for the version that runs on Scala.js.

scala-js-dom

"org.scala-lang.modules.scalajs" %%% "scalajs-dom" % "0.6"

Static types for the DOM API, by Li Haoyi

scala-js-jquery

"org.scala-lang.modules.scalajs" %%% "scalajs-jquery" % "0.6"

Static types for jQuery, by Sébastien Doeraene

scala-js-react

// Minimal usage
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "0.5.0"

// Test support including ReactTestUtils
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "test" % "0.5.0" % "test"

// Scalaz support
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "ext-scalaz70" % "0.5.0" // or
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "ext-scalaz71" % "0.5.0"

Lifts Facebook's React library into Scala.js and endeavours to make it as type-safe and Scala-friendly as possible, by David Barri

scala-js-binding

addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1") // project/build.sbt
resolvers += bintray.Opts.resolver.repo("denigma", "denigma-releases")
libraryDependencies += "org.denigma" %%% "binding" % "0.4.4"

A ScalaJS html binding library, by Anton Kulaga

Scalatags

"com.scalatags" %%% "scalatags" % "0.4.2"

A HTML templating library/DSL that works on both Scala-JVM and Scala-JS, by Li Haoyi

Scala.Rx

"com.scalarx" %%% "scalarx" % "0.2.5"

A change-propagation/FRP library that runs on both Scala-JVM and Scala-JS, by Li Haoyi

uTest

addSbtPlugin("com.lihaoyi" % "utest-js-plugin" % "0.2.4") // project/build.sbt
"com.lihaoyi" %%% "utest" % "0.2.4"

A tiny, portable unit testing library that lets you run the same tests on both Scala-JVM and Scala-JS, by Li Haoyi

Little Spec

libraryDependencies += "org.qirx" %%% "little-spec" % "0.3" % "test"
ScalaJSKeys.scalaJSTestFramework in Test := "org.qirx.littlespec.scalajs.TestFramework"

A small extendable test/specification library that can generate documentation, works on both Scala-JVM and Scala-JS, by EECOLOR

uPickle

"com.lihaoyi" %%% "upickle" % "0.2.5"

Statically-typed pickling (via typeclasses/macros) for both Scala-JVM and Scala-JS, by Li Haoyi

autowire

"com.lihaoyi" %%% "autowire" % "0.1.2"

Statically-typed Ajax calls and RPCs for both Scala-JVM and Scala-JS, by Li Haoyi

Scala.js Pickling

"org.scalajs" %%% "scalajs-pickling" % "0.3"

A cross-compiling pickling (aka serialization) library for Scala.js and Scala with a common JSON-based format, by Sébastien Doeraene

Monifu

Reactive extensions (Rx) with back-pressure, atomic references and other multi-threading primitives cross-compiled to Scala.js, by Alexandru Nedelcu

Scalaz

"com.github.japgolly.fork.scalaz" %%% "scalaz-core"   % "7.1.0-4"
"com.github.japgolly.fork.scalaz" %%% "scalaz-effect" % "7.1.0-4"
// etc

Port of Scalaz to Scala.js, maintained by David Barri

Monocle

"com.github.japgolly.fork.monocle" %%% "monocle-core" % "0.5.1"

Port of Monocle to Scala.js, maintained by David Barri

RNG

"com.github.japgolly.fork.nicta" %%% "rng" % "1.3.0"

Port of RNG to Scala.js, maintained by David Barri

Shapeless

resolvers += "bintray-alexander_myltsev" at "http://dl.bintray.com/content/alexander-myltsev/maven"
libraryDependencies += "name.myltsev" %% "shapeless_sjs0.5" % "2.0.0"

Port of Shapeless to Scala.js, maintained by Alexander Myltsev

Scala-Async

"org.scala-lang.modules" %% "scala-async" % "0.9.1"

Scala-Async is a pure-macro project without any runtime dependencies. Thus it works with Scala.js out of the box, without needing to be specially compiled for it.

Scalaxy Loops and Streams

Another pure-macro project, Scalaxy loops and streams work great with Scala.js without needing to be specially compiled for it.

scalajs-angular with TodoMvc example

Static types and complementary API for AngularJS, by Xavier Cho

Skeletons

workbench-example-app

A skeleton application using Scala.js workbench for live-reloading in the browser, together with a collection of sample applications developed using it

Play! application with Scala.js

by Vincent Munier

Node.js module with Scala.js

by Rocky Madden

Tools

Scala.js workbench

A sbt plugin for Scala.js projects for live-reloading in the browser (example app), by Li Haoyi

Scala.js Resource

A sbt plugin for bundling of binary files so they can be accessed from the browser, by Li Haoyi

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