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

Securirty issue next auth

Did anyone ever get anything like this? Google is reporting an issue on my site, I implemented auth with next auth spotify, but not sure why they're complaining about it

Importing country codes as an enum

What solutions do you recommend to deal with country field for a user profile? i was thinking about creating an enum file in the utils which i could use to import both on the frontend and the backend (prisma / postgres ) but the docs mention only hardcoding enums in the prisma.schema field (https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-enums) What is the best approach to avoid duplicate code? Any tips would be appreciated! Thanks!

Create-t3-app but Vue

This is m,ainly for the people that worked on creating create-t3-app going to develop an equivalent CLI for Nuxt/Vue + some other things i think are essential to an app it will be heavily inspired by create-t3-app but i also want to clone the repo, and selectively replace things therefor copying off most of the work. ...

Shadow Database Prisma & Planetscale

Hey! I've been following along with Theo's roundest pokemon app tutorial, and he makes a shadow db branch for prisma. My problem is that planetscale only allows 1 production and 1 dev branch for free users. Do I need the paid plan??

Conditionally change color of icon

Hey so I want to change a color of icon when clicked and it is inside state array I created. Currently I have something like this. <FontAwesomeIcon icon={faStar} key={coin.id} className={hover:text-yellow-500`}...

How to use fetched data as State?

I am getting data (a post) from trpc inside my component: ```ts [id].tsx const Post = ( props: InferGetServerSidePropsType<typeof getServerSideProps>...

next session is lost on refresh

Hi people, I have a problem that my session is lost on page refresh. I have getInitalProps in my _app.tsx and I can't manage to get session from there and pass it in SessionProvider I have tried getSession and ustable_getServerSession but both don't work....

Global Auth middleware tRPC problem

Im trying to build an admin dashboard app. I wanted more global approach for auth so rather than with protected/public/useSession approach which T3 is set up with Im trying to go with global middleware. So far so good it works but whenever I delete my session and tRPC request is made then middleware is calling redirect on tRPC api causing it crash as it responds with HTML document thus not making any redirect and making trpc erroring. refreshing works and I get redirected. Can I somehow overcome this and be able to also guard over trpc api calls or I would need to also disable middleware for /api/trpc and handle unauthorised on client? I would like to be able to handle it in middleware tho but can't find out how. ...

NativeWind vs twrnc for react native(+web) Tailwind solution?

Seems like NativeWind is a bit newer and has a nice Babel plugin that makes it feel like developing for web, but twrnc has been around a bit longer and has more interesting functionalities like ios: android:. Has anyone tried either?...

How to implement manual authentication without TTL entry

In MongoDB land, one way to create a user is creating a userToken when they sign up that automatically gets deleted by the database in expiresAt seconds if they don't confirm their account via email. What is the conventional way to accomplish this if there is no TTL functionality as it seems like Prisma doesn't support an expiresAt feature. I want to avoid a ton of userTokens accumulating in my DB if someone maliciously keeps signing up new accounts - besides rate limiting them and banning their ip etc. Just interested in db level cleaning solutions.. or alternatives to creating this userToken...

Type Inference with T3 Stack

What is the best way to infer a type when using the t3 stack from an api call? React Query docs mention the use of Generics but i cant wrap my head around it. More specifically, i want to return an array of the Event Custom Datatype i have defined from the db but i get a type error Event[] is not assignable to type (type structure here). The weird thing data fetching works ok on the frontend. Any resources that would be useful looking into would be greatly appreciated. Thanks!

looking for example of dynamic-routes using trpc ssr

I couldn't find an example project and I am too stupid to understand the docs

Trpc & non-consistent JSON Field Attributes in MySQL

Just getting used to trpc & the t3 stack. Say I have a standard procedure: ``` update: t.procedure...

Best way to handle who is online.

I have a basic T3 app that is a chat app It has the ability to create separate rooms. I am using web sockets and handle messages, etc. and I can track when someone connects, I just am unsure of how I should handle how the person connects. My current ideas are: 1. Just take the id and store it into a object on the server then just fetch it through trpc. The problem I can see with that is the object could become quite large if you have a large number of users. 2. Store who is online at the time in a DB, it would make it so I can easily query through the data without worrying about handling large objects. Only problem is it would be tons of query's to the DB....

Authorization Checking for editing data?

I was wondering if there's a general best practice to do something like this very simply in T3: Let's say you have a user profile page. You want anybody to be able to see that page, but only TAHT specific user can edit the page if they're logged in. What would be the most hassle free way to implement this?...

radix ui or headless ui for unstyled components?

Which one to choose and why? Or maybe something different?

React ref types

Hey. I'm having some difficulty trying to set a type for a ref in React that can be applied to any HTML element.

Scale Node+express

Having issues with handling large amount of incoming requests as server responds 504 soon, Currently running pm2 to handle multiple of them at same time where single user will have multiple requests sent over period of time. Is there way to queue these incoming request and guaranteed consume them in order (Also need to keep the order each users requests in mind like A1, A2, A3 should be ordered from user A but B1. B2, B3 can be processed in parallel)...

Github is f***ed up.

hey I transferred all of my repos from Bitbucket to Github then realised that commits don't count(show up on my home page) because they don't have the author and email. then I found this bash trick to add email and author to all of my commits on a certain repo: git filter-branch --commit-filter 'GIT_AUTHOR_NAME="username"; GIT_AUTHOR_EMAIL="email"; git commit-tree "$@";' HEAD now Github counts the new commits but the old ones are not counted. ...