chen-rn / CUA

(deprecateed) create-universal-app(CUA) is an opinionated template for creating fullstack universal apps (Expo, Next, tRPC, Prisma, Clerk, Solito, Tamagui)
https://cua-demo.vercel.app
MIT License
1.01k stars 67 forks source link

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

Closed alitnk closed 1 year ago

alitnk commented 1 year ago

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.

alitnk commented 1 year ago

This'll probably help with the PR as a reference: https://github.com/t3-oss/create-t3-turbo/pull/110

chen-rn commented 1 year ago

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?

alitnk commented 1 year ago

Fair points!

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

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

chen-rn commented 1 year ago

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!