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

Session within components

Should I be passing the session from my page down to my components or using the useSession() hook within my component. What is the standard or best practice of doing this?

@next/mdx with slug in app dir

Doing some experimentation with the app directory, and I’m curious if anyone has seen or can find documentation for how to do dynamic slugs for posts within the app directory using @next/mdx to fetch content? So that /blog/dynamic-slug would fetch the right MDX doc. Should I just opt for contentlayer instead?

trpc call that doesn't use prisma

Hi, I need create a trpc endpoint that just calls openAI api. Is it possible to do this in an endpoint with using prisma? What does it look like?

T3 unable to find schema.prisma in turbo repo

When I run the monorepo or even just the nextjs site, I run into this error " Error: Your schema.prisma could not be found, and we detected that you are using Next.js.". Here is a link to the repo. The nextjs application is under /apps/web, the prisma stuff is in /packages/db, and the trpc api is in /packages/api Here is the repo -> https://github.com/HelixHEX/bettrdash-cloud/tree/web-migration...

Has anyone created a desktop application using the T3 stack?

I'd love to get some opinions on this. It would be pretty awesome if we could use RPC to perform the tasks of executing commands on the local system

Handle trailing slash in NextJS API routes?

I'm trying to create an integration to Fibery through NextJS's API routes, but Fibery's integration engine seems to send one request to api/integration/ (trailing slash) and some to api/integration/schema etc, which I can't make work with the API dir. πŸ˜„ Any way to force index.ts in API route to handle both the trailing slash and without?

Rate Limit in Next Middleware or TRPC Middleware

What do you think is the best way to rate limit your app with t3 stack. To me rate limit in next middleware seems much more efficient and logic, since you are on the edge and all of your app traffic is going trough there (static, pages, api, etc..) But, on the other hands, rate limiting your API with different procedures, for different scope comes with a cleaner organization imo. ...

Best practice to re-route user if no session exists with t3

Hi! What’s the best practice to re-route users when they arent signed in? I see a lot of examples where they use like useSession() inside of each component. But I would like the users who doesnt have a session yet to be presented with a landing page about the product....

Hi guys! So I'm planning to buy a domain from vercel like app.co

Hi guys! So I'm planning to buy a domain from vercel like app.co, I was confused how I'm going to be able to have dog@app.co but I'm confused since vercel does not provide email services, where do you guys usually do this? THank you for your help!

Conditional trpc hook query

When calling a trpc hook, is there a way to only make it call, if the input is validated client side? Im using zod on server side. But sometimes it takes some time on client side before the data is valid. Example: ```TypeScript...

Error validating datasource `db`: the URL must start with the protocol `file:`

error when I run prisma db pull: `` Error: Prisma schema validation - (get-config wasm) Error code: P1012 error: Error validating datasource db: the URL must start with the protocol file:`....

TRPC clerk middleware error in middleware.ts

Following along with the t3 stack tutorial and getting an error in the terminal even though i have defiend the withClerkMiddleware function inside my middleware.ts...

useSession must be wrapped in a <SessionProvider />

pages/_app.tsx ```tsx // pages/_app.tsx export type NextPageWithLayout = NextPage & { getLayout?: (page: ReactElement) => ReactNode;...

Integrating a Python endpoint in the t3 stack

Is it possible to integrate a Python endpoint in the t3 stack? I need a Python endpoint because the package that I wanna use is an AI one and currently unavailable in JS/TS.

best way to conditionally show a logo on black or white depending on which nextjs page?

not sure how high it should be in component hierarchy while maintaining visual consistency/being inline with other elements?

Anybody managed to get trpc to work with aws websocket api ?

Trying to see how hard it would be to implement it vs pusher or pubnub.

how to absolute URLs using fetch in next 13?

This is how i wanna use the fetch:
const api_endpoint = "http://localhost:3000"
const api_endpoint = "http://localhost:3000"
...

go like async channels in node

What are some of the good options to have go like channels in node. So far I have used, 1. https://www.npmjs.com/package/async-channel (facing weird bugs -- unhandled promise rejection randomly, not sure if it's a bug in my code or the library itself, need more time investigating). 2. Implemented something with eventemitter and async iterator. 3, Briefly tried to implement it using Node streams but it got too complex for what i think should be simple. Also was not sure how to make it work with typescript. 4. Saw this, https://deno.land/x/async_channels@v1.0.0-rc8...

Deployment to Vercel fails

Hey all i am going through this video: https://www.youtube.com/watch?v=YkOSUVzOAA4 I am failing right in the beginning. I have made the changes to the schema.prisma. Also i have added the environment variable to the Vercel project settings. If i execute "npm run dev" everything works fine locally. Also "npx prisma db push" and "npx prisma studio". But when i deploy to Vercel i run into this error. Anyone has in idea what i am doing wrong?...

trpc alternatives like zodios, ts-rest

I am using TRPC and really liking the developer experience. I recently got to know about zodios, ts-rest etc. I believe they provide a similar experience but play along more nicely with normal REST api conventions. To use TRPC endpoints from non-typescript backends, we would need to use something like OpenApi adapters. I don't know if the adapters are stable. What are your thoughts on this ? The feeling that i get about these new alternatives is along the lines of, anything that uses a lot of typescript inference will eventually run into scale problems. (slow inference, needing to restart typescript). I even saw some github issues mentioning the typescript inference limit was reached or something....