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

Initiating another prisma client for SSR

I closed my project, opened it up again and got an error on prisma.etc. On my page that does SSR. I have since added the prisma client on that page. Initiated it, now it's working. Then i deleted it, shut down my project and spun it up again and it's working fine. What is this magic? /code ...

T3-APP + NextJS app/directory

Hello Guys I am glad to be here ! I was if someone knows if they are going to use the new app directory, i tried to migrate but didn't work 😦

Query external API and store in database

Hi all, I would like to store into the database of my app some information that I periodically pull from an external API. The plan is: - create an plain Next.js API endpoint...

createServerSideHelpers

Hello everyone, I would like create a createServerSideHelpers in getServerSideProps for fetch data on the server, but for create the createServerSideHelpers object I need to send the context. I create data in context from trpc (site and cookies), how I can call them in ctx prop of createServerSideHelpers? thanks in advance...

do you use ChatGPT or not anymore?

I have a feeling that I am falling behind because I don't use chatgpt. How can I amplify my skills by using chatgpt?

Next.js vs competing frameworks

Hello, is there any point in learing other frameworks than Next.js, such as SvelteKit or Nuxt to advance in the job market? I've been using Next.js for a few years, and I just tried out SvelteKit finding it okay, but is there any point for me in learning any other frameworks than Next.js - other than general learning and expanding horizons? Or would it be more beneficial to just get really good at Next.js and ignore the competition (as long as the next.js marketshare is superior)?...

next-auth with react query

Hey all, I have a question, not quite specific to t3-app but more general, I am working with next 13 pages dir, but I am trying to use some suspense capabilities from react-query, however I noticed that when working with next-auth, i was getting error of hydration, at first thought it was because of react-query and then after some time and asking in the react-query discord found out that the issue was with next-auth, i've created an issue on the next auth repo and it was moved to disscusion http...

Prisma - Error: P1001

Prisma is acting up. Select queries are perfectly fine, however if i try to run a migration it says Error: P1001...

Login data saved to database without explicit code - NextAuth, Prisma, and TRPC

I'm currently working on a T3 stack project, using NextAuth for authentication, Prisma as the ORM, and TRPC for API communication. I've set up the environment and Prisma client successfully. I encountered a peculiar issue while implementing the GitHub provider for login functionality. It seems like everything is working fine, as I can log in with GitHub successfully. However, when I checked the database using Prisma Studio, I noticed that the login information, including user, account, and session data, is being saved to the database. The confusing part is that I haven't explicitly written any code in the authentication configuration to save this data to the database. I expected NextAuth to handle the authentication process, but I didn't expect it to automatically persist the login data in the database....

Lets Talk about State Management

Hey everyone! I've recently developed my first relatively large application with T3 and started using Zustand for state management. I'm curious to learn about the best practices for state management and when it's appropriate to use local state (e.g., useState) versus Zustand. Up until now, I've been using Zustand to avoid prop drilling and manage state across multiple components, and it's been working great. However, I haven't clearly defined in my mind when to choose between local state and Zustand. Any tips would be greatly appreciated! Also i'm curious as to how updating the state management works with rebuilding and pushing projects. Is it just something that is taken care of in the background?...

using Icon and getServerSideProps throws an error

is this a bug or an Error? ```"use client" import Layout from "@/components/dashboard/Layout"; import { PasienPlusPage } from "@/pages/_app"; import { getServerAuthSession } from "@/server/auth";...

How do React Server Components fit into the T3 stack?

Hey there, I'm considering the T3 stack for my next project (basically a dashboard full-stack web app), because I like the idea of using NextJS as a full-stack framework. It seems to make more sense in my use case than having the front-end and the back-end as two separate projects. I'm just really confused about tRPC, RSC, and how they fit together. React Server Components are now the default in NextJS, so does that mean that tRPC is no longer necessary?...

3rd Party Application

Anyone know a good approach to allow 3rd party applications to request authorization to this architecture, allow the user to approve permissions and issue credentials to the 3rd party application via normal oAuth standards? Basically trying to integrate the T3 stack into a Zappier app....

How can I get the input field values from formData (using Next form action)

I’m probably missing something here, but I thought that formData.get(inputId) would work 🫠 Here’s is the code from a basic form I’ve just written to play around: ```...

Your experience with T3 for Mobile dev

I haven't heard much about T3 Stack being used for Mobile dev. Is it a good idea to use it? I love ReactJs but I honestly hate React Native. I want to learn Mobile dev but flutter is pain to setup sometimes. Plus I don't want to learn different languages for IOS and Android dev. I would like to be able to make mobile apps with NextJs. What's your experience? What should I do?

Does it make sense to use tRPC without a frontend?

This may be a stupid question, but… I’m adding new API endpoints to an existing express application, and I’m interested in using tRPC. The problem is that it doesn’t interact with a frontend, so I question if it’s worth using tRPC in the first place. Thoughts?...
Solution:
not necessarily, if you like the DX of trpc backend to creating the routes & procedures & testing. It makes sense to use the trpc server still. you can even just go with next, express, fastify or node

What is the best way to handle a caching layer?

Hey, I am currently using upstash redis to cache one of my queries. However since using a cache in my router folder, I have to create a temporary interface to make typescript happy with the output as I cannot infer the types from the router. Just wondering, what is the best approach for something like this. Cheers! ```...

t3-turbo with tailwind and ui package gives error

I am getting this error after doing pnpm dev and then going to localhost page

Error: Socket connection timeout

Anyone else having issues with "Socket connection timeout"? It happens intermittently, but very often. I've tried multiple node versions, changing ports, multiple browsers, deleting the .next, node_modules, and package-lock.json. This is on a base t3 app (nothing changed).

How to Stream responses when using Langchain in the new route handlers

Im trying to build a ChatGPT app using langchain, but I cant figure out how to stream the responses to the client. This is how I have initialized openai with langchain ```ts import { ChatOpenAI } from "langchain/chat_models/openai";...