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

Understanding Tanstack Query as state

Hey there! I am hoping someone can help me understand the concept of using Tanstack Query (React Query) as a state manager? I have been reading articles and even playing around with some code myself on how lots of people love using TQ as a state management tool. The idea that your state lives on server-side and you app simply reads from query/cache. This of course seems really cool especially for say data tables etc. But I am struggling to understand the concept of possibly using that for something that is maybe more traditionally aa client-side state but moving it to server side? Let's say you have user's preferences stored in the database. You could store things like, what colour theme they're using and maybe some other things. You use TQ to fetch this data from the server so on load we know what theme the user has chosen, but now we want them to be able to change their theme choice! Traditionally we'd just use a useState or a Zustand store and our Theme Provider can base what it is showing off that state. Is the idea with TQ that we would trigger a mutation (edit the user's preferences) and then invalidate the TQ query on the user's theme provider so that the theme then updates? So the state is sort of doing a round-trip?:...

Generating docs for customer public api

Does anyone have experience making public api documentation for users? I have an api that has internal openapi/swagger docs, but I want to make the docs more customer friendly and open source so users can use the docs in their llms etc. If anyone has any tips on how to do this (besides manually), i would be grateful

Dynamic Code Evaluation not allowed in Edge Runtime

hello there while deploying on vercel, i got this error ``` ./lib/server-utils.ts Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ...

another react native tech stack question

Going down a rabbit hole of grpc and then realised it's not even supported by expo management workflow What i wanted to achieve + offline first + good sync experience...

Tailwind Class Order

Hello, i'm new to tailwind and trying to understand it better. I came across one of theo's video about tailwind in which he talked a bit about declaration order. source. How does tailwind solve the "declaration order" problem he talks about? I tried it myself with the following example: ```js <p class="h-20 bg-blue-500 bg-red-500">Tailwind Test</p>...

OAuth approach with NextJS app router and BFF pattern

Hey folks, I'm looking for some guidance on the best way to approach oauth in the way I like (and generally have) to build apps. My general stack these days, is to use NextJS with RSC for everything frontend, i.e. fetching data on the server and heavily using Suspense etc. when building UI, but using some other tool for the backend. For personal projects I'd use Laravel, at work there is Java Springboot - I'm currently looking at a project using NestJS - point is, the backend and thus all the "brains" of my apps is outside of Next - so heavily using the backend-for-a-frontend pattern. Now, mostly the way I've always handled authentication with this is just standard email+password logins. So;...

only-allow doesn't block other package managers

As per the docs, to prevent other package managers , I used this preinstall script to your package.json: ``` { "scripts": {...

ShadCN Styling Issues

Hey, so Im not sure if you guys are familiar with ShadCN UI, however when trying to set it up within my Monorepo, all the components seem to appear however there is 0 styling. Ive tried for the past 2 hours to try find a fix but I seriously have no clue whats up. If someone could help that would be great πŸ˜„

how the hell did yall do this (react perf question)

anyone here know how t3chat renders new message blocks without rerendering the entire message? am trying to replicate this but can't seem to figure it out (notice how my list of blocks is rerendered every time a new block comes in vs t3chat only rendering new blocks) πŸ€” my only guess is that t3chat isn't using a list of blocks? https://media.discordapp.net/attachments/1380760436328366112/1395598551463100606/what.mov?ex=687d022f&is=687bb0af&hm=b7a1905fb64b9bec01ee7cc711a07ec8067420618b0b9ee245c720dd32c05bcb&...

Grok 4 NOT WORKIIIINNNG

I am trying to use my handsome, elegant, beautiful, intelligent, Humbled Grok 4 but its NOT WORKING and instead thinks forever just to throw "Model failed to generate a response. You have not been charged for this request. Please try again."

my kimi k2 just went crazy

lol my kimi k2 just went crazy. we were talking about coding. all of a sudden it started replying like this whatever I say (it goes on forever if I don't stop her) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS (Keep It Simple, Stupid) KISS...

best way to set up stripe?

ive seen theo's stripe recommendations. but for setting it up the first time, do you have any recommendations? i plan on using an mcp with the stripe docs and then downloading some sample projects to give my agent context. lmk if there's anything else to look out for....

Ts library on theos stream

What was the ts lib which could give you the typescript performance? theo talked about it but I cannot find it anymore.

AI memory capabilities and access to project files

I love T3 chat as a concept. When DeepSeek R1 was released I started to build my own chat UI for it but didn't finish it. T3 chat is near perfect tool for basic chat AI usage. I love the ability to choose any AI I want for different things with reasonable cost. What I need for my work is the AI to remember longer chat history and/or access to project files. Is this even possible with current AI tools? If yes, is something like this possible to integrate with T3 chat? Project files could include: - Project Summary: this would be similar to your first prompt when starting a new project, a guideline to the AI what we are working on which the AI can look into with each prompt if needed - Code files: AI could always look into project files and review up to date code when suggesting improvements or new code....

utils.setData vs useState for client-side state

Are there any known downsides to using utils.setData over useState to manage client state of objects. ```ts // ... onInput={(e) => {...

Does UploadThing support converting videos to H.264 + AAC during upload?

I want to take a video from a public URL, check if it's encoded with H.264 for video and AAC for audio. If it isn't, I need to convert it to that format. After that, I want to either stream it or upload it to UploadThing. I don’t want to store the video permanently, usually the videos will be stored for 7d.

How to make suspense work properly?

Hello guys, i have an next js app, and there is a catalog page, in ssr component i'm making fetch request for data and wraps this component in suspense with skeleton fallback, but on navigation it awaits request to be resolved and only then redirects me to the catalog page. What's the problem and how to redirect user immediately and show fallback while data is fetching? here is an example https://stackblitz.com/edit/next-playground-oe67nrlp?file=app%2Fpage.tsx,app%2Fcatalog%2Fpage.tsx...

T3 Chat auth headaches

Theo did a video some months ago mentioning a bug in an auth library used for T3 Chat that caused him some headaches (some IDs did not match). Today, I was wondering if he was talking about Better Auth or OpenAuth, but I can't find the video. Could someone with a better memory help me out solving this mystery, please! Thanks in advance!
Solution:
https://www.youtube.com/watch?v=yXhbzFNUeh8&t=763 12:43 Is this what you're talking about? I just watched the video like yesterday...