chen-rn / CUA

(deprecateed) create-universal-app(CUA) is an opinionated template for creating fullstack universal apps (Expo, Next, tRPC, Prisma, Clerk, Solito, Tamagui)

Home Page:https://cua-demo.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rename client's `trpc` util to `api`

alitnk opened this issue · comments

Since this got merged, create-t3-app creates a api.ts file instead of trpc.ts for the client, allowing us to write api.bla.useQuery() instead of trpc.bla.useQuery(). I'm not aware if there are any other changes as well though.

I could make a PR for this but I guess it really depends if we're trying to keep CUA updated with CT3A or not.

This'll probably help with the PR as a reference: t3-oss/create-t3-turbo#110

commented

Good find!

Re: keep CUA updated with CT3A
I don't think it should be our goal to be synced with CT3A, and I think the choice of tamagui over nativewind is an example of that. However, if CT3A makes a change that we think will be better for CUA, we should definitely learn from that!

Re: api.bla vs trpc.bla: I personally like having the trpc name for a couple reasons:

  1. Since trpc is a newer technology, I feel it's good to expose the name for the users in order for them to understand the overall stack better. Calling it API may be better if this was a frontend only template. However, I suspect most users of this template will be dabbling in both sides, so in that case, I don't think calling it API gives many advantages.
  2. Github co-pilot will likely be able to give better suggestions lol(I could be wrong on this)

thoughts?

Fair points!

The only benefit I can think of is not having multiple files with the trpc name.

  • trpc.ts - the client util
  • trpc.ts - the backend util
  • [trpc].ts - the /api dynamic route (it's clear what this one is though)

But that's not the end of the world... Still better than next.js codebases with hundreds of index.tsx files.

commented

Yea that's true! I say we leave as it is for now.
If api.bla becomes a standard when using trpc and people find trpc.bla archaic or confusing then we can make that change!
I'll close this for now!