Context
Validation must run on the client and in the service from one definition, and Zod schemas are the shared validation language (0015). Forms in the console need a state library and fields that match the UI kit (0056).Decision
- Form state is react-hook-form; validation is Zod, with the same schemas used by the API client and services.
- HeroUI inputs are wrapped by thin
FormFieldadapters that connect a HeroUI component to a react-hook-form controller and show Zod errors. - Adapters contain no business rules; a form builds on a schema, not the reverse.
- Mobile forms reuse the schemas, not the web adapters.
Consequences
- One schema validates in the browser and on the server.
- The adapters are a small surface we maintain against HeroUI changes.