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

supabase auth with trpc?

I can't seem to figure out a good way to add supabase auth to trpc similar to how nextauth is integrated in create-t3-app. I am specifically having issues creating a protected trpc route with supabase auth They have the withApiAuth for protected routes, but I want something similar to getServerSession that just returns a null value that I can write code to handle....

What's the best way to bulk insert with a many-to-many relationship (posts & categories) in prisma?

What's the best way to bulk insert with a many-to-many relationship (posts & categories) in prisma?

routes

Folder structure examples in server/routes What is the recommended way to structure server/routes folder? Are there any examples online with lots of routes?...

Prisma nexth-auth role based access control model

Hi, just getting started with the t3-stack and prisma. I'm a little confused on why the Account model is required for next-auth. Also, I'm not sure how to add a role that would give me type definitions when using the session. Yes, I did looked it up and I followed the tutorial from next-auth, but that doesn't give me the type definitions on the user when setting up the session. https://next-auth.js.org/tutorials/role-based-login-strategy...

tRPC, ssr specific route

Hello. I'm migrating to tRPC and I ran into this specific issue. In this scenario I prefetch data on server using getServerSideProps and then pass them to initialData inside useQuery. I use it for SEO purposes. What can I do when I'm using tRPC, I'm unable to do the fetch on server using useQuery. I know there's option ssr: true, but I don't want to all routes to run on SSR just because of this one specific case....

How do you guys handle server errors on tRPC

I wanted to know what methodologies or opinions some of you may have with regards to handling errors that come from the server or preventing/'doing another way' the if (error) ... lines on every file

T3Stack 'react-query' not found

