@zio.dev/zio-blocks 0.0.33 → 0.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/adr/2026-07-18-data-migration.md +123 -0
  2. package/guides/async-getting-started.md +687 -0
  3. package/guides/compile-time-resource-safety-with-scope.md +21 -16
  4. package/guides/getting-started-with-mux.md +1395 -0
  5. package/guides/query-dsl-extending.md +161 -102
  6. package/guides/query-dsl-fluent-builder.md +217 -157
  7. package/guides/query-dsl-reified-optics.md +12 -10
  8. package/guides/query-dsl-sql.md +640 -165
  9. package/guides/sql-checked-interpolation.md +173 -0
  10. package/guides/sql-transactions.md +286 -0
  11. package/guides/telemetry-guide.md +1130 -0
  12. package/guides/zio-schema-migration.md +29 -22
  13. package/index.md +248 -389
  14. package/package.json +1 -1
  15. package/plans/config-follow-up-prs.md +188 -0
  16. package/plans/config-pr-assessment-roadmap.md +310 -0
  17. package/reference/MuxDataFlow.jsx +250 -0
  18. package/reference/async.md +1499 -0
  19. package/reference/chunk.md +3533 -308
  20. package/reference/codegen/case-class.md +436 -0
  21. package/reference/codegen/emitter-config.md +383 -0
  22. package/reference/codegen/examples.md +664 -0
  23. package/reference/codegen/field.md +316 -0
  24. package/reference/codegen/index.md +317 -0
  25. package/reference/codegen/scala-emitter.md +392 -0
  26. package/reference/codegen/scala-file.md +276 -0
  27. package/reference/codegen/sealed-trait.md +408 -0
  28. package/reference/codegen/type-definition.md +340 -0
  29. package/reference/codegen/type-ref.md +201 -0
  30. package/reference/combinators.md +347 -117
  31. package/reference/config/config-decoder.md +460 -0
  32. package/reference/config/config-source.md +489 -0
  33. package/reference/config/errors.md +278 -0
  34. package/reference/config/flags.md +369 -0
  35. package/reference/config/formats.md +314 -0
  36. package/reference/config/index.md +304 -0
  37. package/reference/config/rollout.md +336 -0
  38. package/reference/context.md +9 -52
  39. package/reference/data-migration.md +269 -0
  40. package/reference/datastar/attributes.md +302 -0
  41. package/reference/datastar/events.md +234 -0
  42. package/reference/datastar/index.md +256 -0
  43. package/reference/datastar/signals.md +230 -0
  44. package/reference/datastar/sse.md +295 -0
  45. package/reference/datastar.md +346 -0
  46. package/reference/docs.md +1461 -345
  47. package/reference/endpoint/auth-type.md +146 -0
  48. package/reference/endpoint/bulk-creation.md +96 -0
  49. package/reference/endpoint/endpoint.md +297 -0
  50. package/reference/endpoint/http-codec.md +249 -0
  51. package/reference/endpoint/index.md +745 -0
  52. package/reference/endpoint/path-codec.md +225 -0
  53. package/reference/endpoint/route-pattern.md +194 -0
  54. package/reference/endpoint/route-tree.md +111 -0
  55. package/reference/endpoint/segment-codec.md +199 -0
  56. package/reference/html.md +1424 -0
  57. package/reference/htmx/attribute-values.md +359 -0
  58. package/reference/htmx/hx-encoding.md +111 -0
  59. package/reference/htmx/hx-params.md +204 -0
  60. package/reference/htmx/hx-swap.md +276 -0
  61. package/reference/htmx/hx-sync.md +251 -0
  62. package/reference/htmx/hx-target.md +314 -0
  63. package/reference/htmx/hx-trigger.md +457 -0
  64. package/reference/htmx/hx-url-update.md +239 -0
  65. package/reference/htmx/index.md +807 -0
  66. package/reference/htmx/response-headers.md +240 -0
  67. package/reference/http-model/headers.md +735 -0
  68. package/reference/http-model/index.md +49 -0
  69. package/reference/http-model/model.md +1517 -0
  70. package/reference/http-model/schema-codecs.md +522 -0
  71. package/reference/http-model/schema.md +750 -0
  72. package/reference/http-model/server-sent-event.md +341 -0
  73. package/reference/jwt.md +195 -0
  74. package/reference/maybe.md +943 -0
  75. package/reference/media-type.md +2 -2
  76. package/reference/mux.md +254 -0
  77. package/reference/mux.mdx +828 -0
  78. package/reference/openapi.md +1351 -0
  79. package/reference/projection.md +654 -0
  80. package/reference/resource-management/defer-handle.md +1 -1
  81. package/reference/resource-management/resource.md +31 -98
  82. package/reference/resource-management/scope.md +28 -220
  83. package/reference/resource-management/wire.md +5 -55
  84. package/reference/ringbuffer/MpmcDiagram.jsx +717 -0
  85. package/reference/ringbuffer/MpscDiagram.jsx +618 -0
  86. package/reference/ringbuffer/SpmcDiagram.jsx +680 -0
  87. package/reference/ringbuffer/SpscDiagram.jsx +677 -0
  88. package/reference/ringbuffer/advanced.mdx +109 -0
  89. package/reference/ringbuffer/index.mdx +145 -0
  90. package/reference/ringbuffer/mpmc.mdx +185 -0
  91. package/reference/ringbuffer/mpsc.mdx +164 -0
  92. package/reference/ringbuffer/spmc.mdx +108 -0
  93. package/reference/ringbuffer/spsc.mdx +416 -0
  94. package/reference/{allows.md → schema/allows.md} +4 -100
  95. package/reference/{binding-resolver.md → schema/binding-resolver.md} +1 -1
  96. package/reference/{binding.md → schema/binding.md} +3 -4
  97. package/reference/schema/built-in-codecs/avro.md +451 -0
  98. package/reference/schema/built-in-codecs/bson.md +510 -0
  99. package/reference/schema/built-in-codecs/csv.md +564 -0
  100. package/reference/schema/built-in-codecs/index.md +77 -0
  101. package/reference/schema/built-in-codecs/json/index.md +295 -0
  102. package/reference/schema/built-in-codecs/json/json-config.md +217 -0
  103. package/reference/{json-patch.md → schema/built-in-codecs/json/json-patch.md} +5 -5
  104. package/reference/{json-schema.md → schema/built-in-codecs/json/json-schema.md} +14 -47
  105. package/reference/schema/built-in-codecs/json/json-selection.md +322 -0
  106. package/reference/{json.md → schema/built-in-codecs/json/json.md} +32 -64
  107. package/reference/schema/built-in-codecs/messagepack.md +508 -0
  108. package/reference/schema/built-in-codecs/thrift.md +433 -0
  109. package/reference/schema/built-in-codecs/toon.md +1078 -0
  110. package/reference/{xml.md → schema/built-in-codecs/xml.md} +13 -9
  111. package/reference/schema/built-in-codecs/yaml.md +552 -0
  112. package/reference/{codec.md → schema/codec.md} +11 -11
  113. package/reference/{dynamic-optic.md → schema/dynamic-optic.md} +196 -5
  114. package/reference/{dynamic-schema.md → schema/dynamic-schema.md} +8 -8
  115. package/reference/schema/format.md +92 -0
  116. package/reference/schema/index.md +52 -0
  117. package/reference/schema/migration.md +297 -0
  118. package/reference/{modifier.md → schema/modifier.md} +58 -7
  119. package/reference/{optics.md → schema/optics.md} +2 -2
  120. package/reference/{patch.md → schema/patch.md} +1 -1
  121. package/{path-interpolator.md → reference/schema/path-interpolator.md} +167 -72
  122. package/reference/schema/reflect-transformer.md +140 -0
  123. package/reference/{schema-evolution → schema/schema-evolution}/as.md +8 -8
  124. package/reference/{schema-evolution → schema/schema-evolution}/index.md +2 -2
  125. package/reference/{schema-evolution → schema/schema-evolution}/into.md +8 -8
  126. package/reference/{schema-expr.md → schema/schema-expr.md} +110 -175
  127. package/reference/schema/schema-search.md +263 -0
  128. package/reference/{schema.md → schema/schema.md} +22 -2
  129. package/reference/{structural-types.md → schema/structural-types.md} +1 -1
  130. package/reference/{type-class-derivation.md → schema/type-class-derivation.md} +63 -1
  131. package/reference/smithy.md +1032 -0
  132. package/reference/sql/db-codec-deriver.md +71 -0
  133. package/reference/sql/db-codec.md +687 -0
  134. package/reference/sql/db-con.md +271 -0
  135. package/reference/sql/db-connection.md +153 -0
  136. package/reference/sql/db-param-writer.md +77 -0
  137. package/reference/sql/db-param.md +66 -0
  138. package/reference/sql/db-result-reader.md +148 -0
  139. package/reference/sql/db-tx.md +114 -0
  140. package/reference/sql/db-value.md +41 -0
  141. package/reference/sql/ddl.md +85 -0
  142. package/reference/sql/frag.md +288 -0
  143. package/reference/sql/index.md +341 -0
  144. package/reference/sql/repo.md +600 -0
  145. package/reference/sql/sql-dialect.md +73 -0
  146. package/reference/sql/sql-logger.md +62 -0
  147. package/reference/sql/sql-name-mapper.md +70 -0
  148. package/reference/sql/table-metadata.md +134 -0
  149. package/reference/sql/table.md +448 -0
  150. package/reference/sql/transactor-zio.md +399 -0
  151. package/reference/sql/transactor.md +363 -0
  152. package/reference/sql-zio.md +112 -0
  153. package/reference/streams/core/index.md +32 -0
  154. package/reference/streams/core/pipeline.md +854 -0
  155. package/reference/streams/core/sink.md +1404 -0
  156. package/reference/streams/core/stream.md +3236 -0
  157. package/reference/streams/execution-and-compatibility/async-execution.md +822 -0
  158. package/reference/streams/execution-and-compatibility/index.md +35 -0
  159. package/reference/streams/execution-and-compatibility/platform-differences.md +297 -0
  160. package/reference/streams/execution-and-compatibility/scala-2-compatibility.md +88 -0
  161. package/reference/streams/execution-and-compatibility/zero-boxing.md +393 -0
  162. package/reference/streams/index.md +726 -0
  163. package/reference/streams/primitives/index.md +30 -0
  164. package/reference/streams/primitives/reader.md +1992 -0
  165. package/reference/streams/primitives/writer.md +1201 -0
  166. package/reference/telemetry/common/any-value.md +90 -0
  167. package/reference/telemetry/common/attribute-key.md +87 -0
  168. package/reference/telemetry/common/attributes.md +118 -0
  169. package/reference/telemetry/common/index.md +39 -0
  170. package/reference/telemetry/common/instrumentation-scope.md +24 -0
  171. package/reference/telemetry/common/resource.md +34 -0
  172. package/reference/telemetry/index.md +311 -0
  173. package/reference/telemetry/logging/index.md +197 -0
  174. package/reference/telemetry/logging/log-enrichment.md +72 -0
  175. package/reference/telemetry/logging/log-formatter.md +100 -0
  176. package/reference/telemetry/logging/log-record-processor.md +56 -0
  177. package/reference/telemetry/logging/log-record.md +44 -0
  178. package/reference/telemetry/logging/log-writer.md +64 -0
  179. package/reference/telemetry/logging/logger-provider.md +142 -0
  180. package/reference/telemetry/logging/logger.md +83 -0
  181. package/reference/telemetry/logging/severity.md +62 -0
  182. package/reference/telemetry/metrics/index.md +150 -0
  183. package/reference/telemetry/metrics/instruments.md +183 -0
  184. package/reference/telemetry/metrics/labeled-instruments.md +74 -0
  185. package/reference/telemetry/metrics/meter-provider.md +76 -0
  186. package/reference/telemetry/metrics/meter.md +98 -0
  187. package/reference/telemetry/metrics/metric-data.md +57 -0
  188. package/reference/telemetry/otel/custom-exporter.md +216 -0
  189. package/reference/telemetry/otel/index.md +212 -0
  190. package/reference/telemetry/tracing/index.md +155 -0
  191. package/reference/telemetry/tracing/sampler.md +89 -0
  192. package/reference/telemetry/tracing/span-builder.md +57 -0
  193. package/reference/telemetry/tracing/span-context.md +39 -0
  194. package/reference/telemetry/tracing/span-data.md +32 -0
  195. package/reference/telemetry/tracing/span-kind.md +55 -0
  196. package/reference/telemetry/tracing/span-processor.md +53 -0
  197. package/reference/telemetry/tracing/span-status.md +47 -0
  198. package/reference/telemetry/tracing/span.md +117 -0
  199. package/reference/telemetry/tracing/tracer-provider.md +91 -0
  200. package/reference/telemetry/tracing/tracer.md +52 -0
  201. package/reference/typeid.md +5 -83
  202. package/sidebars.js +376 -43
  203. package/undocumented-report.md +528 -270
  204. package/reference/formats.md +0 -694
  205. package/reference/http-model.md +0 -1716
  206. package/reference/streams.md +0 -989
  207. package/ringbuffer.md +0 -249
  208. /package/reference/{json-differ.md → schema/built-in-codecs/json/json-differ.md} +0 -0
  209. /package/reference/{dynamic-value.md → schema/dynamic-value.md} +0 -0
  210. /package/reference/{lazy.md → schema/lazy.md} +0 -0
  211. /package/reference/{reflect.md → schema/reflect.md} +0 -0
  212. /package/reference/{registers.md → schema/registers.md} +0 -0
  213. /package/reference/{schema-error.md → schema/schema-error.md} +0 -0
  214. /package/reference/{syntax.md → schema/syntax.md} +0 -0
  215. /package/reference/{validation.md → schema/validation.md} +0 -0
