Introduction to Application Architecture in ZIO
The architecture of a ZIO application is shaped by the programming paradigms ZIO builds on, by the qualities the application must have, and by the patterns we use to structure its code and design its APIs. This section covers each of these in turn, from the paradigm level down to concrete patterns built from ZLayer, ZIOApp, and ZIO Streams.
Pages in This Sectionโ
The section has four pages, ordered from the general to the specific:
- Programming Paradigms in ZIO โ How ZIO combines functional programming for code maintainability with object-oriented programming for code organization, and how it relates to declarative, structured, and aspect-oriented programming through structured concurrency,
Scope,ZIOAspect, andTestAspect. - Non-functional Requirements โ Correctness, testability, maintainability, low latency, high throughput, robustness, resiliency, efficiency, and developer productivity, and the ZIO features that support each one.
- Architectural Patterns โ Onion architecture assembled from
ZLayervalues, streaming architecture with ZIO Streams, the sidecar pattern withZIOApp#<>orZIOApp#bootstrap, and where to draw module boundaries as an application grows. - Functional Design Patterns โ Functional data modeling with algebraic data types, and functional domain modeling with executable and declarative encodings, shown by building a small effect system from scratch.
Where to Go Nextโ
The patterns in this section rely on the following parts of the documentation:
- Writing ZIO Services โ How to define the services that form the layers of an onion architecture.
- Dependency Injection in ZIO โ How to assemble those services into a whole application with
ZLayer. - ZIO Streams โ The streaming data types behind a streaming architecture.
- ZIO Test โ How to write tests as values, with test versions of the standard services such as
TestClockandTestConsole.