[Plugin] - Route, Form & API Generators
Expand the list of Turborepo Generators:
❇️ npm run add:route → New universal route & screen + link to data-fetcher?
❇️ npm run add:resolver → Add new API route & GraphQL resolver
❇️ npm run add:form → Add new Form State Hook
All linked / linkable to the same resolver (DataBridge or input / output schemas)
Interactive terminal UI to pick the destination / schema / resolver / …
Single Source of Truth = Nothing gets out of sync, e.g.
Recommended Workflow 💡
❇️ Gen new schema → e.g. ‘/schemas/Post’
⚙️ Turn schema into DB model → e.g. ‘/models/Posts’
Reuse ‘Post’ schema to create typed DB model
❇️ Gen new resolver → e.g. ‘getPost.resolver.ts‘
Reuse ‘Post’ schema as (DataBridge) output
Reuse ‘Posts‘ model in actual business logic
Choose option to also generate fetcher fn
❇️ Gen new route → e.g. ‘/posts/[id]‘ → <PostDetailScreen />
Choose option to pick `getPost()` as initial data provider
❇️ Gen new form → e.g. `useUpdatePost()`
Pick `Post` schema option to create form state hook for
Updating the ‘Post‘ schema will now automatically update all the rest
Log in to comment and vote
No comments yet
Be the first to share your thoughts.