package/index.md CHANGED
@@ -3,38 +3,141 @@ id: index
3
3
  title: "ZIO Blocks"
4
4
  ---
5
5
 
6
- **Modular, zero-dependency building blocks for modern Scala applications.**
6
+ **Modular building blocks for modern Scala applications—no effect system required.**
7
7
 
8
- [![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-blocks/workflows/CI/badge.svg) [![ZIO Blocks](https://img.shields.io/github/stars/zio/zio-blocks?style=social)](https://github.com/zio/zio-blocks)
8
+ [![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-blocks/workflows/CI/badge.svg) [![Maven Central](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Fdev%2Fzio%2Fzio-blocks-config_3%2Fmaven-metadata.xml&label=Maven%20Central)](https://central.sonatype.com/artifact/dev.zio/zio-blocks-config_3) [![Sonatype Snapshot](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fdev%2Fzio%2Fzio-blocks-config_3%2Fmaven-metadata.xml&label=Sonatype%20Snapshot)](https://central.sonatype.com/repository/maven-snapshots/dev/zio/zio-blocks-config_3/) [![ZIO Blocks](https://img.shields.io/github/stars/zio/zio-blocks?style=social)](https://github.com/zio/zio-blocks)
9
9
 
10
10
  ## What Is ZIO Blocks?
11
11
 
12
12
  ZIO Blocks is a **family of type-safe, modular building blocks** for Scala applications. Each block is a standalone library with zero or minimal dependencies, designed to work with *any* Scala stack—ZIO, Cats Effect, Kyo, Ox, Akka, or plain Scala.
13
13
 
14
- The philosophy is simple: **use what you need, nothing more**. Each block is independently useful, cross-platform (JVM, JS), and designed to compose with other blocks or your existing code.
14
+ The philosophy is simple: **use what you need, nothing more**. Each block is independently useful and designed to compose with other blocks or your existing code.
15
15
 
16
- ## The Blocks
16
+ ## Core Principles
17
17
 
18
- | Block | Description | Status |
19
- |-------|-------------|--------|
20
- | **Schema** | Type-safe schemas with automatic codec derivation | ✅ Available |
21
- | **Chunk** | High-performance immutable indexed sequences | ✅ Available |
22
- | **Scope** | Compile-time safe resource management and DI | ✅ Available |
23
- | **Docs** | GitHub Flavored Markdown parsing and rendering | ✅ Available |
24
- | **TypeId** | Compile-time type identity with rich metadata | ✅ Available |
25
- | **Context** | Type-indexed heterogeneous collections | ✅ Available |
26
- | **MediaType** | Type-safe IANA media types with 2,600+ predefined types | ✅ Available |
27
- | **Ring Buffer** | High-performance bounded ring buffers (SPSC, MPSC, SPMC, MPMC) | ✅ Available |
28
- | **Streams** | Pull-based streaming primitives | 🚧 In Development |
18
+ - **Zero Lock-In**: No dependency on ZIO, Cats Effect, or any other effect system. Use a block with whatever stack you already have.
19
+ - **Modular**: Each block is a separate artifact. Depend on exactly what you need.
20
+ - **Cross-Platform**: Most blocks cross-build for JVM and Scala.js, and for Scala 2.13 and 3.x with source compatibility—adopt Scala 3 on your timeline, not ours. The catalog below records the exceptions per block.
21
+ - **High Performance**: Implementations that avoid boxing, minimize allocations, and use platform-specific features where they pay off.
22
+ - **Type Safety**: Scala's type system carries the correctness guarantees, without runtime overhead.
29
23
 
30
- ## Core Principles
24
+ ## Getting Started
25
+
26
+ Add a block and use it. Nothing else to wire up—no runtime to install, no effect
27
+ type to adopt:
28
+
29
+ ```scala
30
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.55"
31
+ ```
32
+
33
+ ```scala
34
+ import zio.blocks.schema._
35
+
36
+ case class Person(name: String, age: Int)
37
+
38
+ object Person {
39
+ implicit val schema: Schema[Person] = Schema.derived
40
+ }
41
+
42
+ val alice = Person("Alice", 30)
43
+
44
+ // One schema, every format
45
+ val jsonStr = alice.toJsonString // {"name":"Alice","age":30}
46
+ val parsed = """{"name":"Bob","age":25}""".fromJson[Person]
47
+ ```
31
48
 
32
- - **Zero Lock-In**: No dependencies on ZIO, Cats Effect, or any effect system. Use with whatever stack you prefer.
33
- - **Modular**: Each block is a separate artifact. Import only what you need.
34
- - **Cross-Platform**: Full support for JVM and Scala.js.
35
- - **Cross-Version**: Full support for Scala 2.13 and Scala 3.x with source compatibility—adopt Scala 3 on your timeline, not ours.
36
- - **High Performance**: Optimized implementations that avoid boxing, minimize allocations, and leverage platform-specific features.
37
- - **Type Safety**: Leverage Scala's type system for correctness without runtime overhead.
49
+ The four blocks below get a full walkthrough because they have no close
50
+ equivalent elsewhere in Scala. Every other block is one row away in the catalog,
51
+ and each row links to its own reference page.
52
+
53
+ ## All Blocks
54
+
55
+ Every block is published under the `dev.zio` organization. Most cross-build for
56
+ **Scala 2.13 and 3.x** on both **JVM and Scala.js** with full source compatibility —
57
+ adopt Scala 3 on your timeline, not ours. The handful of modules that are narrower
58
+ say so in their own row.
59
+
60
+ ### Schema & Serialization
61
+
62
+ JSON support is built into `zio-blocks-schema`; the modules below add further formats.
63
+
64
+ | Block | Artifact | Platform | Scala | Description |
65
+ |-------|----------|----------|-------|-------------|
66
+ | [Schema](./reference/schema/index.md) | `zio-blocks-schema` | JVM · JS | 2.13 · 3.x | Type-safe schemas with automatic codec, optic, and validator derivation |
67
+ | [Avro Codec](./reference/schema/built-in-codecs/avro.md) | `zio-blocks-schema-avro` | JVM | 2.13 · 3.x | Apache Avro binary serialization with automatic schema generation |
68
+ | [BSON Codec](./reference/schema/built-in-codecs/bson.md) | `zio-blocks-schema-bson` | JVM | 2.13 · 3.x | MongoDB-compatible BSON serialization with native type support |
69
+ | [CSV Codec](./reference/schema/built-in-codecs/csv.md) | `zio-blocks-schema-csv` | JVM · JS | 2.13 · 3.x | RFC 4180-compliant CSV serialization |
70
+ | [MessagePack Codec](./reference/schema/built-in-codecs/messagepack.md) | `zio-blocks-schema-messagepack` | JVM · JS | 2.13 · 3.x | Compact binary serialization with optimized streaming |
71
+ | [Thrift Codec](./reference/schema/built-in-codecs/thrift.md) | `zio-blocks-schema-thrift` | JVM | 2.13 · 3.x | Apache Thrift binary serialization with TBinaryProtocol |
72
+ | [TOON Codec](./reference/schema/built-in-codecs/toon.md) | `zio-blocks-schema-toon` | JVM · JS | 2.13 · 3.x | Token-oriented notation 30–60% smaller than JSON, tuned for LLM prompts |
73
+ | [XML Codec](./reference/schema/built-in-codecs/xml.md) | `zio-blocks-schema-xml` | JVM · JS | 2.13 · 3.x | Zero-dependency XML serialization with fluent navigation and patching |
74
+ | [YAML Codec](./reference/schema/built-in-codecs/yaml.md) | `zio-blocks-schema-yaml` | JVM · JS | 2.13 · 3.x | Human-readable YAML serialization with JSON interop |
75
+
76
+ ### Core Data Types
77
+
78
+ | Block | Artifact | Platform | Scala | Description |
79
+ |-------|----------|----------|-------|-------------|
80
+ | [Chunk](./reference/chunk.md) | `zio-blocks-chunk` | JVM · JS | 2.13 · 3.x | High-performance immutable indexed sequences with zero-boxing builders |
81
+ | [Maybe](./reference/maybe.md) | `zio-blocks-maybe` | JVM · JS | 2.13 · 3.x | Low-allocation optional values backed by `null` |
82
+ | [Combinators](./reference/combinators.md) | `zio-blocks-combinators` | JVM · JS | 2.13 · 3.x | Compile-time composition and decomposition of tuples, eithers, and unions |
83
+ | [TypeId](./reference/typeid.md) | `zio-blocks-typeid` | JVM · JS | 2.13 · 3.x | Compile-time type identity with rich metadata |
84
+ | [Context](./reference/context.md) | `zio-blocks-context` | JVM · JS | 2.13 · 3.x | Type-indexed heterogeneous collections |
85
+ | [MediaType](./reference/media-type.md) | `zio-blocks-mediatype` | JVM · JS | 2.13 · 3.x | Type-safe IANA media types with 2,600+ predefined types |
86
+
87
+ ### Concurrency & Streaming
88
+
89
+ | Block | Artifact | Platform | Scala | Description |
90
+ |-------|----------|----------|-------|-------------|
91
+ | [Async](./reference/async.md) | `zio-blocks-async` | JVM · JS | 2.13 · 3.x | Zero-allocation asynchronous effect type with direct-style `await` |
92
+ | [Streams](./reference/streams/index.md) | `zio-blocks-streams` | JVM · JS | 2.13 · 3.x | Pull-based streaming with typed errors, zero boxing, and synchronous or asynchronous execution |
93
+ | [Ring Buffer](./reference/ringbuffer/index.mdx) | `zio-blocks-ringbuffer` | JVM · JS | 2.13 · 3.x | Lock-free bounded ring buffers (SPSC, SPMC, MPSC, MPMC) |
94
+ | [Mux](./reference/mux.mdx) | `zio-blocks-mux` | JVM · JS | 2.13 · 3.x | Thread-safe multiplexer for HTTP/2, QUIC, and WebSocket-style protocols |
95
+
96
+ ### Resources & Configuration
97
+
98
+ | Block | Artifact | Platform | Scala | Description |
99
+ |-------|----------|----------|-------|-------------|
100
+ | [Scope](./reference/resource-management/index.md) | `zio-blocks-scope` | JVM · JS | 2.13 · 3.x | Compile-time safe resource management and dependency injection |
101
+ | [Config](./reference/config/index.md) | `zio-blocks-config` | JVM · JS | 2.13 · 3.x | Typed configuration loading, feature flags, and rollout rules |
102
+ | [Config YAML](./reference/config/formats.md) | `zio-blocks-config-yaml` | JVM · JS | 2.13 · 3.x | YAML source adapter for `ConfigSource` |
103
+ | [Config JSON](./reference/config/formats.md) | `zio-blocks-config-json` | JVM · JS | 2.13 · 3.x | JSON source adapter for `ConfigSource` |
104
+ | [Config HOCON](./reference/config/formats.md) | `zio-blocks-config-hocon` | JVM · JS | 2.13 · 3.x | HOCON source adapter for `ConfigSource` |
105
+
106
+ ### Web & HTTP
107
+
108
+ | Block | Artifact | Platform | Scala | Description |
109
+ |-------|----------|----------|-------|-------------|
110
+ | [HTTP Model](./reference/http-model/index.md) | `zio-blocks-http-model` | JVM · JS | 2.13 · 3.x | Pure HTTP data model with URL parsing, headers, cookies, and forms |
111
+ | [HTTP Model Schema](./reference/http-model/schema.md) | `zio-blocks-http-model-schema` | JVM · JS | 2.13 · 3.x | Schema-based typed access to the HTTP model |
112
+ | [Endpoint](./reference/endpoint/index.md) | `zio-blocks-endpoint` | JVM · JS | 2.13 · 3.x | Type-safe HTTP endpoint descriptors with composable codecs and typed auth |
113
+ | [HTML](./reference/html.md) | `zio-blocks-html` | JVM · JS | 2.13 · 3.x | Type-safe HTML templating with XSS protection |
114
+ | [HTMX](./reference/htmx/index.md) | `zio-blocks-http-htmx` | JVM · JS | 3.x | Typed HTMX DSL for compile-time-checked HTMX attributes |
115
+ | [Datastar](./reference/datastar/index.md) | `zio-blocks-datastar` | JVM · JS | 3.x | Typed Datastar attribute and signal DSL, plus the SSE events that patch a live page |
116
+ | [OpenAPI](./reference/openapi.md) | `zio-blocks-openapi` | JVM · JS | 2.13 · 3.x | Type-safe OpenAPI 3.1 specification generation and rendering |
117
+ | [JWT](./reference/jwt.md) | `zio-blocks-jwt` | JVM · JS | 2.13 · 3.x | Zero-dependency JWT signing and verification with HMAC, RSA, ECDSA and EdDSA support |
118
+
119
+ ### Persistence
120
+
121
+ | Block | Artifact | Platform | Scala | Description |
122
+ |-------|----------|----------|-------|-------------|
123
+ | [SQL](./reference/sql/index.md) | `zio-blocks-sql` | JVM · JS | 3.x | Type-safe JDBC wrapper with schema-derived codecs and a CRUD repository |
124
+ | [SQL — ZIO](./reference/sql-zio.md) | `zio-blocks-sql-zio` | JVM | 3.x | ZIO integration with `ZIO.attemptBlocking` and `ZLayer` |
125
+ | [Projection](./reference/projection.md) | `zio-blocks-projection` | JVM | 3.x | Event-sourced projections with per-entity SQLite storage |
126
+
127
+ ### Observability
128
+
129
+ | Block | Artifact | Platform | Scala | Description |
130
+ |-------|----------|----------|-------|-------------|
131
+ | [Telemetry](./reference/telemetry/index.md) | `zio-blocks-telemetry` | JVM · JS | 2.13 · 3.x | Zero-dependency OpenTelemetry-aligned tracing, logging, and metrics |
132
+ | [OTLP Export](./reference/telemetry/otel/index.md) | `zio-blocks-telemetry-otel` | JVM | 2.13 · 3.x | OTLP exporters bridging telemetry signals to an OpenTelemetry collector |
133
+
134
+ ### Tooling & Codegen
135
+
136
+ | Block | Artifact | Platform | Scala | Description |
137
+ |-------|----------|----------|-------|-------------|
138
+ | [Codegen](./reference/codegen/index.md) | `zio-blocks-codegen` | JVM | 2.13 · 3.x | Generic Scala code generation IR and emitter |
139
+ | [Docs](./reference/docs.md) | `zio-blocks-markdown` | JVM · JS | 2.13 · 3.x | GitHub Flavored Markdown parsing, rendering, and programmatic construction |
140
+ | [Smithy](./reference/smithy.md) | `zio-blocks-smithy` | JVM | 2.13 · 3.x | Smithy IDL parser and AST library for API modeling |
38
141
 
39
142
  ---
40
143
 
@@ -74,7 +177,7 @@ val thriftCodec = Schema[Person].derive(ThriftFormat) // Thrift
74
177
 
75
178
  ### Key Features
76
179
 
77
- - **Universal Data Formats**: JSON, Avro, TOON (compact LLM-optimized format), MessagePack, Thrift, and BSON, with Protobuf planned.
180
+ - **Universal Data Formats**: JSON built in, plus Avro, BSON, CSV, MessagePack, Thrift, TOON, XML, and YAML as separate modules, with Protobuf planned.
78
181
  - **High Performance**: Register-based design stores primitives directly in byte arrays, enabling zero-allocation serialization.
79
182
  - **Reflective Optics**: Type-safe lenses, prisms, and traversals with embedded structural metadata.
80
183
  - **Automatic Derivation**: Derive type class instances for any type with a schema.
@@ -82,17 +185,12 @@ val thriftCodec = Schema[Person].derive(ThriftFormat) // Thrift
82
185
  ### Installation
83
186
 
84
187
  ```scala
85
- libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.33"
86
-
87
- // Optional format modules:
88
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.33"
89
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.33"
90
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.33"
91
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.33"
92
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.33"
188
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.55"
93
189
  ```
94
190
 
95
- ### Example: Optics
191
+ See the [Schema & Serialization](#schema--serialization) rows above for the optional format modules.
192
+
193
+ ### Example
96
194
 
97
195
  ```scala
98
196
  import zio.blocks.schema._
@@ -112,64 +210,10 @@ val person = Person("Alice", 30, Address("123 Main St", "Springfield"))
112
210
  val updated = Person.age.replace(person, 31)
113
211
  ```
114
212
 
115
- ---
116
-
117
- ## Chunk
118
-
119
- A high-performance, immutable indexed sequence optimized for the patterns common in streaming, parsing, and data processing. Think of it as `Vector` but faster for the operations that matter most.
120
-
121
- ### Why Chunk?
122
-
123
- Standard library collections make trade-offs that aren't ideal for streaming and binary data processing:
124
-
125
- - `Vector` is general-purpose but not optimized for concatenation patterns
126
- - `Array` is mutable and boxes primitives when used generically
127
- - `List` has O(n) random access
128
-
129
- Chunk is designed for:
130
-
131
- - **Fast concatenation** via balanced trees (Conc-Trees)
132
- - **Zero-boxing** for primitive types with specialized builders
133
- - **Efficient slicing** without copying
134
- - **Seamless interop** with `ByteBuffer`, `Array`, and standard collections
135
-
136
- ### Key Features
137
-
138
- - **Specialized Builders**: Dedicated builders for `Byte`, `Int`, `Long`, `Double`, etc. avoid boxing overhead.
139
- - **Balanced Concatenation**: Based on Conc-Trees for O(log n) concatenation while maintaining O(1) indexed access.
140
- - **Bit Operations**: First-class support for bit-level operations, bit chunks backed by `Byte`, `Int`, or `Long` arrays.
141
- - **NonEmptyChunk**: A statically-guaranteed non-empty variant for APIs that require at least one element.
142
- - **Full Scala Collection Integration**: Implements `IndexedSeq` for seamless interop.
143
-
144
- ### Installation
145
-
146
- ```scala
147
- libraryDependencies += "dev.zio" %% "zio-blocks-chunk" % "0.0.33"
148
- ```
149
-
150
- ### Example
151
-
152
- ```scala
153
- import zio.blocks.chunk._
154
-
155
- // Create chunks
156
- val bytes = Chunk[Byte](1, 2, 3, 4, 5)
157
- val moreBytes = Chunk.fromArray(Array[Byte](6, 7, 8))
158
-
159
- // Efficient concatenation (O(log n))
160
- val combined = bytes ++ moreBytes
161
-
162
- // Zero-copy slicing
163
- val slice = combined.slice(2, 6)
164
-
165
- // Bit operations
166
- val bits = bytes.asBitsByte
167
- val masked = bits & Chunk.fill(bits.length)(true)
213
+ ### Learn More
168
214
 
169
- // NonEmptyChunk for type-safe non-emptiness
170
- val nonEmpty = NonEmptyChunk(1, 2, 3)
171
- val head: Int = nonEmpty.head // Always safe, no Option needed
172
- ```
215
+ - [Schema reference](./reference/schema/index.md) — the full API surface, from `Reflect` and `Binding` through optics, validation, and schema evolution
216
+ - [Migrating from ZIO Schema](./guides/zio-schema-migration.md) — a step-by-step port from ZIO Schema 1.x
173
217
 
174
218
  ---
175
219
 
@@ -233,10 +277,10 @@ Scope.global.scoped { scope =>
233
277
  ### Installation
234
278
 
235
279
  ```scala
236
- libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.33"
280
+ libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.55"
237
281
  ```
238
282
 
239
- ### Example: Basic Resource Management
283
+ ### Example
240
284
 
241
285
  ```scala
242
286
  import zio.blocks.scope.*
@@ -260,298 +304,150 @@ Scope.global.scoped { scope =>
260
304
  // Database closed
261
305
  ```
262
306
 
263
- ### Example: Dependency Injection
264
-
265
- ```scala
266
- import zio.blocks.scope.*
307
+ ### Learn More
267
308
 
268
- case class Config(dbUrl: String)
269
- class Database(config: Config) extends AutoCloseable { ... }
270
- class UserRepo(db: Database) { ... }
271
- class UserService(repo: UserRepo) extends AutoCloseable { ... }
272
-
273
- // Resource.from auto-wires the dependency graph
274
- // Only provide leaf values - concrete classes are auto-wired
275
- val serviceResource: Resource[UserService] = Resource.from[UserService](
276
- Wire(Config("jdbc:postgresql://localhost/mydb"))
277
- )
278
-
279
- Scope.global.scoped { scope =>
280
- import scope.*
281
-
282
- val service = allocate(serviceResource)
283
-
284
- $(service)(_.createUser("Alice"))
285
- }
286
- // Cleanup runs LIFO: UserService → Database (UserRepo has no cleanup)
287
- ```
288
-
289
- ### Example: Nested Scopes with Transactions
290
-
291
- ```scala
292
- Scope.global.scoped { connScope =>
293
- import connScope.*
294
-
295
- val conn = allocate(Resource.fromAutoCloseable(new Connection))
296
-
297
- // Transaction lives in child scope - cleaned up before connection
298
- val result: String = scoped { txScope =>
299
- import txScope.*
300
- val c = lower(conn)
301
- val tx = $(c)(_.beginTransaction()).allocate
302
- $(tx)(_.execute("INSERT INTO users VALUES (1, 'Alice')"))
303
- $(tx)(_.commit())
304
- "success"
305
- }
306
- // Transaction closed here, connection still open
307
-
308
- println(result)
309
- }
310
- // Connection closed here
311
- ```
312
-
313
- ### Getting Started
314
-
315
- New to Scope? Check out the [Scope Tutorial](./guides/compile-time-resource-safety-with-scope.md) for a comprehensive step-by-step guide that walks you through the concepts, patterns, and real-world examples. The tutorial is designed for newcomers and covers everything from basic resource management to advanced dependency injection.
316
-
317
- For detailed API documentation, see the [Scope Reference](./reference/resource-management/scope.md).
309
+ - [Compile-Time Resource Safety with Scope](./guides/compile-time-resource-safety-with-scope.md) — the step-by-step tutorial, from basic resource management through dependency injection
310
+ - [Resource Management & DI reference](./reference/resource-management/index.md) — `Scope`, `Resource`, `Wire`, `Unscoped`, and finalization order
318
311
 
319
312
  ---
320
313
 
321
- ## Docs
322
-
323
- A zero-dependency GitHub Flavored Markdown library for parsing, rendering, and programmatic construction of Markdown documents.
324
-
325
- ### Why Docs?
314
+ ## Async
326
315
 
327
- Generating documentation, README files, or any Markdown content programmatically is common but error-prone with string concatenation. Docs provides:
316
+ A lightweight, zero-dependency asynchronous effect type. A ready `Async[A]` *is*
317
+ an `A`, so synchronous code composed with `map` / `flatMap` allocates nothing on
318
+ the happy path while still suspending on genuinely asynchronous work.
328
319
 
329
- - **Type-safe AST**: Build Markdown documents with compile-time guarantees
330
- - **Compile-time validation**: The `md"..."` interpolator validates syntax at compile time
331
- - **Multiple renderers**: Output to Markdown, HTML, or ANSI terminal
332
- - **Round-trip parsing**: Parse Markdown to AST and render back to Markdown
333
-
334
- ### Key Features
335
-
336
- - **GFM Compliant**: Tables, strikethrough, autolinks, task lists, fenced code blocks
337
- - **Zero Dependencies**: Only depends on zio-blocks-chunk
338
- - **Cross-Platform**: Full support for JVM and Scala.js
339
- - **Type-Safe Interpolator**: `md"# Hello $name"` with compile-time validation
340
- - **Multiple Renderers**: Markdown, HTML (full document or fragment), ANSI terminal
320
+ ### The Problem
341
321
 
342
- ### Installation
322
+ Asynchronous Scala forces a choice between two costs. `Future` allocates for
323
+ every combinator and needs an `ExecutionContext` threaded everywhere, even when
324
+ the value is already available. Full effect systems avoid that but ask you to
325
+ adopt a runtime, a set of type classes, and a programming model across your
326
+ whole codebase—a heavy price for a library that only occasionally suspends.
343
327
 
344
- ```scala
345
- libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.33"
346
- ```
328
+ ### The Solution
347
329
 
348
- ### Example
330
+ `Async[A]` is a value, not a wrapper. When the result is already known, the
331
+ representation *is* the result, so composing ready values costs nothing:
349
332
 
350
333
  ```scala
351
- import zio.blocks.docs._
334
+ import zio.blocks.async._
352
335
 
353
- // Parse Markdown
354
- val doc = Parser.parse("# Hello\n\nThis is **bold** text.")
355
- // Right(Doc(Chunk(Heading(H1, "Hello"), Paragraph(...))))
356
-
357
- // Render to HTML
358
- val html = doc.map(_.toHtml)
359
- // Full HTML5 document with <html>, <head>, <body>
360
-
361
- // Render to HTML fragment (just the content)
362
- val fragment = doc.map(_.toHtmlFragment)
363
- // "<h1>Hello</h1><p>This is <strong>bold</strong> text.</p>"
364
-
365
- // Render to terminal with ANSI colors
366
- val terminal = doc.map(_.toTerminal)
367
-
368
- // Use the type-safe interpolator
369
- val name = "World"
370
- val greeting = md"# Hello $name"
371
- // Doc containing: Heading(H1, Chunk(Text("Hello World")))
372
-
373
- // Build documents programmatically
374
- import zio.blocks.chunk.Chunk
375
-
376
- val manual = Doc(Chunk(
377
- Block.Heading(HeadingLevel.H1, Chunk(Inline.Text("API Reference"))),
378
- Block.Paragraph(Chunk(
379
- Inline.Text("See "),
380
- Inline.Link(Chunk(Inline.Text("docs")), "/docs", None),
381
- Inline.Text(" for details.")
382
- ))
383
- ))
384
-
385
- // Render back to Markdown
386
- val markdown = Renderer.render(manual)
336
+ // Constructors collapse to bare values; transformers inline with no allocation
337
+ val computed: Int =
338
+ Async.succeed(20).map(_ + 1).flatMap(n => Async.succeed(n * 2)).block
339
+ // computed: Int = 42
387
340
  ```
388
341
 
389
- ### Supported GFM Features
390
-
391
- | Feature | Supported |
392
- |---------|-----------|
393
- | Headings (ATX) | ✅ |
394
- | Paragraphs | ✅ |
395
- | Emphasis/Strong | ✅ |
396
- | Code (inline & fenced) | ✅ |
397
- | Links & Images | ✅ |
398
- | Lists (bullet, ordered, task) | ✅ |
399
- | Blockquotes | ✅ |
400
- | Tables | ✅ |
401
- | Strikethrough | ✅ |
402
- | Autolinks | ✅ |
403
- | Hard/Soft breaks | ✅ |
404
- | HTML (passthrough) | ✅ |
405
-
406
- ### Limitations
407
-
408
- - **No frontmatter**: YAML/TOML headers are not parsed
409
- - **No HTML entity decoding**: `&amp;` stays as-is
410
- - **No footnotes**: GFM footnote extension not supported
411
- - **No emoji shortcodes**: `:smile:` not converted to emoji
412
-
413
- ---
414
-
415
- ## TypeId
416
-
417
- Compile-time type identity with rich metadata. TypeId captures comprehensive information about Scala types including name, owner, type parameters, variance, parent types, and annotations.
418
-
419
342
  ### Key Features
420
343
 
421
- - **Rich Metadata**: Captures type name, owner, kind (class/trait/object/enum), parent types, and annotations
422
- - **Higher-Kinded Support**: Works with proper types and type constructors via `AnyKind`
423
- - **Subtype Checking**: Runtime subtype/supertype relationship checks using compile-time extracted information
424
- - **Cross-Platform**: Works identically on JVM and Scala.js
344
+ - **Zero Allocation on the Happy Path**: A completed `Async[A]` is represented as the `A` itself; `map` and `flatMap` over ready values allocate nothing.
345
+ - **Direct-Style `await`**: `Async.async { ... }` rewrites `.await` calls at compile time into a non-blocking `flatMap` chain—straight-line code, asynchronous execution.
346
+ - **No Runtime to Adopt**: No `ExecutionContext` to thread, no type class hierarchy, no effect system dependency.
347
+ - **Interop Built In**: Bridges to `Future` and `CompletionStage`, plus `Async.promise` for callback-based APIs.
425
348
 
426
349
  ### Installation
427
350
 
428
351
  ```scala
429
- libraryDependencies += "dev.zio" %% "zio-blocks-typeid" % "0.0.33"
352
+ libraryDependencies += "dev.zio" %% "zio-blocks-async" % "0.0.55"
430
353
  ```
431
354
 
432
355
  ### Example
433
356
 
357
+ Write straight-line asynchronous code with `Async.async` and `.await`, rewritten
358
+ at compile time into a non-blocking `flatMap` chain:
359
+
434
360
  ```scala
435
- import zio.blocks.typeid._
361
+ import zio.blocks.async._
436
362
 
437
- // Get TypeId for any type
438
- val listId = TypeId.of[List[Int]]
439
- println(listId.name) // "List"
440
- println(listId.fullName) // "scala.collection.immutable.List"
441
- println(listId.arity) // 1 (type constructor)
363
+ def fetch(id: Int): Async[String] = Async.succeed(s"item-$id")
442
364
 
443
- // Check type relationships
444
- trait Animal
445
- case class Dog(name: String) extends Animal
365
+ val program: Async[Int] =
366
+ Async.async {
367
+ val a = fetch(1).await
368
+ val b = fetch(2).await
369
+ (a + b).length
370
+ }
371
+ ```
446
372
 
447
- val dogId = TypeId.of[Dog]
448
- val animalId = TypeId.of[Animal]
449
- dogId.isSubtypeOf(animalId) // true
373
+ ### Learn More
450
374
 
451
- // Access structural information
452
- dogId.isCaseClass // true
453
- dogId.isSealed // false
454
- ```
375
+ - [Getting Started with Async](./guides/async-getting-started.md) — create, compose, and run async effects
376
+ - [Async reference](./reference/async.md) — the full API, including `zip`, `catchAll`, `collectAll`, the `Async.promise` callback bridge, and `Future` / `CompletionStage` interop
377
+ - [`async-examples`](https://github.com/zio/zio-blocks/blob/main/async-examples/src/main/scala/async/AsyncShowcaseExample.scala) — a single-file order-fulfillment demo (`sbt "++3.9.0; async-examples/run"`)
455
378
 
456
379
  ---
457
380
 
458
- ## Context
381
+ ## SQL
459
382
 
460
- A type-indexed heterogeneous collection that stores values by their types with compile-time type safety.
383
+ A thin, type-safe JDBC wrapper that maps Scala case classes to database tables using the same `Schema` you use for JSON and Avro codecs. No ORM runtime, no code generation — just composable SQL fragments, a derived repository abstraction, and a direct ZIO integration.
461
384
 
462
- ### Key Features
463
-
464
- - **Type-Safe Lookup**: Retrieve values by type with compile-time guarantees
465
- - **Covariant**: `Context[Specific]` is a subtype of `Context[General]`
466
- - **Subtype Matching**: Lookup by supertype finds matching subtypes
467
- - **Cached Access**: O(1) subsequent lookups after first retrieval
385
+ ### The Problem
468
386
 
469
- ### Installation
387
+ JDBC is powerful but tedious: manual `ResultSet` traversal, index-based parameter binding, and repetitive CRUD boilerplate make even simple database access error-prone. ORMs solve the boilerplate but add heavy runtimes, hidden queries, and opaque magic.
470
388
 
471
- ```scala
472
- libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.33"
473
- ```
389
+ ### The Solution
474
390
 
475
- ### Example
391
+ ZIO Blocks SQL derives everything from a single `Schema[A]`:
476
392
 
477
393
  ```scala
478
- import zio.blocks.context._
479
-
480
- case class Config(debug: Boolean)
481
- case class Metrics(count: Int)
394
+ case class User(id: Long, name: String, email: String)
395
+ object User:
396
+ given Schema[User] = Schema.derived
482
397
 
483
- // Create a context with multiple values
484
- val ctx: Context[Config & Metrics] = Context(
485
- Config(debug = true),
486
- Metrics(count = 42)
487
- )
398
+ // Derive the table, codec, and repository in one line
399
+ val repo = Repo.derived[User, Long]
488
400
 
489
- // Retrieve values by type
490
- val config: Config = ctx.get[Config]
491
- val metrics: Metrics = ctx.get[Metrics]
492
-
493
- // Add or update values
494
- val updated = ctx.update[Metrics](m => m.copy(count = m.count + 1))
495
-
496
- // Combine contexts
497
- val ctx1 = Context(Config(false))
498
- val ctx2 = Context(Metrics(0))
499
- val merged: Context[Config & Metrics] = ctx1 ++ ctx2
401
+ // Use the sql"..." interpolator for custom queries
402
+ val frag = sql"SELECT * FROM user WHERE email = ${"alice@example.com"}"
500
403
  ```
501
404
 
502
- ---
503
-
504
- ## Ring Buffer
505
-
506
- High-performance, bounded ring buffers for inter-thread communication. Four lock-free variants cover every producer/consumer pattern (SPSC, MPSC, SPMC, MPMC).
507
-
508
- ### Why Ring Buffer?
509
-
510
- Standard `java.util.concurrent` queues use node allocation (`ConcurrentLinkedQueue`) or coarse locking (`ArrayBlockingQueue`). Ring buffers avoid both:
511
-
512
- - **Zero allocation** on the hot path—pre-allocated circular array
513
- - **Lock-free** on the fast path—CAS or release/acquire semantics only
514
- - **Cache-friendly**—sequential memory access with 128-byte padding between producer/consumer fields
515
-
516
405
  ### Key Features
517
406
 
518
- - **Four concurrency patterns**: SPSC, SPMC, MPSC, MPMC—pick the most constrained variant for your use case
519
- - **Cross-platform**: Same API on JVM and Scala.js (JS uses sequential implementations)
407
+ - **Schema-derived codecs**: `DbCodec[A]` is auto-derived from `Schema[A]` — column names, types, and nullability come for free.
408
+ - **Composable fragments**: The `sql"..."` interpolator creates `Frag` values that compose safely with `++`. SQL injection is structurally impossible.
409
+ - **CRUD repository**: `Repo[E, ID]` provides `all`, `find`, `findAll`, `insert`, `insertAll`, `update`, `delete`, `deleteAll`, and `clear` out of the box.
410
+ - **DDL generation**: `Table.createTable(dialect)` generates type-accurate `CREATE TABLE IF NOT EXISTS` SQL from the schema.
411
+ - **ZIO integration**: `TransactorZIO` lifts blocking JDBC calls into `Task` (or `ZIO`) with proper bracketing and rollback.
412
+ - **Effect-system agnostic core**: The `zio-blocks-sql` module has no ZIO dependency — use it with any effect system or plain Scala.
520
413
 
521
414
  ### Installation
522
415
 
523
416
  ```scala
524
- libraryDependencies += "dev.zio" %% "zio-blocks-ringbuffer" % "0.0.33"
417
+ libraryDependencies += "dev.zio" %% "zio-blocks-sql" % "0.0.55"
418
+
419
+ // Optional ZIO integration
420
+ libraryDependencies += "dev.zio" %% "zio-blocks-sql-zio" % "0.0.55"
525
421
  ```
526
422
 
527
423
  ### Example
528
424
 
529
425
  ```scala
530
- import zio.blocks.ringbuffer._
531
-
532
- // SPSC: fastest, for dedicated producer-consumer pairs
533
- val spsc = SpscRingBuffer[String](1024)
534
- spsc.offer("hello") // true
535
- spsc.take() // "hello"
536
-
537
- // MPMC: general-purpose, any number of threads
538
- val mpmc = MpmcRingBuffer[String](1024)
539
- mpmc.offer("hello") // false if full
540
- mpmc.take() // null if empty
426
+ import zio.blocks.schema._
427
+ import zio.blocks.sql._
428
+ import zio.blocks.sql.zio._
429
+
430
+ case class Product(id: Long, name: String, price: Double)
431
+ object Product:
432
+ given Schema[Product] = Schema.derived
433
+ given DbCodec[Product] = summon[Schema[Product]].deriving(DbCodecDeriver).derive
434
+
435
+ val repo = Repo.derived[Product, Long]
436
+ val transactor = TransactorZIO.fromUrl("jdbc:postgresql://localhost/shop", SqlDialect.PostgreSQL)
437
+
438
+ // Batch insert, then query with a custom filter
439
+ val program = transactor.transact:
440
+ repo.insertAll(List(
441
+ Product(1L, "Widget", 9.99),
442
+ Product(2L, "Gadget", 29.99)
443
+ ))
444
+ sql"SELECT * FROM product WHERE price < ${15.0}".query[Product]
541
445
  ```
542
446
 
543
- ---
544
-
545
- ## Streams (In Development)
546
-
547
- A pull-based streaming library for composable, backpressure-aware data processing.
447
+ ### Learn More
548
448
 
549
- ```scala
550
- import zio.blocks.streams._
551
-
552
- // Coming soon: efficient pull-based streams
553
- // that compose with any effect system
554
- ```
449
+ - [SQL reference](./reference/sql/index.md) — `DbCodec`, `Frag`, `Table`, `Repo`, `Transactor`, dialects, and DDL generation
450
+ - [Query DSL guide](./guides/query-dsl-reified-optics.md) — a four-part series building a type-safe query language on reified optics
555
451
 
556
452
  ---
557
453
 
@@ -570,69 +466,32 @@ ZIO Blocks works with any Scala stack:
570
466
 
571
467
  Each block has zero dependencies on effect systems. Use the blocks directly, or integrate them with your effect system of choice.
572
468
 
573
- ## Scala & Platform Support
574
-
575
- ZIO Blocks supports **Scala 2.13** and **Scala 3.x** with full source compatibility. Write your code once and compile it against either version—migrate to Scala 3 when your team is ready, not when your dependencies force you.
576
-
577
- | Platform | Schema | Chunk | Scope | Docs | TypeId | Context | Ring Buffer | Streams |
578
- |----------|--------|-------|-------|------|--------|---------|-------------|---------|
579
- | JVM | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
580
- | Scala.js | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
581
-
582
- ## Documentation
583
-
584
- ### Core Schema Concepts
585
-
586
- - [Schema](./reference/schema.md) - Core schema definitions and derivation
587
- - [Allows](./reference/allows.md) - Compile-time structural grammar constraints
588
- - [Reflect](./reference/reflect.md) - Structural reflection API
589
- - [Binding](./reference/binding.md) - Runtime constructors and deconstructors
590
- - [BindingResolver](./reference/binding-resolver.md) - Binding lookup and schema rebinding
591
- - [Registers](./reference/registers.md) - Register-based primitive storage
592
-
593
- ### Optics & Navigation
594
-
595
- - [Optics](./reference/optics.md) - Lenses, prisms, and traversals
596
- - [SchemaExpr](./reference/schema-expr.md) - Schema-aware expressions for queries and validation
597
- - [Path Interpolator](./path-interpolator.md) - Type-safe path construction
598
- - [DynamicValue](./reference/dynamic-value.md) - Schema-less dynamic values
599
- - [DynamicSchema](./reference/dynamic-schema.md) - Type-erased schemas for validation and cross-process transport
600
-
601
- ### Serialization
602
-
603
- - [Codec & Format](./reference/codec.md) - Codec, Format, BinaryCodec & TextCodec
604
- - [JSON](./reference/json.md) - JSON codec and parsing
605
- - [JsonPatch](./reference/json-patch.md) - Diff and patch JSON values
606
- - [JsonDiffer](./reference/json-differ.md) - Compute minimal diffs between JSON values
607
- - [JSON Schema](./reference/json-schema.md) - JSON Schema generation and validation
608
- - [Formats](./reference/formats.md) - Avro, TOON, MessagePack, BSON, Thrift
609
- - [Extension Syntax](./reference/syntax.md) - `.toJson`, `.fromJson`, and more
610
-
611
- ### Data Operations
612
-
613
- - [Patching](./reference/patch.md) - Serializable data transformations
614
- - [SchemaError](./reference/schema-error.md) - Structured error type for schema operations
615
- - [Validation](./reference/validation.md) - Data validation and error handling
616
- - [Schema Evolution](./reference/schema-evolution/index.md) - One-way and bidirectional type-safe conversions
617
- - [Into](./reference/schema-evolution/into.md) - One-way conversion with validation
618
- - [As](./reference/schema-evolution/as.md) - Bidirectional round-trip conversion
619
-
620
- ### Other Blocks
621
-
622
- - [Chunk](./reference/chunk.md) - High-performance immutable sequences
623
- - [Scope](./reference/resource-management/scope.md) - Compile-time safe resource management and DI
624
- - [Wire](./reference/resource-management/wire.md) - Recipes for constructing services and dependencies
625
- - [TypeId](./reference/typeid.md) - Type identity and metadata
626
- - [Context](./reference/context.md) - Type-indexed heterogeneous collections
627
- - [Docs (Markdown)](./reference/docs.md) - Markdown parsing and rendering
628
- - [MediaType](./reference/media-type.md) - Type-safe IANA media types
629
- - [HTTP Model](./reference/http-model.md) - Pure HTTP data model with URL parsing, headers, cookies, and forms
630
- - [Ring Buffer](./ringbuffer.md) - High-performance bounded ring buffers
631
-
632
- ### Guides
469
+ ## Guides
633
470
 
634
- - [Migrating from ZIO Schema](./guides/zio-schema-migration.md) - Step-by-step guide to migrating from ZIO Schema 1.x to ZIO Blocks Schema
471
+ - [Getting Started with Async](./guides/async-getting-started.md) - Create, compose, and run zero-allocation async effects with the `Async[A]` type
472
+ - [Compile-Time Resource Safety with Scope](./guides/compile-time-resource-safety-with-scope.md) - Resource management and dependency injection, from first principles
473
+ - [Getting Started with Mux](./guides/getting-started-with-mux.md) - Manage multiplexed bidirectional message streams with capacity limits
474
+ - [Telemetry: Architecture, Patterns, and Real-World Usage](./guides/telemetry-guide.md) - Wire tracing, logging, and metrics into a running application
475
+ - [Migrating from ZIO Schema](./guides/zio-schema-migration.md) - Step-by-step migration from ZIO Schema 1.x to ZIO Blocks Schema
635
476
  - [Query DSL Part 1: Expressions](./guides/query-dsl-reified-optics.md) - Build type-safe, composable query expressions
636
477
  - [Query DSL Part 2: SQL Generation](./guides/query-dsl-sql.md) - Translate query expressions into SQL
637
- - [Query DSL Part 3: Extending the Expression Language](./guides/query-dsl-extending.md) - Add custom operators beyond SchemaExpr
638
- - [Query DSL Part 4: A Fluent SQL Builder](./guides/query-dsl-fluent-builder.md) - Build type-safe SELECT, UPDATE, INSERT, DELETE statements
478
+ - [Query DSL Part 3: Extending the Expression Language](./guides/query-dsl-extending.md) - Add custom operators beyond `SchemaExpr`
479
+ - [Query DSL Part 4: A Fluent SQL Builder](./guides/query-dsl-fluent-builder.md) - Build type-safe SELECT, UPDATE, INSERT, and DELETE statements
480
+
481
+ ## Full API Reference
482
+
483
+ Every block in the catalog above links to its own reference page. The blocks
484
+ large enough to have several pages start from an overview:
485
+
486
+ - [Schema](./reference/schema/index.md) - core type system, dynamic values, optics, validation, and schema evolution
487
+ - [Built-in Codecs](./reference/schema/built-in-codecs/index.md) - JSON, Avro, BSON, CSV, MessagePack, Thrift, TOON, XML, and YAML
488
+ - [Schema Evolution](./reference/schema/schema-evolution/index.md) - one-way and bidirectional type-safe conversions
489
+ - [Telemetry](./reference/telemetry/index.md) - tracing, logging, metrics, and OTLP export
490
+ - [SQL](./reference/sql/index.md) - codecs, fragments, tables, repositories, transactors, and dialects
491
+ - [Resource Management & DI](./reference/resource-management/index.md) - `Scope`, `Resource`, `Wire`, `Unscoped`, and finalization
492
+ - [Streams](./reference/streams/index.md) - `Stream`, `Pipeline`, `Sink`, and the low-level readers and writers
493
+ - [Endpoint](./reference/endpoint/index.md) - endpoint descriptors, HTTP codecs, route patterns, and typed auth
494
+ - [HTTP Model](./reference/http-model/index.md) - the pure HTTP data model and its schema-based typed access
495
+ - [HTMX](./reference/htmx/index.md) - the typed HTMX attribute DSL
496
+ - [Ring Buffer](./reference/ringbuffer/index.mdx) - the SPSC, SPMC, MPSC, and MPMC variants
497
+ - [Code Generation](./reference/codegen/index.md) - the Scala code generation IR and emitter