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

Is there a recommended React library that handles a live chat UI/UX?

For example, I can just feed it some data and it can output the chat bubbles and handle scrolling, lazy loading, infinite scrolling etc.

Is there a way to use the trpc client inside a useEffect? Or a separate "service".

I've been using trpc for quite a while now. I have a pretty simple data flow that seems overly complicated to implement in trpc. In my website, when you go to "mywebsite.com/local" I want to fetch from local storage, but when you got to mywebsite.com/<anythingelse> I want to fetch from a trpc API. ...

getStaticProps & SSG helper data still being fetched on client.

Hello ya'll, my first time working on a new project using the T3 stack. Like it a lot so far. I'm a bit stumped after trying to pre-fetch data for a static page though. After looking through guides for SSG helpers, my assumption would be that the following code should work...

Modifying docs on an Open Source project

So, I've never really messed around with the docs part of Next, and I'm trying to understand how things working looking at https://github.com/vercel-labs/ai I think I lack fundamental understanding of building tools/libraries like this, so my question is: I cloned the repository and ran it as dev, but then I realized I have no idea on how to, or even if possible, to access the documentation locally. I tried localhost:3000/docs but it's a 404 Like I said, I lack understanding of this, but if anyone could help me see what I'm doing wrong, it'd help...

Upload image from server to uploadthing

Hello! My image is generated on the server, from user text input. Is it possible to upload the image directly from the server to uploadthing? It looks like to me uploadthing is only really used for users to upload, not the server?...

Custom Headers Nextjs13

Hello, What is the correct way to access this custom header in next13? Accessing the request.headers.secret used to work this way prior to updating but it is now undefined. I can see the value when I log request.headers as well as when I log my API_ROUTE_SECRET...

`bcrypt` fails on installation with `node_modules`

Installation with existing node_modules directory fails with Cannot find module '../lib/main' Hello 🙂 I'm encountering an issue with the bcrypt package. I have a turborepo/monorepo with an api package and other apps. The package depends on bcrypt. Every time I want to add a new dependency to any app/package I have to remove the root node_modules folder and only then can I install it - reinstallation / adding a new package causes the error below:...

How to keep local changes after reloading webpage

I just want to change some thumbnails on the youtube home page for a joke, but when I change the thumbnails src to another image, I just get the small image not found box. Any easy way to fix this?...

Prisma 2-3 levels deep queries

Hey, I'm building an app, where I need to get "friends of friends" data. Like for example, I query "target" user friends first and get a list of user IDs. Then I need to query every user ID in that list and get the same structured list, but of all the friends of friends combined. How can I do this?...

Migrate django application to nextjs

I want to migrate an old django application to nextjs incrementally, and I struggle to have the same behavior with my URLS. Is there any option to provide to next.config.mjs so next doesn't change the URL at all, and doesn't try to add or remove slashes? ...

Prisma Data Proxy vs Drizzle

Has anyone tried Prisma's data proxy? I'm currently just using Prisma regularly and it takes ~ 3 - 5 seconds to fetch a simple array from my DB and it's extremely inconsistent with response times varying, I use nextJS to write my API call ``` export async function GET(request: Request) { try { const url = new URL(request.url);...

Build auth apis with next.js using trcp

Greetings I've been working on trcp for a while and I really like it. I tried to do authentication using next-auth and it was amazing but I had a little problem. The app I've built is using Next, Prisma, next-auth. I can easily use next-auth for web authentication, but what I want is to use authentication with is the mobile app (react-native)...

Can Prisma handle 1000 users?

I am curious if should I use prisma if performance and speed is my priority? what happens if 1000 user make request simultaneously?

shadcn ui table component with dialog.

Hello im wondering if anyone has tried to implement a table row to act as a dialog trigger so i can open dialogs through each item in the table component
Solution:
Hello im wondering if anyone has tried to implement a table row to act as a dialog trigger so i can open dialogs through each item in the table component

TypeScript problem

Hello, doing library code, took inspiration from ts-rest and trpc. I have problem, my input and output types are any. How could I make it so that those would be correct? https://tsplay.dev/WJpnlN Here my old version where it worked if it helps:...

Make UploadThing files downloadable

Hey everyone. Pretty new to file uploading and all that. Currently have UploadThing up and running, and I am trying to make files uploaded by certain users downloadable for everyone. Anyone know the best way to go about this? Is it possible? Is there a good a article/youtube video and take a look at? Thanks.

Zod array with valid values

How can I make a zod array with certain valid values. I know I could do this with refine, but generally try to avoid that if possible to get better types. Thanks!...
Solution:
This seems to work 👍
z.array(z.union([z.literal("NY"), z.literal("FL")]))
z.array(z.union([z.literal("NY"), z.literal("FL")]))
...

Upgrade TRPC to appdir

How can i upgrade the api handler trpc?

How to add a form to "new-user" page after user signed in via provider

I want to force user to provide a username in "new-user" page and if user leaves the page, provide a default value "user[userId]". Is there a better way to do it? For example, events, i've tried to do it using events, but it didn't work...

Typed API contract builder

I've external third party API which doesn't expose any types (no typescript compatible). I would like to be able to define type safe contracts for that API so body, query params, response type etc. is all type safe. Ideally it should be based/wrapped on fetch or implemented with https://github.com/elbywan/wretch or https://github.com/unjs/ofetch. This won't be exposed for anyone. It will be used only internally and only on the backend side so no need for any browser compatibilty. I just want an easy type safe way to define input/outputs and use it from within my express/trpc calls ...