1.0.7 • Published 12 months ago

supabase-to-zod v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Generate Zod schemas (v3) from Typescript types generated by the Supabase CLI.

Version License

Usage

$ pnpm add --D supabase-to-zod
$ supabase gen types typescript --local > types.ts
$ pnpm supabase-to-zod --input types.ts --output schemas.ts

That's it, go to schemas.ts file, you should have a schema for all tables, views, enums and functions.

Authors Note

This project was created in a few hours during the Launchweek VI hackathon and the approach is very hacky: It transforms the nested Database type generated by the Supabase CLI into flat types, and passes them through ts-to-zod to generate zod schemas. A proper solution would be using the pg-meta API to generate zod schemas directly from the source of truth, similar to how the Typescript types are generated.

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago