BBuubbaa
DTDrizzle Team
•Created by BBuubbaa on 12/5/2024 in #help
Inferring schema with drizzle-zod in sveltekit app
I am using drizzle orm in a sveltekit app and the logical place to define my db schema is in the lib/server/db directory. I am also using shadcn with superforms, which require a schema definition for validating the inputs (i am using client side validation as well). The problem is that having the table definitions inside the lib/server folder is preventing me from inferring the schemas for my tables with drizzle-zod and use those in client side code.
At the moment I am forced to define a separate schema (basically duplicating information) for insertion. My question would be: has anyone faced this problem, and if so what was you solution? I would be happy to provide more information as needed. Thank you!
2 replies