Skip to content

Introduction

Uni is the standard library Scala 3 didn't ship with.

Logging, object wiring, JSON & MessagePack, reactive streams, HTTP clients and servers, RPC, and a browser UI toolkit — small, composable pieces that work identically on the JVM, in the browser and Node.js (Scala.js), and as native binaries (Scala Native), with almost no external dependencies.

It distills the most-used building blocks of the Airframe ecosystem into one cohesive, Scala-3-first library.

Get going in 30 seconds

Add one dependency (Installation) and you have all of it — no à-la-carte modules to assemble.

A quick taste

Object wiring, structured logging, and lifecycle management — three things you usually reach for three libraries for — in a handful of lines:

scala
import wvlet.uni.design.Design
import wvlet.uni.log.LogSupport

class GreeterService extends LogSupport:
  def greet(name: String): String =
    info(s"Greeting ${name}")      // logs with source file + line
    s"Hello, ${name}!"

@main def main =
  Design.newDesign
    .bindSingleton[GreeterService]
    .build[GreeterService] { greeter =>   // wired, started, and cleaned up
      println(greeter.greet("Uni"))
    }

Why Uni?

  • 🪶 Minimal dependencies — foundational utilities without dragging in a heavy framework.
  • 🌍 One codebase, three runtimes — the same source compiles for JVM, Scala.js, and Scala Native.
  • 🧩 Composable — small, focused APIs designed to combine, not to lock you in.
  • Scala 3 first — built around derives, given, enums, and macros.
  • 🔋 Production-tested — battle-hardened code, refined from the Airframe ecosystem.

What's inside

Core

ModuleDescription
DesignObject wiring with lifecycle management
LoggingLogging with source-location tracking
SurfaceCompile-time type introspection
FileSystemCross-platform file I/O with IOPath

Data & Serialization

ModuleDescription
JSONPure-Scala JSON parser and DSL
MessagePackCompact binary serialization
WeaverDerivation-based codecs — JSON / MessagePack / Map from one derives Weaver

Async & Control Flow

ModuleDescription
RxReactive streams and async data flows
ControlRetry, circuit breaker, rate limiter, cache, resources
BackgroundTaskCancellable, progress-pollable background workers

HTTP & RPC

ModuleDescription
HTTPCross-platform client and server (Netty / Node.js / Native)
RPCType-safe remote calls, with client code generation
WebSocketCross-platform bidirectional WebSocket client
Server-Sent EventsOne-way server→client streaming

UI & CLI

ModuleDescription
CLITerminal styling, progress bars, command launching
Web UIReactive browser UIs with RxElement (Scala.js)

Testing

ModuleDescription
UniTestLightweight, expressive, cross-platform test framework

Next steps

Released under the Apache 2.0 License.