Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/carlosedp/zio-scalajs-stack

Full-stack Scala ZIO + Scala.js application for test
https://github.com/carlosedp/zio-scalajs-stack

full-stack scala scalajs zio

Last synced: 10 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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 or for testing.