# ZIO HTTP > A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers This file contains links to documentation sections following the llmstxt.org standard. ## Table of Contents - [ZIO HTTP Examples](https://ziohttp.com/examples/index.md): This section aims to demonstrate the usage of key concepts and ideas in the ZIO HTTP library with examples. - [Introduction to ZIO HTTP](https://ziohttp.com/introduction.md): ZIO HTTP is a scala library for building http apps. It is powered by ZIO and [Netty](https://netty.io/) and aims at being the defacto solution for ... - [Request-scoped Context Management](https://ziohttp.com/reference/contextual/index.md): When building web applications with ZIO HTTP, you often need to share contextual information across different layers of your request processing pip... - [Integration of Datastar with ZIO HTTP](https://ziohttp.com/reference/datastar-sdk/index.md): [Datastar](https://data-star.dev/) is a hypermedia-driven framework for building reactive web applications with minimal JavaScript. The `zio-http-d... - [ZIO HTTP Reference](https://ziohttp.com/reference/index.md): This section offers a detailed reference for the essential concepts and ideas in the ZIO HTTP library. - [ZIO HTTP Testkit](https://ziohttp.com/reference/zio-http-testkit/index.md): `zio-http-testkit` provides testing infrastructure for ZIO HTTP applications, enabling developers to test HTTP logic without real servers, mock ext... - [Installation](https://ziohttp.com/installation.md): In this guide, we will learn how to get started with a new ZIO HTTP project. - [HandlerAspect](https://ziohttp.com/reference/aop/handler_aspect.md): A `HandlerAspect` is a wrapper around `ProtocolStack` with the two following features: - [Middleware](https://ziohttp.com/reference/aop/middleware.md): A middleware helps in addressing common crosscutting concerns without duplicating boilerplate code. - [ProtocolStack](https://ziohttp.com/reference/aop/protocol-stack.md): :::note - [BinaryCodecs for Request/Response Bodies](https://ziohttp.com/reference/body/binary_codecs.md): ZIO HTTP has built-in support for encoding and decoding request/response bodies. This is achieved using generating codecs for our custom data types... - [Body](https://ziohttp.com/reference/body.md): `Body` is a domain to model content for `Request` and `Response`. The body can be a fixed chunk of bytes, a stream of bytes, or form data, or any t... - [Form Data](https://ziohttp.com/reference/body/form.md): The `Form` represents a collection of `FormFields` that can be a multipart or URL-encoded form: - [Template](https://ziohttp.com/reference/body/template.md): The package `zio.http.template._` contains lightweight helpers for generating statically typed, safe html similar in spirit to `scalatags`. - [Client](https://ziohttp.com/reference/client.md): `ZClient` is an HTTP client that enables us to make HTTP requests and handle responses in a purely functional manner. ZClient leverages the ZIO lib... - [ConnectionPoolConfig](https://ziohttp.com/reference/configs/connection-pool.md): --- - [DNS Resolver Config](https://ziohttp.com/reference/configs/dns-resolver.md): --- - [Introduction](https://ziohttp.com/reference/configs/introduction.md): This section describes structure of `Config` objects supported by ZIO HTTP. - [Netty Config](https://ziohttp.com/reference/configs/netty.md): --- - [OpenAPI Config](https://ziohttp.com/reference/configs/openapi.md): --- - [Server Config](https://ziohttp.com/reference/configs/server.md): --- - [Request-scoped Context with RequestStore](https://ziohttp.com/reference/contextual/request-store.md): **RequestStore** is a fiber-local storage mechanism in ZIO HTTP that allows you to store and retrieve request-scoped data throughout the lifecycle ... - [Request-scoped Context via ZIO Environment](https://ziohttp.com/reference/contextual/zio-environment.md): ZIO HTTP provides request-scoped context through ZIO's Environment system, which offers type-safe dependency injection and context propagation. The... - [Datastar HTML Attributes](https://ziohttp.com/reference/datastar-sdk/attributes.md): The `zio-http-datastar-sdk` provides extensions to the templating module that allow you to easily add type-safe Datastar attributes to your HTML el... - [Datastar SDK Examples](https://ziohttp.com/reference/datastar-sdk/examples.md): All code from this reference is available as runnable examples in the `zio-http-example` module. - [Datastar Event Generation Helpers](https://ziohttp.com/reference/datastar-sdk/server-api.md): ZIO HTTP provides a set of helpers to generate Datastar events that can be sent to the browser as a response. These helpers make it easy to create ... - [Extracting Datastar Signals from Requests](https://ziohttp.com/reference/datastar-sdk/signals.md): When the client sends a request to the server, it includes the current values of all signals. For GET requests, signals are sent in a special query... - [Endpoint](https://ziohttp.com/reference/endpoint.md): The `Endpoint` API in ZIO HTTP, is an alternative way to describe the endpoints but in a declarative way. It is a high-level API that allows us to ... - [Request Handler](https://ziohttp.com/reference/handler.md): A `Handler` is responsible for processing the matched incoming request and generating an appropriate response. It is a function that takes a `Reque... - [Headers](https://ziohttp.com/reference/headers.md): **ZIO HTTP** provides support for all HTTP headers (as defined in [RFC2616](https://datatracker.ietf.org/doc/html/rfc2616)) along with custom headers. - [Cookies](https://ziohttp.com/reference/headers/session/cookies.md): Cookies are small pieces of data that websites store on a user's browser. They are sent between the client (browser) and server in HTTP requests an... - [Flash Messages](https://ziohttp.com/reference/headers/session/flash.md): Flash messages are temporary short-lived messages that are displayed to users on web applications to inform users about the outcome of certain acti... - [HttpCodec](https://ziohttp.com/reference/http-codec.md): In ZIO HTTP when we work with HTTP requests and responses, we are not dealing with raw bytes but with structured data. This structured data is repr... - [OpenAPI codegen sbt plugin](https://ziohttp.com/reference/openapi-gen-sbt-plugin.md): This plugin allows to easily generate scala source code with zio-http Endpoints from OpenAPI spec files. - [Overview](https://ziohttp.com/reference/overview.md): ZIO HTTP offers an expressive API for creating HTTP applications. It uses a domain-specific language (DSL) to define routes and handlers. Both serv... - [Request](https://ziohttp.com/reference/request.md): **ZIO HTTP** `Request` is designed in the simplest way possible to decode an HTTP Request into a ZIO HTTP request. It supports all HTTP request met... - [Response](https://ziohttp.com/reference/response.md): **ZIO HTTP** `Response` is designed to encode HTTP Response. - [Status Codes](https://ziohttp.com/reference/response/status.md): HTTP status codes are standard response codes given by web services on the Internet. The codes help identify the cause of the problem when a web pa... - [PathCodec](https://ziohttp.com/reference/routing/path_codec.md): `PathCodec[A]` represents a codec for paths of type `A`, comprising segments where each segment can be a literal, an integer, a long, a string, a U... - [RoutePattern](https://ziohttp.com/reference/routing/route_pattern.md): `RoutePattern` defines a pattern for matching routes by examining both the HTTP method and the path. In addition to specifying a method, patterns c... - [Routes](https://ziohttp.com/reference/routing/routes.md): `Routes` models a collection of routes, each of which is defined by a pattern and a handler. This data type can be thought of as modeling a routing... - [Server](https://ziohttp.com/reference/server.md): Using the ZIO HTTP Server, we can serve one or more HTTP applications. It provides methods to install HTTP applications into the server. Also it of... - [Socket](https://ziohttp.com/reference/socket.md): Websocket support can be added to your Http application using the same `Http` domain, something like this — - [WebSocketFrame](https://ziohttp.com/reference/socket/websocketframe.md): In the [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) protocol, communication happens using frames. ZIO - [Template DSL](https://ziohttp.com/reference/template.md): ZIO HTTP Template2 is a modern, type-safe HTML templating DSL for Scala that allows you to write HTML, CSS, and JavaScript directly in your Scala c... - [Running the Examples](https://ziohttp.com/reference/zio-http-testkit/examples.md): All code examples from this testkit guide are available as runnable tests in the `zio-http-example-testing` project. Each example demonstrates a sp... - [HttpTestAspect](https://ziohttp.com/reference/zio-http-testkit/http-test-aspect.md): `HttpTestAspect` is a ZIO Test aspect utility that temporarily configures HTTP application modes for testing. It provides composable test aspects t... - [TestChannel](https://ziohttp.com/reference/zio-http-testkit/test-channel.md): `TestChannel` is an in-memory bidirectional message channel for testing WebSocket handlers. It simulates a WebSocket connection between client and ... - [TestClient](https://ziohttp.com/reference/zio-http-testkit/test-client.md): `TestClient` is an in-memory HTTP client driver for mocking external API dependencies in tests. Instead of making real HTTP calls to external servi... - [TestServer](https://ziohttp.com/reference/zio-http-testkit/test-server.md): `TestServer` is an integration testing HTTP server that simulates a real server listening on localhost. Unlike a real production server, it skips e... - [Securing Your APIs: Authentication with JWT Bearer and Refresh Tokens](https://ziohttp.com/guides/authentication-with-jwt-bearer-and-refresh-tokens.md): In the [previous guide](./authentication-with-jwt-bearer-tokens.md), we explored JWT bearer tokens and their role in modern API authentication. We ... - [Securing Your APIs: Authentication with JWT Bearer Tokens](https://ziohttp.com/guides/authentication-with-jwt-bearer-tokens.md): Self-contained tokens are authentication tokens that carry all the necessary information within themselves, eliminating the need for server-side st... - [Securing Your APIs: Authentication with Opaque Bearer Tokens](https://ziohttp.com/guides/authentication-with-opaque-bearer-tokens.md): Bearer token authentication provides a stateless, secure mechanism for API access control by requiring clients to present tokens with each request.... - [Securing Your APIs: Authentication with a Third-party OAuth Provider](https://ziohttp.com/guides/authentication-with-a-third-party-oauth-provider.md): In this guide, we walk through implementing OAuth 2.0 authentication using GitHub as an identity provider, based on the provided Scala and ZIO HTTP... - [Securing Your APIs: Basic Authentication](https://ziohttp.com/guides/basic-authentication.md): Basic Authentication is one of the simplest HTTP authentication schemes, widely used for securing web applications and APIs. In this guide, we'll e... - [Securing Your APIs: Cookie-based Authentication](https://ziohttp.com/guides/cookie-based-authentication.md): Session-based authentication using cookies is one of the most common authentication mechanisms for web applications. In this guide, we demonstrate ... - [Securing Your APIs: Digest Authentication](https://ziohttp.com/guides/digest-authentication.md): Digest Authentication provides enhanced security over Basic Authentication by addressing fundamental vulnerabilities in credential transmission. Th... - [Implementing Mutual TLS (mTLS)](https://ziohttp.com/guides/implementing-mutual-tls.md): Mutual TLS (mTLS) extends standard TLS by requiring both the client and server to present and verify certificates. This creates bidirectional authe... - [Implementing TLS with an Intermediate CA-signed Server Certificate](https://ziohttp.com/guides/implementing-tls-with-intermediate-ca-signed-server-certificate.md): In production environments, server certificates are rarely signed directly by root Certificate Authorities. Instead, they use intermediate CAs to c... - [Implementing TLS with Root CA-Signed Server Certificate](https://ziohttp.com/guides/implementing-tls-with-root-ca-signed-server-certificate.md): Root Certificate Authority (CA) signed certificates form the backbone of trust on the internet. Unlike self-signed certificates, CA-signed certific... - [Implementing TLS with Self-signed Server Certificate](https://ziohttp.com/guides/implementing-tls-with-self-signed-server-certificate.md): Self-signed certificates are TLS/SSL certificates that are signed by the same entity that creates them, rather than by a trusted Certificate Author... - [How to Integrate with ZIO Config](https://ziohttp.com/guides/integration-with-zio-config.md): When building HTTP applications, it is common to have configuration settings that need to be loaded from various sources such as environment variab... - [Building a Real-time Chat with Datastar](https://ziohttp.com/guides/real-time-chat-with-datastar.md): This guide walks through building a real-time multi-client chat application using ZIO HTTP and Datastar. The application demonstrates several power... - [Securing Communication with SSL/TLS](https://ziohttp.com/guides/securing-communication-with-ssl-tls.md): ZIO HTTP supports securing communication between entities—typically clients and servers—using SSL/TLS. This is crucial for protecting sensitive dat... - [Testing HTTP Applications](https://ziohttp.com/guides/testing-http-apps.md): Testing HTTP applications is fundamentally different from testing regular Scala libraries — you're testing code that handles network I/O, manages s... - [Securing Your APIs: Passwordless Authentication with WebAuthn](https://ziohttp.com/guides/passwordless-authentication-with-webauthn.md): Passwords have long been the cornerstone of online authentication, but they come with significant drawbacks. Users often struggle to create and rem... - [Authentication Example](https://ziohttp.com/examples/authentication.md): ```scala title="zio-http-example/src/main/scala/example/AuthenticationServer.scala" - [Command-line Interface (CLI)](https://ziohttp.com/examples/cli.md): ```scala title="zio-http-example/src/main/scala/example/endpoint/CliExamples.scala" - [Concrete Entity Example](https://ziohttp.com/examples/concrete-entity.md): ```scala title="zio-http-example/src/main/scala/example/ConcreteEntity.scala" - [Endpoint Scala 3 Syntax](https://ziohttp.com/examples/endpoint-scala3.md): ```scala - [Endpoint Examples](https://ziohttp.com/examples/endpoint.md): ```scala title="zio-http-example/src/main/scala/example/EndpointExamples.scala" - [Graceful Shutdown Example](https://ziohttp.com/examples/graceful-shutdown.md): ```scala title="zio-http-example/src/main/scala/example/GracefulShutdown.scala" - [Hello World Example](https://ziohttp.com/examples/hello-world.md): ```scala title="zio-http-example/src/main/scala/example/HelloWorld.scala" - [HTML Templating Example](https://ziohttp.com/examples/html-templating.md): ```scala title="zio-http-example/src/main/scala/example/HtmlTemplating.scala" - [HTTP Client-Server Example](https://ziohttp.com/examples/http-client-server.md): ```scala title="zio-http-example/src/main/scala/example/ClientServer.scala" - [HTTPS Client and Server Example](https://ziohttp.com/examples/https-client-server.md): ```scala title="zio-http-example/src/main/scala/example/HttpsClient.scala" - [Middleware CORS Handling Example](https://ziohttp.com/examples/middleware-cors-handling.md): ```scala title="zio-http-example/src/main/scala/example/HelloWorldWithCORS.scala" - [Multipart Form Data Example](https://ziohttp.com/examples/multipart-form-data.md): ```scala title="zio-http-example/src/main/scala/example/MultipartFormData.scala" - [Server Sent Events in Endpoints Example](https://ziohttp.com/examples/server-sent-events-in-endpoints.md): ```scala title="zio-http-example/src/main/scala/example/ServerSentEventEndpoint.scala" - [Serving Static Files Example](https://ziohttp.com/examples/serving-static-files.md): ```scala title="zio-http-example/src/main/scala/example/StaticFiles.scala" - [Serving Static Files](https://ziohttp.com/examples/static-files.md): ```scala title="zio-http-example/src/main/scala/example/StaticFiles.scala" - [Streaming Examples](https://ziohttp.com/examples/streaming.md): ```scala title="zio-http-example/src/main/scala/example/RequestStreaming.scala" - [WebSocket Example](https://ziohttp.com/examples/websocket.md): This example shows how to create a WebSocket server using ZIO HTTP and how to write a client to connect to it. - [Dev / Preprod / Prod Modes](https://ziohttp.com/concepts/dev-mode.md): ZIO HTTP provides a simple built-in notion of application "mode" so you can adapt behavior (e.g. enable extra diagnostics in development, stricter ... - [Endpoint API](https://ziohttp.com/concepts/endpoint.md): The Endpoint API is a declarative DSL for defining HTTP endpoints. It is a way to define a type safe API for your application. - [Middleware](https://ziohttp.com/concepts/middleware.md): A middleware has the purpose of intercepting a request, a response or both. It helps in implementing cross-cutting concerns like access logging, au... - [Routing](https://ziohttp.com/concepts/routing.md): ZIO HTTP routing does some things differently than other (Scala) HTTP libraries. - [RC4 To Xx](https://ziohttp.com/migration/RC4-to-xx.md): **QueryCodec** - [RC6 To Xx](https://ziohttp.com/migration/RC6-to-xx.md): **`Root` and `Empty`** - [Frequently Asked Questions](https://ziohttp.com/faq.md): If you are new to ZIO, you can start by reading the [ZIO documentation](https://zio.dev/overview/getting-started) to understand the core concepts o...