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

tRPC router refreshes and gives 429 HTTP error

I am implementing a new "endpoint" as from what I have understood. The tRPC looks like the following: ```TS export const openai = new OpenAIApi(configuration); const getStory = async (storySummary: string, title: string) => {...

NextAuth CredentialProvider with T3 default Auth Prisma models limitation question.

Actually I made a sign up page using CredentialProvider using Email ID and Password. My question is, 1.) create t3 app with NextAuth has built in tables named Accounts, Session and VerificationToken. Now due to me using CredentialProvider the rest of the tables are not being used because NextAuth is limiting that intentionally. More on that here -> https://next-auth.js.org/providers/credentials Now I want to know what functionalities I am missing, and do I even need those? Because my cookies are being created in the browser and useSession is also working fine. 2.) Also please tell me if I can delete the tables which are not being used in the prisma schema made by create t3 app....

t3 turbo repo with drizzle

Hi everyone just wondering if anyone has been able to take out prisma from the turbo repo t3 app and replaced it with drizzle yet? I was playing with it earlier but hitting a brick wall when I got to pushing the db and the build process was just not having it....

Do I need the redirect callback here?

Hi! I was try to send the user to the /home uri after the sign in workflow, but saw that I can do that with the redirect callback. I did read in the docs thought that I can just add the options for { callbackUrl: "http://localhost:3000/home" } in my signin() callback. So I was wondering do I even need the redirect callback declared in my auth.ts file? Code for Client: ```...

trpc and event streams

As the title says really, I'm looking to implement my own chat gpt (surprise surprise) and I'd like it to write the response into UI in chunks. Has anyone found a nice solution, does trpc supports streams (as far as I know it's not really possible) I could replace it with WebSocket but I'd prefer Event Streams....

findUnique from current user

Hi, I would like to get 1 entry by id, but only if the entry belongs to the current user. Is that possible with findUnique or do I have to use find findMany or findFirst? Example:...

TS - how to extract type from Picked array

I have the following type: ``` type ChallengeInput = { title: string,...

Routing patterns

Context My app has a thing called spaces where you can access multiple tabs like "Tasks", "Journeys", etc. The route for a space is /spaces/:id. I am using headless UI tabs to show the different tabs in a space. As of now I do not have a route defined for each tab. I did not foresee the need to be able to go to a tab directly through navigation but I now need to. For example, I need to be able to go to a space and in the space to the journey tab (which is the second tab) directly from somewhere else. The default behavior is to render the first tab as the selected tab. ...

typedefs for useState across components with object arrays

We have a Parent and a Child component. inside of parent we init the following state: ```tsx const [objects, setObjects] = useState<...

Migrate prisma on deploy

Is there any way to automatically run migrations when deploying to vercel?

How to define an async procedure?

```ts export const exampleRouter = createTRPCRouter({ hello: publicProcedure .input(z.object({ text: z.string() })) .query(({ input }) => {...

any tips for styling mobile and desktop

I'm full stack, but css isn't my strong suit. I just finished my deployment pipeline. Now it's time to create some components. Are there any easy ways to make sure my website looks good on mobile and desktop?...

What is the convention for customizing sign-in pages in NextAuth

Is there any example of custom pages for NextAuth authentication, something that I can follow the similar setup from as with my generated T3 app? Bear in my mind I did read the NextAuth documentation - but I am still having trouble with figuring out why the setup as they described won't work, and I think it must have something to do with how the server and client structure is setup. I followed this example:...

How to create new tRPC api route calling external api

Hi I have this app where I want to add a new prompt api route in server/api/routers/prompt.ts of the generated T3 app with all modules selected on install. The code I'm trying to run: ```TS import { z } from "zod";...

webhooks | clerk turbo repo | createCaller | Cannot set headers after they are sent to the client

```import { Webhook } from "svix"; import { buffer } from "micro"; import { ClerkResponse } from "../../../../utils/clerk"; import { trpc } from "../../../../utils/trpc"; import { PrismaClient } from "@acme/db";...

My project got pretty slow

I migrated my whole project to app folder, trpc, prisma, chakra-ui. The development got pretty slow, every dev has the newest m1 macbooks with 32gb ram. Are there any patterns that we should avoid? Should we seperate types somehow to make the performance better? Any tips are welcome. We are using t3stack starter...

getById from current user

Hi, its my first time using tRCP and I would like to ask how I can get something by id from the current user. ```ts import { z } from "zod"; import {...

react-native-web with existing web and mobile app

lets say you have a SPA web app with reactjs and a mobile app with react-native already with different state management and navigation across the two projects. you want to push for unified code between the two with react-native-web. how would you incrementally adopt react-native-web with these two projects. would you need a third project to develop net new features / interfaces in react-native-web where the interfaces are state and routing agnostic? this would be sort of a library that you use i...

No tRPC requests after integrating Clerk

I integrated Clerk according to the docs and removed next-auth stuff. But now no trpc requests are being made anymore?? If I log in the [trpc].ts request handler I don't see anything in the console. Does clerk block this somehow? Super confused.
Solution:
I integrated Clerk according to the docs and removed next-auth stuff. But now no trpc requests are being made anymore?? If I log in the [trpc].ts request handler I don't see anything in the console. Does clerk block this somehow? Super confused.

Zod - instanceof z.ZodError

```ts try { coursePOST.body.parse(requestBody); } catch (error) { if (error instanceof z.ZodError) {...