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

t3 auth problem

i have a problem with next auth when i click on the sign in i get redirected to the discord login i click sign in with discord then i get redirected to : https://discord.com/oauth2/authorize/signin/discord but i get invalid form body im new to next auth thanks to everyone...

Dialog shadcn not showing up as a dialog but just as content

It seems like tailwind classes are not resolved in the dialog This is my div ```jsx <div className="flex gap-4">...
No description

Storing ab access token in memory server-side in NextJS

How can i store a token in-memory server-side in a Next.JS project? I tried doing this: ```ts export let accessToken: AccessToken | undefined; ...

change tailwind color based on api response

Using next 14, turbo, tailwind I have an app that should change colors based on api response. Can I somehow change the tailwind config primary color in the top of my next app in the head server component? ...

Global state in nextJS 14

Hey yall, I see that with the way Next.js and server components are heading, we're moving away from the days of wrapping your entire app in context providers and whatnot. My question is, how do i get access to global state in Next.js without making my entire app client-side rendered? I saw solutions like nextauth that also wrap your entire app in a provider - doesn't that make your app client-side rendered? Am i missing something here? is there a way to have global state in my next app while also keeping the benefits of SSR?...
Solution:
You can pass server components as props to client components. So with a structure like this: ``` function Layout() { return (...

Refactoring for Dependency Injection (Circular Dependecies)

TLDR: I want to refactor my application for dependency injection and I am not sure how to. I started creating Classes for basically every resource / table in DB. They all contain functions related to the resource like this: ```typescript interface UserRepository { getByID(id: number): Promise<User> }...

shadcn install with T3 stack

Following the command on their site (https://ui.shadcn.com/docs/installation/next) pnpm dlx shadcn-ui@latest init install removes options that create t3 app does (for example changes to tailwind.config.ts). How do you guys properly integrate shadcn into your t3app?
Solution:
create-t3-app integrates with shadcn in a turbo monorepo setup: https://github.com/t3-oss/create-t3-app The monorepo setup won't be necessary for you, but you should be able to pattern match off how the ui package is setup there I would think....

Commitlint issue

i run command git commit -m "feat(ui): Add initial UI components for the app" but found this message ...

Should I ditch Django for GO or full stack Next.js

Hey guys. I am a beginner and have been building a Nextjs + Django rest framework web app for a long time now. I was asking for some help on a discord server and I was questioned why I have been using django, and told that its a bad idea, a pain in the ass, very complex, and other solutions are much better like Nextjs backend or GO....

next prisma tanstack query

hi everyone just wanted to ask this question i use nextjs and prisma with server actions to query the data from my db (postgress) i used to use readct query when i workied with react what do you think about using tanstack query (react query ) in nextjs another qst what do you recommend for charts and tables ?...

TSUP advice - typescript behaving differently after build

I have little experience with building my typescript code into packages that I can then publish and subsequently then download from the npm registry - however that is exactly what I am trying to do right now. After doing some research it seems TSUP is a favourable tool to use to bundle ts into a package. I followed this video from Matt Pocock https://www.youtube.com/watch?v=eh89VE3Mk5g However, when I import my class from the generated dist folder, typescript is not able to infer types correctly. This occurs when I call one of my factory methods, which generates a method that accepts an argument of a type dependant on the argument provided to the factory method....

How do I merge two Zod schemas?

Hey guys, I am creating a form with react-hook-form and Zod. The form was too long, so I decided to divide it into multi step form, with each step having separate Zod schema. I am storing the form data locally until all steps are complete. Now, I want a Zod schema for combining the schemas and perform a validation before I send the data to the server. I am unable to find the right solution. Can somebody please help me?
Solution:
``` const schema1 = z.object({ name: z.string(), }); ...

Building your own icon library

Hey yall, i was wondering; for the people who work at a company and need to maintain a custom icon library made by your design team - how do you implement them in your codebase without a lot of copy and pasting? I started by moving our icons to the /public folder, but i realize this feels really weird, i was wondering if there's a solution out there that's a bit less daunting....

stack suggestions

hey guys I've mostly worked on frontend (next.js) so far, trying to buid a full stack project on the side and want suggestions for the backend stack. I've worked a little bit with mongo / express but I'm open to other langs as well to push myself and learn if the tradeoff is more scalable/ performant / cheaper or if there's a middle ground between the mentioned and a good dx, open to it too....

testing in production setup Next JS Vercel

Hey everyone, the testing in production video inspired this question. As I’m building out my code pipeline, I’m at a crossroads. Do I go down the feature flag route or create a separate vercel instance attached to a custom domain for production testing. My objective is to separate my main production build from testing as much as possible. Which I guess is not possible with feature flags. I currently have 3 users and will be onboarding around 3/week for the next month....

How to invalidate query made by trpc inside a RSC

In the root page which is a server component, I have fetched some data like this
const posts = await api.posts.list({});
const posts = await api.posts.list({});
...

best way to add an admin portal following best practices

Hi all, i am wanting to add a admin portal to my application https://mixiecooking.com/ this portal would be used for adding blogs, updating privacy policy, terms of service, etc. I am wondering what the best way to do this would be, some options i have thought about - adding the portal as /admin - At [userId]/admin - using a subdomain such as admin.mixiecooking.com however this requires a whole other application to be built and maintained...

where to send topic recommendations for videos/streams?

There's an interesting topic gaining traction on a change merged into React 19 that changes how suspended sibling components that fetch data work. Going from parallel requests to waterfall, causing a whole bunch of problems.. Would be interesting to hear a Theo-take on this and small, under the radar changes like this in frameworks as well. Here is the github issue, which links to the PR which also contains discussion: https://github.com/facebook/react/issues/29898...

Azure CDN

I just deployed a CDN(classic) but I can’t seem to find what is being cached inside that CDN? Any way to see it from the dashboard or console?...

Advice on realtime integration

Hello All! I'm working on a very important app for myself and a select large group of people, to simply explain it is a very sophisticated note taking/sharing app. I'm currently making it with Expo/React Native in Typescript(of course), and my initial thought for the database was Supabase which I am self hosting on my local server. Part of my requirements is that there is an aspect of realtime communication in sending messages/notes to others. My first thought for this was just Supabase for the Auth, Database and Realtime all in one....