Template for a Scala.js frontend application using Laminar and ScalablyTyped to use TypeScript typings.
I had a cool idea for a webapp. I sketched it out, thought about the tech stack, the UX. I decided to use Scala for the fronted using Scala 3, Scala.js and Laminar. Excited, I set in front of the keyboard... Just to spend hours putting together the build and understanding all of the pieces.
I did not invent anything, I followed these excellent documentation pages
I decided to set up a minimalistic template and make it public for other people having the same ideas.
- Inside an sbt shell, run
~frontend/fastLinkJS
. - In another terminal
cd frontend
and thennpm run dev
. - Open the link appearing in the terminal in your browser.
- Any change to the Scala code will trigger a refresh of the app in your browser
You can run scalafmtAll
to format the codebase.
You can add Javascript/Typescript dependencies with
npm install --save <lib>
inside the frontend
directory.
- sbt
- vite
- scalajs
- laminar
- ScalablyTyped
- scalafmt
- nix shell
- sbt-tpolecat