Skip to content

carlosedp/zio-scalajs-stack

Repository files navigation

Full Stack Scala 3 + ZIO + Scala.js

An experimental stack built with Scala 3 and composed of a ZIO backend and a Scala.js frontend. The backend includes logging and metrics for observability.

Libraries used:

  • Scala 3
  • ZIO
    • zio-http
    • zio-logging
    • zio-metrics
    • zio-test
  • Scala.js
  • scalajsdom
  • scalatest for the frontend
  • Nodejs
    • jsdom
    • Vite

Build

The build process supports the following targets:

Backend:

  • Generate Native Image (GraalVM) binary for current platform with locally installed GraalVM: ./mill backend.nativeImage
  • Generate Native Image (GraalVM) Linux binary in Docker container: ./mill backend.dockerNative.buildBin
  • Generate Docker Image with Native Image binary (for Linux in Docker): mill backend.dockerNative.build
  • Generate Docker Image with a JVM base and .jar app: mill backend.docker.build

If GraalVM fails building the binary on Linux, install libz-dev (Eg. sudo apt-get install libz-dev on Ubuntu/Debian or sudo dnf install zlib-devel on Fedora).

Frontend:

  • Build application for deployment (install nodejs, npm and npm i first): npm run build

Development

  1. Install a JDK in your path
  2. Install Node.js and npm
  3. Install NPM dependencies with npm install
  4. To start the development server, run npm run start, it will build the Scala.js Javascript files, start the ZIO backend and run Vite dev server. The Scala.js files are not automatically generated and reloaded. For this to work, open another shell and run ./mill -w frontend.fastLinkJS.

Open http://localhost:5173 or http://localhost:5173/?name=Yourname for testing.

About

Full-stack Scala ZIO + Scala.js application for test

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •