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

Syncing user 3rd party data with db (for example user's Twitter DMs)

So this is just an example, but imagine I have an app where users can log in with their Twitter account and see their Twitter DMs. I want them to be able to add a note to each conversation, so I need to sync this information to my database (when the user is offline as well). Do I just have a cron job that periodically checks for each user if they have any new DMs and then adds this to my database? I feel like I am overthinking this lol

Move a domain to Vercel??

I'm currently using namecheap to register my domain and just pointing it to vercel to manage subdomains and that kind of stuff there. And since my domain is expiring soon I'm thinking about transferring it. Does anyone have experience on transferring a domain to Vercel? I didn't find a lot in about pricing other than "registering is usually 20 bucks" so I'd love to hear what yall know/think about it. Also, any other good providers??...

Eslint and Prettier. I actually don't know where else to ask this, I'm going insane.

I actually don't understand what's going on with my eslint/prettier config. My coworker is using the same files I pushed, but he gets errors where I don't, I get errors where he doesn't. On top of that, my prettier won't prettify .ts files for whatever reason, but his will. I did add *.ts in the configs...

Prisma object undefined on mutation

My schemas look like this ``` model Idea { id String @id @default(cuid()) title String description String...

Would I Still Use T3's next-auth Setup

Hello everyone I'm trying to figure out if the t3 next-auth setup would be used in my use case scenario. Im trying to create a web app that requires no sign in or log in. The users of the site would just go onto the website and use it to buy something and get an order then thats it, no log in required. I assume that a session is required for this to save their order data just in case they accidentally close the window, other than that I would like the order data to be deleted with the session. Im not actually creating users and saving them. Im simply storing order data on the session. Would the t3 next-auth setup be used in this case?...

MUI v4 + TailwindCSS OR MUI v5?

Currently have entire dashboard in MUI v4, do you think will it be good to start mixing tailwind on top of it or just go MUI v5?

Is tRPC a good choice for typesafe communication between two backends?

(when talking about interservice and between services and "gateways/primary service", theo said)
Do not use tRPC here, you are making a mistake https://youtu.be/jd5JwXoDXFo?t=202
what other typesafe ways can this be done for between a nextjs backend and another app that's always running?...

JS Classes and This

I'm curious if there is a way to avoid using arrow functions for methods you want to keep bound to the instance. For example, ```ts class Pog{ works = () => console.log(this)...

Save foreign key prisma + trpc

Can't I just save a foreign key in this manner using trpc and prisma? ```ts const client = await prisma?.customer.create({ data: {...

How to pass TRPC (React Query) refetch() as prop to component in TypeScript?

Trying to pass the function as prop, but I can't figure out how to get the type definition from it. It's super long and I can't copy it from VSCode hover lol

Why I'm getting this TRPCClient error when navigating?

While playing t3 for a future ecommerce site I noted that when navigating between routes I get this error. The data is correctly fetched but I'm wondering why is that error showing for. Even the example.hello throws it. The repo: https://github.com/esponges/t3-ecommerce. I also noted that the queries are logged everytime that the page is focused. Is that normal? Is it really refetching or it's all cached?...

Using Mongo through Docker on Apple Silicon

Has anyone successfully run Mongo using Docker on Apple Silicon? I'm getting some weird behavior when launching a container. When I run a basic Mongo container it starts up fine, but then my prisma db push fails with the following error: ``` Error: MongoDB error SCRAM failure: Authentication failed....

535 Authentication failed 'Bad username password'

I'm setting up NextAuth with SendGrid, and when I click the link to send the auth email I get a 535 Authentication failed: Bad username / password error. I just tested it in a terminal and my sendgrid credentials are accurate and working. Any suggestions on how to debug?...

Is Capacitor + T3-Stack possible?

Hey, so im building the scheduler app for personal usage and I'd love to use Capacitor to run it on mobile (coz i kinda don't want to use ReactNative). SOOO, is it possible to build "Next" app into what Capacitor is building apps (I feel like serverside-ness of Next is what will make my life a nightmare at this project)? What are your suggestions for building this project if not with Capacitor? Thanks ❤️

Next.js dynamic route param typesafety

Is there a better solution than this? Feels annoying to do this for every dynamic route. ```ts // [userId].tsx ...

react query question

currently when fetching the current user im checking if the JWT has expired, and making a call to a route to refresh the JWT. I placed both of these in 1 query (which I think is bad practice), how can I split them up? ``` function useAuth() { return useQuery( ['user'],...

TRPC multiple mutation procedure

I have currently a formular which calls my mutation. The query should create multiple different entities, currently I am doing that this way, is this way good or is there anything would I can refactor here? ```ts import { createClientSchema } from '@/lib/zod/client-schema'; import { z } from "zod"; import { t } from "../trpc";...

Load theme from cookies without fouc

I want to load my theme from cookiees without a flash of unstyled content (nextjs), is it wise to use a synchronous script tag for this?

tRPC Subscription WebSockets can't subscribe

TRPCClientError: Unexpected request method PATCH
TRPCClientError: Unexpected request method PATCH
...

[solved] Running into build error with import even when it works locally.

Have a file Layout.tsx importing Header.tsx both in same directory, but still runs into build error.