Getting started
Installation
One package, two peer dependencies, one optional.
shell
npm install @tesyl/hapi @tanstack/react-query
@tanstack/react-query and react are peer dependencies. zod is optional — hapi accepts any validator implementing safeParse or Standard Schema V1, so Zod is the most familiar option rather than a requirement.
| Peer | Range | Required |
|---|---|---|
| @tanstack/react-query | ^5.0.0 | yes |
| react | ^18 || ^19 | yes |
| zod | ^3.22 || ^4 | no |
Using a different validator
Anything implementing Standard Schema V1 works with no extra adapter and no dependency on hapi’s side.
any of these
responseSchema: z.object({ name: z.string() }) // Zod
responseSchema: v.object({ name: v.string() }) // Valibot
responseSchema: type({ name: 'string' }) // ArkType
responseSchema: Schema.standardSchemaV1(User) // Effect Schema