Tutorials

This series of tutorials teaches you how to use Scala.js together with modern development tools. They can be followed independently of each other.

If you have time, reading and applying them in order will give you more in-depth knowledge about the development environment.

If you are in a hurry, you can skip the ones you are not interested in. Each tutorial starts with a link to a repo that you can clone to get off the ground.

In any case, make sure that you have the prerequisites listed below covered.

  1. Scala.js and Vite:
    • Set up a hello world project ready for live reloading in the browser.
    • Generate minimized production assets.
  2. Laminar:
    • Build UIs with Laminar using Functional Reactive Programming (FRP), a hybrid model between imperative and functional programming particularly well suited for UI development in Scala.
  3. ScalablyTyped:
    • Integrate JavaScript libraries using ScalablyTyped.

Prerequisites

In any case, make sure that you have the following tools installed first:

If in doubt, try the following commands in a terminal. They should all succeed, though the reported version numbers may differ.

$ node -v
v16.13.0
$ npm -v
8.1.0
$ sbt -version
sbt version in this project: 1.7.3
sbt script version: 1.7.3

We also recommend that you use an IDE for Scala. If you do not know what to pick, we recommend VS Code with the Metals extension.

Older tutorials

Here are some older tutorials, which may still provide value:

Additionally, take a look at the available Project Skeletons to start with a pre-existing template.