devrsi0n/chirpy

Migrate to trpc

devrsi0n opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

GraphQL is good for teams with enough resources to develop backend/frontend separatedly, but for a small team, we consider trpc as a better option, since it's type safety and quicker database development flow

GraphQL cons for this project:

  • have to create nex-auth graphql adapter manually, which is buggy and painful to maintain
  • Hard to make local cache work
  • Heavy client bundle size
  • Hard for new contributors to work with this project

GraphQL related client side bundle sizes:
image
image

And I really like react-query model to handle local cache to improve user & developer experiences.

And we plan to use planetscale as our hosted database, because of the low latency and convenient database branching development.

Migration blockers:

  • Hasura Events, all our notification messages are built on them
  • GraphQL subscription
  • GraphCDN/Cache layer

Solutions:

  • Trigger notification when creating/deleting comments
  • Use interval polling instead and refetch when user receiving a notification
  • Use planetscale instead, the query latency is pretty promising. Also leverage local cahe (e.g. IndexedDB) with react-query to improve user experience

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Maybe migrate to react-query first, it should reduce the bundle size and leverage client cache.
Related links:
use subscription
TanStack/query#1506