Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

Creating your own reusable components cross project (Bit.dev Storybook)

I’m rebuilding my site with the T3 stack and I’m going to be having an extremely similar site to it that I also host for premium users. These sites will share a bunch of components so I want to find a way to write my components once and reuse them. For tooling on this, the two options I’ve found are: https://bit.dev/...

NestJS with Auth0

Hi all, so I'm interviewing with a company for a full-stack JS position. They sent me a challenge and there's a part of it challenging to me, they have an Auth0 app ready to be used by candidates, they just sent me jwks.json file. I don't know exactly what to do with it from the backend side (NestJS), because usually when I integrate with Auth0 I create my own app and just follow the docs to complete the integration. Any thoughts?...

Partial rewrites using nginx

Anyone here familiar with doing partial rewrites using nginx? I have a setup with three containers: - nginx - legacy app (lives at www.example.com)...

[Prsima] findUnique() vs findFirst()

Could somebody explain the difference between "findUnique()" and "findFirst()"?

is it possible to find some npm package | binary | script that does this?

css file: ```js action: someCssLib.component[TAB] // the result is the css or the tailwind equivalent of that style component ...

TS-newbie struggles with TS via NextJS Layout

I am creating a simple layout file that looks like this: ```ts type Props = { children: ReactNode; title?: string;...

PRIMARY KEY in supabase DB

Hi everyone! I’m creating a full stack app with tRPC and I’ve connected Prisma to a supabase postgresql DB. Everything works fine but when I try to delete columns I have a error saying that I need a PRIMAY KEY. Can anyone please explain to me why I need that primary key in order to delete /edit my data in DB? 🙏 thanks...

How to pass in a React icon as a prop and style it with Tailwind

Hello I'm trying to create a reusable react component that takes in an icon and I want to style said icon with a base style. I included some screenshots of what I have so far. I've been at this for a while, any help would be very much appreciated.

useQuery param is undefined. but query is enabled only if the param is defined.

im trying to set up some searching. and came across this error. i am not sure if i am missing something in my reasoning for why this should work (some react or maybe react-query rules/quirks). SSR is off btw.

SSR useQuery Breaking Page Transition

Technically using an infinite query, but I have an array of Posts that I'm prefetching, but when I use a next.js Link I get an undefined error during the transition

Running into a Error with UseMutation

Hello, I am running into an error TypeError: Cannot read properties of null (reading 'client') when using useMutation(). I am new to to react-query and TRPC so some help would be appreciated. Thanks!...

Recomended BaaS for bulding & hosting Serverless functions and APIs

Hello! Im New to the community, but exited to be part of it🤘 Im quite nifty in python and java, but have fallen in love with NextJs and the T3 stack in the recent months. I have started a coulpe of Fullstack projects with Firestore Databases and API routs with Next hosted on Vercel for a production build, but as I am learning more and trying to build bigger projects I dont really know how to connect, host and build production ready APIs with other languages such as Java and Python. I have managed to set up a local flask and Django API endpoint, but as I want it to be serverless, I have not been able to figure out a way to host it....

Error on mutation `connection timeout error prisma.uRL.update()`

I'm building a url-shortner it just worked correctly until i added a redirect count trpc mutation before redirecting to the original url, it is giving connection timeout error on prisma.uRL.update() , idk why this is happening please help pages/[code].tsx ``` useEffect(() => {...

Nextjs revalidate on the edge

Is it possible to do things like revalidate or set the preview mode on experimental edge api routes?

Twitch API - Request bearer token on every request?

Okay so I'm building a simple endpoint to grab the user ID of a user. In order to do so I need to provide a bearer token, which I get when I make a request for it using my client ID and secret. Since I'm using serverless, will I really need to request that bearer token before every API request? Or am I missing obvious. (I wish Twitch would let you make app API requests using your ID and secret directly)...

Deciding where to do searching & filtering. Frontend or Backend.

So i have a table in my DB called "Exercises". Which contain about 5 feilds of text data. In total there are about 1700 exercises. Currently im populating about 300 Exercises in my db for dev purposes. So it was easy enough to have an api route to pull every Exercises into the client (~77kb). And do some basic filtering client-side with some string pattern matching. ...

Why isn't TypeScript giving an error?

So I'm helping this person on another server and their code looks like the following: ```ts type Unit = { unit: string; abbreviation: string;...

How do you get cookies through the TRPC Router?

Question is pretty much in the title. Was having trouble finding resources about this online.

Creating Zod Input Validation Error after tRPC entry

I've got a ct3a project, with all the bells and whistles (including tRPC and zod). In addition, on the frontend part of the app I've set up a couple of forms with react-hook-form, and I am sharing the zod schemas being used with tRPC. What I'm looking to achieve, is AFTER the input validation by the tRPC router mutation has been completed, and the code has moved on into the logic within the mutation itself, to be able to send back an input validation error and set these errors in react-hook-form. This would be the business logic:...

Lightweight Message Queue for Long running Background Tasks

I have a nextjs application I want to queue jobs. Essentially I want to queue a job and then I would create that job in the database associated with the user then I would get back its id. User will be able to check its status by its job id later on and once it is finished the the that had been queue will call my nextjs api endpoint to trigger a series of actions which might be store the result of the job in a database.