I'm happy to announce the 1.0 release of https://github.com/outr/spice, a full-stack HTTP framework for Scala 3 covering server, client, and cross-platform web development.
Core features:
Server: Composable filter-based DSL where you chain path segments, methods, handlers, and middleware with /. Undertow backend.
Client: Immutable builder pattern with typed JSON responses, retry management, rate limiting, and WebSocket support. Choose from java.net.http, OkHttp3, or Netty backends.
Cross-platform: Core types and client cross-compile to Scala.js, so URL parsing, headers, content types, and HTTP abstractions work identically on both JVM and browser.
OpenAPI generation: Define typed request/response pairs and get OpenAPI 3.0.3 specs generated and served automatically. Includes a Dart client code generator.
Production middleware: Authentication (Basic/Bearer), rate limiting, security headers, ETag/conditional requests, request size limits, CORS; all composable as filters.
WebSockets: First-class support on both server and client sides.
Delta/streaming: HTML parsing and streaming delta updates for dynamic content.
Server DSL example:
object ApiServer extends StaticHttpServer with CORSSupport { override protected val handler: HttpHandler = filters( SecurityHeadersFilter.Default, RateLimitFilter(maxRequests = 100, windowMillis = 60000L), HttpMethod.Get / "api" / "health" / Content.json(obj("status" -> "ok")), bearerAuth / HttpMethod.Get / "api" / "profile" / profileHandler ) }
Client example:
val todo = HttpClient .url(url"https://jsonplaceholder.typicode.com/todos/1") .get .call[Todo] .sync()
Built on rapid for async (Task-based), fabric for JSON, and idiomatic Scala 3 throughout.
GitHub: https://github.com/outr/spice
Happy to answer any questions!
submitted by /u/darkfrog26
[link] [comments]