lolgab/snunit
63.5
Adequate · 20 September 2026
2.8k
lines of production code
Scala
primary language
1
measurement over time
What this system is
SNUnit is a Scala Native library that enables running HTTP and WebSocket applications on the FreeUnit in-process server runtime. It provides adapters for popular web frameworks including http4s, Tapir, and Undertow, allowing developers to build and deploy services using standard Scala idioms. The system includes build plugins for both SBT and Mill to streamline local development, testing, and deployment workflows.
How it got here
2020–2021 — Mill migration and Undertow support
13 changes.
The project underwent a major build system migration to Mill 0.12 and Scala 3, restructuring the module layout and removing legacy endpoints support. Core API types were refactored for better type safety, and the unsafe interop layer was updated to support Scala Native 0.5 and multithreading. New server backends, including an initial Undertow implementation and an sbt plugin for deployment, were added alongside comprehensive integration tests.
2022 — http4s and Tapir adapter integration
8 changes.
This period focused on expanding SNUnit's web framework support by introducing adapters for http4s 1.x and Tapir, enabling developers to build HTTP servers using these popular libraries. The work included implementing the necessary bridging logic for request/response translation and opaque header handling, alongside comprehensive integration tests to verify compatibility and functionality across the new backends.
2023–2025 — Cats Effect integration and testing expansion
9 changes.
This period focused on integrating Cats Effect 3 support across the framework, introducing new traits and builders for HTTP4s and Tapir applications to ensure proper resource management. Concurrently, the project expanded its test coverage with integration tests for WebSocket, HTTP4s, and Tapir functionalities, while also updating the Mill plugin to support FreeUnit as the default in-process server.
Features
Add Cats Effect integration for Tapir server endpoints
New files in the snunit-tapir-cats-effect module introduce support for running Tapir server endpoints using the Cats Effect 3 runtime. This includes a TapirApp trait for simple application setup, a SNUnitCatsServerInterpreter to bridge Tapir's server logic with Cats Effect's Async type class, and a SNUnitServerBuilder to configure and launch the server with proper resource management and dispatcher handling.
snunit-tapir-cats-effect · high confidence
Add http4s 1.x support with opaque Headers and Entity-based body handling
Users can now use the library with http4s version 1.x alongside the existing 0.23 support. This update introduces a new \VersionSpecific\ implementation for http4s 1 that utilizes the \snunit.Headers\ opaque type instead of raw tuples and handles request bodies via \http4s.Entity\ (strict or streamed) rather than raw byte arrays, ensuring compatibility with the newer http4s API surface.
snunit-http4s/http4s-1 · high confidence
Add stub implementations for scheduler, websocket client, and logging
The snunit-cask library now includes stub implementations for core utilities: a Scheduler for delayed execution, a WebsocketClientImpl for WebSocket connections, and a java.util.logging facade. These additions provide basic scaffolding for these features, allowing applications to compile and run with placeholder functionality while the actual implementations are developed or integrated.
snunit-cask · high confidence
Initial Undertow server implementation
Adds the \snunit-undertow\ module, providing a new server backend that runs on the Undertow engine. This implementation introduces core server components including \Undertow\ for starting the server, \HttpServerExchange\ for handling HTTP requests (with support for query parameters and cookies), \HttpHandler\ for request processing, and \BlockingHandler\ for managing blocking I/O. It also includes foundational support for WebSocket connections and form data parsing, enabling users to build HTTP and WebSocket applications using the Undertow runtime.
snunit-undertow · high confidence
Initialize SBT build configuration for the plugin
The sbt-plugin module now includes the necessary project scaffolding to be built with SBT. This adds a symlink to the shared scalafmt configuration, sets the SBT version to 1.10.1, and registers the sbt-sonatype, sbt-pgp, and sbt-scalafmt plugins, enabling local development and publishing workflows for the plugin.
sbt-plugin/project · high confidence
Introduce Cats Effect-based asynchronous server builder
Added CEAsyncServerBuilder, a new component that enables running the SNUnit server using the Cats Effect runtime. This implementation integrates with Cats Effect's Dispatcher for asynchronous execution and utilizes a FileDescriptorPoller for non-blocking I/O handling, allowing users to leverage Cats Effect's concurrency primitives within the server lifecycle.
snunit-async-cats-effect · high confidence
Introduce Http4sApp trait for resource-managed HTTP4s integration
A new \Http4sApp\ trait is introduced in the \snunit\ package to simplify the setup of HTTP4s applications. This trait extends \IOApp.Simple\ and requires implementations to provide a \routes\ definition that returns a \Resource\[IO, HttpApp\[IO\]\]\, ensuring proper resource management for the HTTP application. The \run\ method automatically uses this resource to configure and start the \SNUnitServerBuilder\, providing a standardized way to launch HTTP4s services with Cats Effect.
snunit-http4s/src/snunit · high confidence
Introduce Tapir server interpreter for SNUnit
Added a new Tapir server interpreter (\SNUnitGenericServerInterpreter\ and \SNUnitIdServerInterpreter\) that allows developers to build HTTP servers using the Tapir framework on top of the SNUnit runtime. This implementation maps Tapir's request/response model to SNUnit's native request handling, supporting standard body types (string, byte array, file) and header management, thereby enabling Tapir-based API definitions to run directly within the SNUnit environment.
snunit-tapir · high confidence
Introduce http4s adapter for SNUnit server integration
Added a new http4s adapter module that bridges the SNUnit server runtime with the http4s web framework. This implementation provides an \SNUnitServerBuilder\ to configure and launch an http4s \HttpApp\, handling the translation of incoming SNUnit requests into http4s \Request\ objects (including method, URI, headers, and version) and writing back http4s responses. The adapter leverages Cats Effect for asynchronous execution, using a parallel Dispatcher to run http4s routes and ensuring proper shutdown synchronization via Deferred.
snunit-http4s/src/snunit/http4s · high confidence
New sbt plugin for deploying Scala Native apps to FreeUnit
The sbt plugin now includes support for deploying Scala Native applications to FreeUnit (the in-process NGINX Unit runtime). This adds the \deployToFreeUnit\ task, which builds the native executable and deploys it to the configured port (defaulting to 8080). The plugin also introduces \DockerClangPlugin\ to generate and cache Docker-compatible Clang scripts required for the build environment, and configures the Scala Native plugin to use these custom Clang/Clang++ paths. The legacy \deployToNGINXUnit\ task is deprecated in favor of \deployToFreeUnit\.
sbt-plugin/src/main · high confidence
Removals
Removal of Snunit server interpreters from endpoints module
The server-side interpreter implementations for the \endpoints\ library within the \snunit\ backend have been removed. This deletion eliminates the ability to run \endpoints\-defined APIs on the Snunit runtime, as the specific routing, HTTP method, status code, URL parsing, and JSON entity codecs (including upickle integration) that bridged the algebraic definitions to the Snunit server are no longer present.
snunit/endpoints · high confidence
Removed duplicate example files
The duplicate example files HelloWorld.scala and LowLevelExample.scala have been removed from the snunit examples directory. These files previously demonstrated basic HTTP server setup using both high-level and low-level APIs, but their removal simplifies the example set by eliminating redundancy.
snunit/src/snunit/examples · high confidence
Behavioural changes
Migration to Mill 0.12 and Scala 3 with new build structure
The build system has been migrated from the legacy \build.sc\ (Mill 0.7.4, Scala 2.11) to a modern \build.mill.scala\ structure using Mill 0.12.14 and Scala 3.3.4. This change introduces a new module layout with dedicated artifacts for \snunit-async-cats-effect\, \snunit-undertow\, \snunit-tapir\, \snunit-http4s\, and \snunit-cask\, replacing the previous \endpoints\ and \autowire\ modules. The project now supports cross-compilation for http4s 0.23 and 1.x, integrates Tapir 1.11.1, and uses Cats Effect 3.7.0. Additionally, the \cask\ and \castor\ sources are now fetched and patched dynamically during the build, and the license has been updated to Apache 2.0.
(repo-wide) · high confidence
Redesign of core API types and request handling in snunit
The snunit library has been refactored to replace opaque value classes with opaque types for core entities like Request, Method, and StatusCode, and to introduce a dedicated Headers opaque type for managing HTTP headers. This change updates the Request API to expose query parameters via a new \query\ field and provides indexed access to headers, while the server builder now uses explicit \RequestHandler\ and \WebsocketHandler\ traits instead of raw function types. Additionally, the \Request\ API now supports sending responses with \Array\[Byte\]\ content and a new \Headers\ type, replacing the previous \Seq\[(String, String)\]\ approach.
snunit/src/snunit · high confidence
SNUnit Mill plugin now supports FreeUnit as the in-process server
The SNUnit Mill plugin has switched its default in-process server from NGINX Unit to FreeUnit. Users can now run and test their Scala Native applications using FreeUnit, which is automatically downloaded and compiled during the build process. The plugin exposes new targets such as \snunitFreeUnitVersion\, \snunitFreeUnitUser\, and \snunitFreeUnitGroup\ to configure the FreeUnit instance, while the previous NGINX Unit-specific targets are now deprecated in favor of these new FreeUnit equivalents.
snunit-mill-plugin · high confidence
Unsafe layer refactored for Scala Native 0.5 and multithreading support
The unsafe interop layer for NGINX Unit has been redesigned to support Scala Native 0.5 and multithreading environments. The previous \CApi\ and \Utils\ modules were removed and replaced with new files (\unsafe.scala\, \constants.scala\, \newCharBuffer.scala\, \stringUtils.scala\) that use opaque types for C structures and inline functions for performance. String handling now relies on runtime-detected memory offsets (\StringCharArrayOffset\, etc.) to correctly deconstruct Java strings in both single-threaded and multithreading modes, ensuring safe and efficient conversion between C strings and Scala strings without relying on manual pointer arithmetic hacks.
snunit/src/snunit/unsafe · high confidence
Test coverage
Add integration test for Undertow Hello World server; Add integration tests for multiple server implementations and features; Add simple SBT plugin test demonstrating the new opaque Headers API; Added Tapir Hello World integration test; Added http4s integration test; Added integration test for Cask application; Added integration test for Http4sApp; Added integration test for TapirApp with IO; Added integration tests for WebSocket echo functionality; Added integration tests for hello-world and multiple-handlers scenarios; Added integration tests for the SNUnit Mill plugin; Added tests for Headers opaque type and unsafe byte conversion utilities; Added tests for the SBT plugin's local deployment and server interaction.
Dependencies
New sbt plugin for SNUnit
An sbt plugin named 'sbt-snunit' has been added, allowing users to integrate SNUnit into their Scala Native projects via sbt. The plugin is published to Sonatype and depends on the shared SNUnit version, enabling seamless setup of the SNUnit testing framework within sbt-based Scala Native applications.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 63.
Lenses
- Code Health 96
- Architecture 100
- Maturity 53
- Readiness 64
- Security 69
Changes since last survey
- 225 commits — 208 feature/other, 17 fixes
By area
- (root) — 111 commits
- snunit/src — 22 commits
- .github/workflows — 18 commits
- integration/test — 11 commits
- integration/tests — 9 commits
- snunit/native — 6 commits
- snunit-tapir/shared — 5 commits
- sbt-plugin/build.sbt — 4 commits
- snunit-http4s/src — 4 commits
- sbt-plugin/src — 3 commits
- snunit-async-epollcat/src — 3 commits
- snunit-http4s/shared — 3 commits
- snunit-mill-plugin/src — 3 commits
- snunit-undertow/src — 3 commits
- snunit/shared — 3 commits
- snunit-routes/src — 2 commits
- snunit/endpoints — 2 commits
- snunit/resources — 2 commits
- cask/src — 1 commit
- docs/.nojekyll — 1 commit
Notable commits
- fix: Fix AsyncServerBuilder to return error code (#22)
- fix: Fix Mima (#112)
- fix: Fix README.md main example
- fix: Fix Tapir to return the response code
- fix: Fix artifactName in multiplatform modules (#65)
- fix: Fix autowire server with methods returning Int (#24)
- fix: Fix crash with empty response (#33)
- fix: Fix execute for epollcat to run asynchronously (#109)
- fix: Fix http4s server not restarting (#110)
- fix: Fix issue with restarting the apps getting stuck (#108)
- fix: Fix lolgab Github link
- fix: Fix regression reading request headers (#137)
- fix: Fix travis build (#4)
- fix: Introduce target for raw path. Fix different behaviour of path in jvm (#79)
- fix: Revert "Vendor in-process NGINX Unit and simplify build (#181)" (#183)
- fix: Update versions, fix tests, undertow implementation depends on isMultithreadingEnabled (#170)
- fix: fix: Sbt publishing on s01.oss.sonatype.org
- change: Better support for cookies (#179)
- change: Add AsyncServer based on scala-native-loop
- change: Add CHANGELOG.md
- …and 205 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
lolgab/snunit was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit dcf80ba32697a1f67bcb361af3e148fe392b9648 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.