Skip to main content

ZIO HTTP

POWERINGHIGH-PERFORMANCEFUNCTIONAL APIs

Explore the most performant, type-safe HTTP library for ZIO. Built for modern microservices.

Ultra-Fast
Type-Safe
Modular
0 stars0+ contributorsv3.11.3 latest

ZIO HTTP in Action

Explore idiomatic Scala patterns for building high-performance, type-safe HTTP servers and clients. From routing and endpoints to middleware and real-time communication.

import zio._
import zio.http._

object GreetingServer extends ZIOAppDefault {

val routes =
Routes(
Method.GET / "greet" -> handler { (req: Request) =>
val name = req.queryParamOrElse("name", "World")
Response.text(s"Hello, $name!")
},
Method.GET / "health" -> handler {
Response.ok
}
)

def run = Server.serve(routes).provide(Server.default)
}

Key Features

Build high-performance, scalable web applications with ZIO HTTP

Type-Driven Endpoints

Declarative or imperative endpoints, type-checked against the description at compile time.

OpenAPI, Both Ways

Generate OpenAPI docs from your endpoints — or endpoints from an OpenAPI spec.

Schema-Powered Codecs

Encode and decode bodies via ZIO Schema: JSON, Protobuf, Avro, and Thrift.

Composable Middleware

Auth, CORS, logging, and metrics as reusable, composable middleware.

Real-Time Ready

Built-in WebSockets and Server-Sent Events for live, streaming apps.

First-Class Testing

Test routes and clients without a live server, using the testkit.

Ecosystem

A complete toolkit for building scalable, resilient applications

ZIO logo

ZIO

A type-safe, composable library for async and concurrent programming in Scala

  • Build scalable applications with minimal overhead.
  • Catch bugs at compile time with powerful type safety.
  • Write concurrent code without deadlocks or race conditions.
  • Seamless code for both sync and async operations.
  • Never leak resources, even during failures.
  • Build resilient systems that handle errors gracefully.
  • Compose complex solutions from simple building blocks.
  • Built-in dependency injection.
  • Structured concurrency with simplicity and safety.
  • Fine-grained interruption for cancelable operations.
  • Integrated metrics and observability.
  • Seamless interop with Java and Scala libraries.
🧬

ZIO Schema

A library for describing data types and their encodings in a composable way

  • Automatic derivation of schemas
  • Support for many formats (JSON, Protobuf, etc.)
  • Schema transformations and migrations
  • Integration with ZIO HTTP
🛠️

ZIO Config

A type-safe, composable library for configuration management in Scala

  • Type-safe configuration descriptions
  • Multiple source support (files, env vars, etc.)
  • Documentation generation
  • Validation and error reporting
📝

ZIO Logging

A composable logging library for ZIO applications

  • Structured logging for ZIO applications
  • Multiple backend support
  • Context-aware logging
  • Integration with MDC and log correlation
🔗

ZIO Stream

A powerful streaming library for processing infinite data with finite resources

  • Fully asynchronous and non-blocking streaming
  • Resource-safe processing of large data
  • Rich set of combinators for data transformation
  • Backpressure handling and flow control

ZIO Test

A testing framework built on ZIO for writing comprehensive, concurrent tests

  • Property-based testing
  • First-class support for asynchronous testing
  • Compositional test aspects for reusable configurations
  • Run test effects in parallel for faster test suites
  • Integration with JUnit and other test frameworks
🔒️

ZIO STM

Software Transactional Memory for composable concurrent state management

  • Atomic, isolated transactions
  • Composable concurrent operations
  • No deadlocks or race conditions
  • Automatic retry of interrupted transactions

Learn ZIO HTTP with Zionomicon

The comprehensive guide to building scalable applications with ZIO

Zionomicon is the definitive guide to ZIO, written by the creators of the library. It covers all aspects of the ZIO ecosystem, including a dedicated chapter on ZIO HTTP that teaches you how to build high-performance, type-safe web applications and APIs.

In the ZIO HTTP chapter, you'll learn:

  • Building scalable HTTP servers with minimal boilerplate
  • How ZIO HTTP is modeled as "HTTP as a Function"
  • Type-safe request handling
  • Working with middleware and interceptors
  • How to design your API declaratively
Zionomicon Book Cover

Who is Using ZIO HTTP?

Organizations and projects building with ZIO HTTP in production