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

trpc #56

Open
devinschumacher opened this issue Sep 30, 2024 · 8 comments
Open

trpc #56

devinschumacher opened this issue Sep 30, 2024 · 8 comments
Labels
CICD ⚙️ CICD, SRE, DevOps, etc.
Milestone

Comments

@devinschumacher
Copy link
Member

my buddy (developer) Brian recommends we use https://trpc.io/docs

let's look into it @dawaltconley

@dawaltconley
Copy link
Collaborator

I'll have to read more, not immediately sure what the advantage is since Nuxt is all Typescript & useFetch picks up on the API types, but they do have a Nuxt example: https://trpc-nuxt.vercel.app/

@devinschumacher
Copy link
Member Author

devinschumacher commented Oct 1, 2024

Im a bit unclear as well, maybe brian can clarify

@2-fly-4-ai

@devinschumacher devinschumacher added the sesh 💬 discuss / meet / brainstorm / pair program / etc. label Oct 1, 2024
@2-fly-4-ai
Copy link
Collaborator

I'll have to read more, not immediately sure what the advantage is since Nuxt is all Typescript & useFetch picks up on the API types, but they do have a Nuxt example: https://trpc-nuxt.vercel.app/

Hey mate, I'm coming from next trying to see how things fit together. I just took a look at the template, and the current way of doing things looks clean. No need to shoehorn in TRPC if it is not prevalent in the nuxt/vue ecosystem but it's very useful and part of the other stacks I use. So maybe just take a look.

What are you using for your validations? Have you considered Zod? Or is there some better way to use nuxt? It's another great tool that helps me a lot with forms and other things. I find it very useful. let me know.

Here is the implementation of trpc I was looking at before. I started from here as they have a nextjs t3/turbo repo setup and a nuxt one. So was just comparing the way they do things there are a lot of similarities.

https://github.com/devinschumacher/supastarter-nuxt/blob/main/packages/api/modules/admin/procedures/delete-user.ts

This is very much my current stack at the moment. Fan of working in monorepos, but it depends on the scope of the project and if you need a mobile version etc.

What are you currently using for UI? Have you used shadcn at all? That is my current go-to as well. I see there is a Nuxt version; I'm gonna start experimenting tomorrow and getting familiar with Vue. But it all looks pretty similar.. Should be quick.

https://github.com/devinschumacher/supastarter-nextjs
https://create.t3.gg/
https://github.com/t3-oss/create-t3-turbo

Copy link
Member Author

devinschumacher commented Oct 2, 2024

@2-fly-4-ai

  • ✅ yes, we are implementing Zod for data validation -- see add to README #51 -- it's in the queue for Milestone 1 to add to the proj!
  • ✅ yes, we will be using shadcn for UI as well -- see Milestone 3

@devinschumacher devinschumacher self-assigned this Oct 2, 2024
@devinschumacher devinschumacher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
Copy link
Member Author

Marking this as cancelled - seems the consensus is we do not need trpc.

@devinschumacher
Copy link
Member Author

My research into trpc over nuxt's useFetch is this:

Benefits of tRPC instead of just useFetch:

  • Reduced Runtime Errors: Type safety catches mismatches and errors during development rather than at runtime.
  • Improved Collaboration: Developers can work confidently on different parts of the app, knowing that shared types prevent miscommunication.
  • Faster Development: Auto-generated types and APIs reduce the amount of boilerplate code and speed up feature development.
  • Easier Maintenance: Changes to data models are automatically reflected throughout the codebase, simplifying updates and refactoring.

Key Takeaways

Type Safety with useFetch:

  • Limited to Client Side: Any type annotations are only checked on the client and do not guarantee that the server's response matches.
  • Manual Maintenance: Requires you to manually ensure that client-side types match server responses.

Type Safety with tRPC:

  • End-to-End Enforcement: Types are shared between client and server, providing true end-to-end type safety.
  • Automatic Updates: Changes on the server automatically propagate to the client, reducing maintenance overhead.

TLDR

"If you value the end-to-end type safety and streamlined API development that tRPC provides, it's worthwhile to incorporate it into your Nuxt project alongside useFetch."

@dawaltconley

@2-fly-4-ai
Copy link
Collaborator

2-fly-4-ai commented Oct 19, 2024 via email

@devinschumacher
Copy link
Member Author

moving this to another milestone since we dont really know what to use it for yet anyways

@devinschumacher devinschumacher removed their assignment Oct 26, 2024
@devinschumacher devinschumacher added CICD ⚙️ CICD, SRE, DevOps, etc. feature 🎁 New feature or request to improve something and removed sesh 💬 discuss / meet / brainstorm / pair program / etc. feature 🎁 New feature or request to improve something labels Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CICD ⚙️ CICD, SRE, DevOps, etc.
Projects
None yet
Development

No branches or pull requests

3 participants