Introducing Zoi: Elixir's Answer to Schema Validation Inspired by Zod

119
clicks
Introducing Zoi: Elixir's Answer to Schema Validation Inspired by Zod

Source: paulocurado.com

Type: Post

The article presents Zoi, a schema validation library for Elixir that draws inspiration from Zod, a TypeScript library known for its ease of use and ergonomic design. Zoi aims to fill the gap in the Elixir ecosystem, where existing validation libraries like Ecto and NimbleOptions exist but lack the same level of user-friendly syntax. The post compares Zod and Zoi, showing how both allow for schema declaration and validation. It highlights various features of Zoi, including its integration with Phoenix Controllers for validating incoming JSON payloads, generating OpenAPI documentation seamlessly, and inferring Erlang types from schemas. Zoi also implements Phoenix.HTML.FormData, allowing for consistent schema usage in LiveView forms. The author concludes by encouraging readers to explore Zoi as a valuable tool for schema validation, type inference, and documentation generation in Elixir applications.

© HashMerge 2026