[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 💡

      1. ❇️ Gen new schema → e.g. ‘/schemas/Post’

      2. ⚙️ Turn schema into DB model → e.g. ‘/models/Posts’

        • Reuse ‘Post’ schema to create typed DB model

      3. ❇️ Gen new resolver → e.g. ‘getPost.resolver.ts‘

        1. Reuse ‘Post’ schema as (DataBridge) output

        2. Reuse ‘Posts‘ model in actual business logic

        3. Choose option to also generate fetcher fn

      4. ❇️ Gen new route → e.g. ‘/posts/[id]‘ → <PostDetailScreen />

        • Choose option to pick `getPost()` as initial data provider

      5. ❇️ 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

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
💡

Features / Fixes

Date

7 months ago

Author

Thorr Stevens

Subscribe to post

Get notified by email when there are changes.