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

How do I prefetch trpc serverside and then hydrate the client?

Wondering how to do this with the t3 stack. Haven’t found anything in the docs about how to prefetch on server and then hydrate the client from then on! Any hints, links or repos?

Could token count be added to t3.chat?

Tried to ask on Theo's most recent video, youtube's auto mod deleted my comment because I put "t3.chat" in my comment. The details on what I'm asking here, is about adding marginal costs to each of the AI models with tokens, so that people using too much Claude output doesn't hurt you guys. It would also be super awesome to see how many tokens have been used in the chat, so that those of us who prompt a lot, are able to see when we're reaching our limits. Please, t3's been the best thing that's happened to me since Claude Sonnet. Don't want anything bad to happen to the quality of life....

Migrating from a Create Next App to TurboRepo

Hi, does someone have an extensive guide or video of how to migrate to TurboRepo? I'm new in TurboRepo and I'm kinda lost. I read some blogs but they only move the entire folder into an app and I'm not sure if this is right. What happends then to the prettier/eslint/other config files?

uploadthing in vercel serverless function

Can some help out with out to do this in vercel? It works locally, but File isn't going to work in a serverless function although I did try. I'm trying to debug something and my last attempt before I tear my hair out is to upload some screenshots from puppeteer so I can see why the page state is different in this particular scenario. I just need the data format to work in a serverless function and none of my AI friends have been able to help me out. ``` await page.goto(targetUrl) const screenshot = await page.screenshot({...

how do i prevent duplication of rows in my friends table ?

i am working on adding friends feature in my application i am using mysql database , with prisma orm i have a friends table and a users table as the name implies the user table stores the users , friends stores friend records the schema of both tables are as follows ```model Users { id
username
email ...

Dependent select boxes in form

I'm using TanStack Query to fetch a configuration from an API. Once fetched, I'd like to populate two select boxes with the first available configuration in the response. options is an alias for the data returned by useQuery. Both vehicle_type and validity are initially set to "" (empty string)....

AWS Amplify

I want to deploy my T3 stack app on AWS Aplify. It builds as normal but when i visit the deploy link it says "Internal Server Error". here is my YAML file and build log as well. what could be the problem
No description

How to use uploadthing using REST APIs?

I was able to create presigned URL using /v7/prepareUpload and then when i use curl -X PUT --data "@filename" "presignedURL" I am getting this error {"statusCode":415,"code":"FST_ERR_CTP_INVALID_MEDIA_TYPE","error":"Unsupported Media Type","message":"Unsupported Media Type: application/x-www-form-urlencoded"} ...
Solution:
Solved it by using v6 APIs
No description

Uploaded Files Returning utfs.io URLs Instead of ufs.sh

Hey everyone, I'm using UploadThing for image uploads in my project. According to the documentation, files should be served from:
https://<APP_ID>.ufs.sh/f/<FILE_KEY>
https://<APP_ID>.ufs.sh/f/<FILE_KEY>
However, when I upload a file, the response only includes URLs in the https://utfs.io/f/ format. Example response:...

create t3 app build error

Hey, The default config for create t3 app, with the following installs: prisma tailwind...

AWS Elastic Beanstalk

i am trying to deploy my application on AWS Elastic Beanstalk, but i am getting this error and it does not work. what am i doing wrong. to upload the project i compressed the T3 app without the node modules.
No description

Looking for someone to help me implement Directus and Authjs (next-auth v5) and refresh tokens

Hey there, I am positively ripping my hair out :) I have yet to find anyone to help me with this issue nor any guide or docs that helps it either. If you've not heard of Directus it's a headless CMS with lots of fun databasing tools. It's basically supabase or prisma but with more emphasis on low-to-no code. However, many silly people like myself use it as a sort of backend to nextjs. So we can develop nice webapps for internal tools but also have no-code users be able to interact with the data through a flash CMS backend app. HOWEVER, for the absolute life of me I cannot understand why I cannot build a nextjs/t3-stack app that successfully refreshes the user's session through refresh tokens. I have read all possible docs thousands of times and even dug into the source code and I just can't understand it. ...

How to create a GitHub Action that upload assets to a existing/new release?

I am working on a C# project and trying to create a GitHub Action that handles building project, creating a zip and then uploading it to a existing release.
Solution:
Thank You @Utilyre So much. Got it running. Didn't used any of pre-built actions instead just used gh cli, to upload binaries in existing release. makes it way similar. But still, thank you replying and helping....

Dynamic pages issue on server pages

I just joined an org which uses ftp, cpanel, for the server and normally they create out folder and put it on the server but due to server side dynamic pages not being supported we are unable to host it as it's throwing error. we installed node to solve this but it still doesn't work. What should be the way to go about this?

UploadThing file accept type restriction

I'm trying to find how I can allow the <UploadButton /> to only accept images for example with extensions of (.png, .jpg ...etc). Because currently my users are able to upload .gif for example and I don't want to allow that. I searched the docs but there is nothing regarding image type restriction or acceptation. Unless I missed something......
Solution:
Thanks that solves it for me. However if I used this I wont be able to set maxFileSize and maxFileCount ```tsx...

Create 10,000 dummy React Views (Windows 11)

Does anyone know how to create a batch script to create dummy views. Just need 10,000 files with the pattern of something like View$i.tsx and then content is just random HTML that is 100KB in size. It's a weird set of requirements but is needed for performance testing.
Solution:
this worked ```cmd
"View!fileNum!.tsx" echo export const testFunction!fileNum! = ^(^) =^> {
>> "View!fileNum!.tsx" echo return ( >> "View!fileNum!.tsx" echo ^<div^>...

Stripe integration

Trying to follow Theos Stripe tutorial, turns out I got some skill issues and not understanding the kv setup as I haven't done this before. Can anyone please assist in the setup of it?

Best Way to Model Integrations in Postgres?

Hey everyone, I need advice on modeling data for a system with multiple integrations. Currently, I plan to support 4-5 integrations (e.g., BigCommerce, Shopify), each requiring unique information like API keys. For now, an organization can only have one integration, but I want to design the model so it’s easy to expand to multiple integrations per organization in the future. I’m using Postgres and wondering about the best practices for structuring this. How should I model these integrations to handle their unique data while keeping things scalable and maintainable? Any suggestions or examples would be greatly appreciated!...

whats the best database to use (like sql, postgress and those stuff)

the topic basically
Solution:
sqlite for simplicity and portability, postgres and mysql if you need scale, like huge scale. The difference between postgres and mysql isn't worth looking into if you're still new