Some notes on how this project was made
onChange
handlers) and wondered why there weren’t libraries that did this for you. Form libraries and database libraries existed, but there wasn’t any library that connected both of them for you.
That’s where the idea began, and I decided to write my own library. I initially worked on a project called zenstack-ui
that had similar functionality for zenstack, prisma, and react. As a first draft however, it was missing a lot of functionality and customization. Eventually I ended up finding InstantDB and decided that this was the database I would use for all my future projects. Even though the react query sdk for InstantDB was great, it still didn’t provide the level of integration with the UI that I desired, so I decided to port over zenstack-ui
for InstantDB.
IDBField
and injected the field state props (like value, onChange, touched, zod errors, etc.) into the component. For example, while the code only shows a TextInput with a label, the value prop and onChange function (to run database updates) is automatically injected into it by IDBField.
So why did I end up scrapping it? Well, the more you abstract, the less customizable it is. While this was great for simple forms, more complicated forms were almost impossible to create due to the lack of custom options. Also, you don’t get complete typesafety. So even though the current version of this library requires more boilerplate code, it allows enough customization that you can create pretty much any form you can think of.