by lihaoyi

An example application written in ScalaJS using scala-js-dom and scala-js-workbench

201 Stars 112 Forks Last release: Not found 76 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Example Scala.js application

This is a slightly less barebone example of an application written in Scala.js. In particular, it links in libraries that are indispensible in being productive working with Scala.js.

Get started

To get started, run

sbt ~fastOptJS
in this example project. This should download dependencies and prepare the relevant javascript files. If you open
in your browser, it will show you an animated Sierpinski triangle (live demo). You can then edit the application and see the updates be sent live to the browser without needing to refresh the page.

The optimized version


sbt fullOptJS
and open up
for an optimized (~200kb) version of the final application, useful for final publication.

Dodge the Dots

Take a look at the

branch in the git repository if you want to see a slightly more complex application that was made in 30 minutes using this skeleton. Similar steps can be used for development or publication. There's a live demo here.

Space Invaders

There's also a

branch, also made in 30 minutes, with its own live demo.



branch contains an implementation of the TodoMVC example application, which is used to compare how the exact same application would be implemented using different languages and frameworks. This application makes heavy use of Scalatags and Scala.Rx, with heavy use of the DOM via scala-js-dom, making it a good example of how reactive web pages could be built using ScalaJS, as well as use of standalone ScalaJS libraries. live demo

Ray Tracer


branch contains a simple ray-tracer written using Scala.js, with a live demo.

Weather Map


branch contains an application that renders a heat map of the earth, using data pulled from OpenWeatherMap, with a live demo



branch contains a small sample client-server application, using Scala.js on the client and Spray on the server. The readme on that branch contains instructions on how to run it.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.