Hey, I'm trying to migrate to t3 stack, but I've been using react-query, but I am getting this error: ``` ./node_modules/@trpc/next/dist/trpc-next.esm.js:8:0 Module not found: Can't resolve 'react-query'...

How to start with learning backend slash cloud

title. how would i go on about starting to learn the musts of backend/infra? ive only been employed for 5 months as a trainee now and been doing like 60% frontend. my backend knowledge is limited to nestjs and nodejs. nothing else. would like to learn docker, cloud stuff, all related to this. anyone has any suggestions? any "pros" here that started their journey from scratch? cheers i appreciate all the help. finding theo's channel was an amazing thing, learned so much in such a short time

How could I improve this code?

I wrote this code and even though it works I feel like there should be an easier and better way to write it that I simply don't know how. The main part I think could be improved is the findSportEvents function? Could someone review it please? 🙏 https://www.typescriptlang.org/play?#code/C4TwDgpgBAymD2AnYBRAbhAdsKBeKA3gFBRSYCGAthAFxQDOwiAlpgOYDcJUiE9ArgBtgdRi3ZcAvlyIBjeJkawACgHkASgBUA+igBqKAHKaYdAIKJE5EAB44SVBmwA+PFADa3AmSq0oAcjMoNHooACF-ABoePiERAIBGAFoABn8oSUivH2o6fwBhYNCAESiYgWE85IAWdMzsilyAlCKoADEy3gr4-2qk2oysgF0ZADN+TFlgZgUYjGQYJlY2AAoxUSX2AEpCbl5gfkRMBiYAOnowQWZgFf9-LdPeefoIFYeAK3hWW-upIiJxpNprMwOREC91LFhCsunENuI2DtiKR5IocKNmODgDB5Lw3KDwRAAJLYGFQ4BbLgohRKF6ogAmOKQ0HwBJeJJuTwgC02q1hwi2lP+pH2h2OyNIUGA8GA5EEAHF4HL6HQMVimXiANQMCAMjUQLKSqBsJWCehmAnxACy5GAAAtTuQAEb0FZqxj6qBJHV63EQLaGjJ-IgAehDUrtzFCgKmM2O9Dt8CE9JiByOUHIx3gTveupw8FGEegoEghCgTuYbDYfGAAHVWHR7Mh0FhgNFKMzFcrGwhm04cJJQ+GAO527nQCtVmv1+OJ5MxWQQZgYItQCD9qCj5iyO2r-k4O3kFP2ieV6uIY2m0LkS1DjOYFMd3hds0MOeCFO8RfL4tjtcbrcdygQ9H2ZS9lSgVgpRlOUAQmWNZgxB8m0cVtXXXNDzEsaw7F7VCXCRbhBAgHB6Vtcg6AlUgTWVC0wXiTB+EoJ1uSpSVpVlBUrzoRjmNY7hSEnatGBnHsHBbbA2NIJ8IBfFVYDwiTgDY6RhX-NDTlGJAUHIHcVjWRT+2iZh6QADx2XBXCoqBUSUbwaLNOjkGiDi5TkjJ8TBCFyQM8T+0eckhQEyDCxWEzTLwXB8BSQijVIMjZTcayjQc81LUDOLoM4uSMrioTpwbBhDNbXKjRkuTRGK7BSqDNSjVFI4pIyOqbJpHAozkpzgDCM9uTcVKuqgVwEvIU4BstJrbPa+hNBgrjlR6qcL3wVz5tfYbyNOVa5JkI1mFCgBCDqry6xbzygAAyC6oCOma5rks7uR2BrMF2yURqS4LqJOy06GO2jLUei8AH5wMcy0oDoEaxp++iau27jILu7KryBqBQYRiCoc2zGzRq-KRMK-7wfotHQYuPzW0hqBoYJutWBq8rEajWaUYW3qQaKynsGp6GmeVXLVNISQgpFEixV2I06dEmnyIO05pYZ4L+bNbHZXllX6EDVTBzvCBTMgKYIBTJNgDAfgRDvYgw0lRXMEonI-AKVpSmifcqn6Oosht6TO0R7xGidloQnaTpyTyPoBkHG3dds+BiNOQR4FWJDGSq4BXRgNQtF0AxjBgQUuCAA...

Scroll based animations and scroll lock

What are the/your common goto solutions for doing scroll based animations aswell as locking the content and animating it while the user continues to scroll? Like on the remix page https://remix.run/ I heard about stuff like gsap scrolltrigger, sure i could intersection observer for some cases, just curious whats out there...

PUT request with tRPC

Hi everyone! First of all, I tried to find an answer to my question but I couldn’t find one. I’m trying to update an entity in my database using tRPC stack. For example, I want to edit some of my posts on my website and update their title. Everything works fine but instead of a PUT request, I see a POST request in my network tab....

can't set a cookie in my browser

this is not what I intended to do, I want to work with sessions and passportjs. but it turns out that the express-session can't set a cookie to my browser. that's why I tried this: ```js const express = require('express'); const app = express();...

Can somebody explain to me why we need an env folder with .mjs files in the T3 starter project?

Wondering why we can't use a standard .env file or .env.local or what the advantages are of doing it the ways it's done in the t3 starter?

Add props to app.tsx

how do i add props in app.tsx? i am fetching a cookie that contains colorshecme for the app and want to acess the prop in app.tsx....

Copying the Auth0 animation

I'm a complete noob when it comes to animations, but am starting to use Framer motion in a project and want to copy the animation on the Auth0 website https://auth0.com/ Any idea how to accomplish this? So far I have this, but it's not working as I thought it would: ```typescript interface TextLoopProps {...

Prisma enums in React Native app (create-t3-turbo)

Hi guys, I'm using create-t3-turbo monorepo with NextJS and React Native apps & Prisma. I do have a problem with the generated types tho, as Prisma needs node to run afaik. I have a file in @acme/db package called types.ts that exports my enums:...

How do I use import statements in worker_thread ts files?

Im getting the typical cannot use import outside of module

Astro tailwind not working

Have I missed something???

zod with post mutation stucks on a field

Hi, I finished building my form for now and on submit I can log all data properly. Now I tried to add a post mutation, so basically after clicking on submitting a post request shall be send which creates something. I also added zod for validation. ...

Frontend reading first 2 lines in large csv file

Is there a clean way to read only first 2 lines in csv file without loading whole file into memory? Users can upload big files and I want to read header column of those files