`zodvex`
👋 I've been working on a replacement for the convex-helpers/server/zod library that supports zod v4, and with a few of my own opinions on API.
Really interested in feedback from any zod users looking to upgrade to v4! I've changed/added a few apis here, but the README should have everything you need to get started.
If it's missing any features please open a ticket!
https://github.com/panzacoder/zodvex
GitHub
GitHub - panzacoder/zodvex: A small library for interacting with Zo...
A small library for interacting with Zod and Convex together, with Zod Codecs and Zod v4 in mind. - panzacoder/zodvex
16 Replies
Great work, thank you! We can finally update zod 😆
Why not open a PR in convex/helpers? Does it have more functionality? Genuinely asking, not bashing
@alfredomm Really great question! Ultimately it came down to three things:
1. @ksinghal already had discussed owning the upgrade with the convex team, and I wanted to unblock myself immediately
2. I didn't want to be restricted to maintaining the size/shape of the api that convex-helpers/server/zod maintains, but have a bit of freedom to be more opinionated
3. I have heard on a few different occasions that he convex team feels that convex-helpers is getting too big, and they would prefer independently maintained packages to enter the ecosystem
That said, it does appear there is a fresh attempt at a PR for adding zod v4 support, so that may still land!
Does it have more functionality?Yes, a bit. And I'll add more over time: -
zodTable as a drop-in replacement for Convex's Table
- Zod Codec's for automatically converting z.date() objects to timestamps for storage (admittedly not thoroughly tested, I haven't migrated my own app to using date objects)Thanks for the reply! I'll definitely check it out, because I really want to dedupe some of the sanitisation and keep one version of zod
hey @panzacoder is there a way to get the type of a customctx using your library?

Here
CustomCtx does not exist, however it is provided by convex-helpers/server/customFunctions if using normal customQueryBuilders
I will say that I saw your ExtractCtx helper however, its deprecated?


does anyone know why I am getting this type error when my schema is marked as optional? I can bypass it by casting it
as any
I changed to using but not sure why z.any() doesn't work with optional()I will look into this! I haven’t run into this need (getting the type of the CTX and not the actual function), can you help me understand the use case a bit?
Not 100% on this one, I’ll put it on my backlog to investigate. Do you get any errors with the raw schema, or only when you are testing against it?
no it is indeed the type, sorry if i misrepresented that, i want the type of the ctx, im using ExtractCtx right now, is that the right way to do things?
@panzacoder do you know what I am doing wrong? or is it an issue with the library ?



(sorry here is the create mutation) but still its infering all types to
any instead of proper types.

seems to be an issue with the generated api.d.ts
Also tries without
shape its the same issue, I moved to using the regular convex values and types are being generated properly.


@Sam and @dan myles Sorry for taking a while to get back with you, been very swamped with my other projects.
Not to give you the run-around, but it's much easier for me to track issues and keep them straight when reported in GH, could you open an issue for each of these if you are still facing them?
At this point, even if it isn't acutally a bug, it's easier to triage there