Code Monkey home page Code Monkey logo

Comments (1)

wmalarski avatar wmalarski commented on June 14, 2024 3

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.

from qwik-trpc-supabase.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.