t
tRPC
t
tRPC
tRPC as a library on NX
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
S
shlezz
Was wondering - I created a tRPC API as a lib on my NX repo, and exported my rou...
A
Ahmed Elsakaan
•
12/12/22, 11:20 PM
i have also made trpc a lib in nx monorepo
A
Ahmed Elsakaan
•
12/12/22, 11:20 PM
you can check it out here
https://github.com/ixahmedxi/noodle
GitHub
GitHub - ixahmedxi/noodle: Open Source Education Platform
Open Source Education Platform
. Contribute to ixahmedxi
/noodle development by creating an account on GitHub
.
A
Ahmed Elsakaan
i have also made trpc a lib in nx monorepo
A
Alex / KATT 🐱
•
12/13/22, 8:50 AM
why isn
't this in
https://trpc.io/awesome?
A
Alex / KATT 🐱
why isn't this in https://trpc.io/awesome? 👀
A
Ahmed Elsakaan
•
12/13/22, 9:58 AM
i will add it then
C
Captain
•
1/21/23, 1:36 PM
@ixahmedxi may i ask how you are dealing with smart components inside the libs folder
? i don
't see that in your example
C
Captain
•
1/21/23, 1:36 PM
i want to avoid prop drilling
, but the trpc object for queries and mutation lives inside the src folder in the nextjs project
.
C
Captain
•
1/21/23, 1:37 PM
i cannot use that object in the libs as NX projects cannot share code
. only libs can
C
Captain
•
1/21/23, 1:39 PM
i want to use context for simple context situations
. that means i need to wrap layouts in this context but i cant fetch data for context inside the libs
A
Ahmed Elsakaan
•
1/21/23, 2:59 PM
@Captain you can make a trpc client lib that shares the context and the trpc object then that gets used by other libs and the application itself
C
Captain
•
1/21/23, 3:01 PM
and would that be node lib
? i dont fully understand where to puth the part that gets the url for the api
C
Captain
•
1/21/23, 3:20 PM
or can i put in the same place as the
@trcp
/server lib
. which is a node lib
A
Ahmed Elsakaan
•
1/21/23, 3:58 PM
i would make a next lib for it specifically
C
Captain
•
1/21/23, 6:43 PM
Ah good to know
C
Captain
•
1/21/23, 6:43 PM
Did u do that for the trpc server as well
?
C
Captain
Did u do that for the trpc server as well?
A
Ahmed Elsakaan
•
1/22/23, 1:55 PM
yes I did indeed