/scalajs-talk-at-imperial

Presentation about frontend development with Scala.js Originally made for students at Imperial College London

Primary LanguageScala

Scala.js application

This is a simple Scala.js application that I created as supporting material for a presentation at Imperial College London.

Main purpose of presentation was introducing Scala.js and Laminar (see below), showcasing interop features with JavaScript libraries and briefly touching upon packaging and deployment. Final version of an application uses browser storage for data, but has a JVM backend that invokes OpenAI API to generate titles from descriptions.

Live version | Slides

The final app is built on these languages, technologies, and frameworks:

The authors behind those tools and libraries walked so I could at least crawl, I'm deeply grateful.

V1

Code

This version only has the basic frontend functionality, and is a pure Scala.js frontend. The Dockerfile that deploys it just creates a container that serves static content build by Vite.

CleanShot 2024-05-18 at 12 56 27

V2

Code

This version is same as V1, but adds an integration with Apache ECharts – a library for charts and plotting. It's a good example to showcase very basic interop with JS libraries. Deployment is the same as V1 – it's still a frontend-only application.

CleanShot 2024-05-18 at 12 57 54

V3

Code | Live version

The most involved version, builds upon V2 and adds a JVM backend (using Cask) which exposes an endpoint that generates a title for a description using OpenAI API. The app is packaged as a self-contained JAR file, which serves Vite's bundle and exposes the API at the same time.

CleanShot 2024-05-18 at 13 00 02