Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your experience #1

Open
default-kaas opened this issue Dec 27, 2022 · 1 comment
Open

Your experience #1

default-kaas opened this issue Dec 27, 2022 · 1 comment

Comments

@default-kaas
Copy link

@wmalarski How is your experience up until this point with building an application with QWIK + TRPC?

@wmalarski
Copy link
Owner

wmalarski commented Dec 27, 2022

Hello. I think this is good experiment but I'm not going to use this approach in future.

I'm using tRPC not only for frontend-backend communication but also 'service' layer for fetching data in server functions like 'onGet', 'onPost'. And I feel service layer is more suited for Qwik architecture.

Whole integration has some strengths but I think there are better patterns around 'actions/forms' that Qwik can offer. I feel that to get most of Qwik architecture we need to reduce code that runs on init (tRPC needs setup) and be aware of client code and data that is sent to client. I saw discussions on Qwik discord that they want to add remix/solid-start like forms in future. I really like those patterns and I hope they go this way. I prefer building apps this way. I'm out of loop right now so I don't know exactly what's the current status. I did few tests and my favorite approach is currently:

FORM -> onPost -> tRPC call on server -> tRPC resolved

Big strength of tRPC is great integration with client caching solution like tanstack-query. Without such caching layer I don't feel there is much difference between using tRPC and using actions/forms.

I would recommend to use tRPC in Qwik project if you value back-end features - how it can help structure code, possibility of adding custom middleware, reusable primitives and type-safety. It's not super hard to build similar things by following trpc mindset without installing trpc itself.

This whole thing reminds me of discussions about using tRPC in Remix. Builtin Remix features are covering most of strengths of tRPC. Maybe you can find some discussions and better explanations by searching for Remix/tRPC threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants