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

tips on getting file sizes down in a nextjs 13 project?

things are getting preeeeetttyyyyy heftyyyy in my big project ```json // package.json "dependencies": {...

What's everyone using for implementing google sso?

We have a vite app where we manage user sessions in a django backend - need to replace react-google-login. Open to suggestions!

What is an effective way to proxy your backend API? (NextJS)

Currently all my queries go through the client server which calls my backend API. It seems a bit ineffective and not enjoyable to do (code duplication / manual route work) The goal is for that extra security and external backend API obscurity. (DDOS attacks, etc)...

Next Font showing ts errors

my next font is showing typescript errors, it seems to be used how they do it in the docs. Any ideas?

wrapping a generic function in typescript

i'm trying to write a wrapper to automatically handle loading state when necessary. my idea is to wrap my function definitions in this function busyable which then returns a function that precedes and succeeds the callback passed in by toggling busy state. something like this: ```ts const busyable = (fn: (...args: any) => Promise<void>) => { return async (...args: any) => { busy = true; await fn(...args);...

is it problem to install next-auth by hand?

while I was installing t3-app i didnt have in my mind to use next-auth and then realized i have to use it now so will it be problem to install it by hand? I am asking that because when I created api directory and tried to make GET request I get page not found

Docker & Nginx - ports

Hi, I am running Docker containers on my VPS and I'd like to deploy there an API with Nginx config. Nginx uses by default ports 80 and 443, but those ports are already taken by Nginx which is running in non docker environment. Can I run another nginx (in docker) on this VPS if those ports are taken?...

Does React Context/Providers inherently cause lower perf or only if it reloads a lot of components?

I'm creating a Switch component and want to pass the enabled state to the thumb component via a Provider. For some reason I have this belief that using Providers are a heavy solution that causes performance issues, but maybe that's only when it's at the top of the app and causes a ton of components to rerender. If I use a Provider in a switch, and say there are like 10-20 switches in a form, will that inherently cause performance issues because of all the context and providers created, or is a provider just another tool and it's fine to use if it doesn't rerender a hundred components on change?...

Using CASL with the T3 Stack

Look at https://github.com/stalniy/casl it seems quite cool, is it just a case of following the Prisma documentation? Or does anyone else have a good way of managing permissions?

whathow do you document your t3 stack backend procedures

I usually use inline comments then vs code hovering on the procedures brings it out but i feel it is unprofessional And postman documentation type approach or what do you use?...

Bulma vs. TailwindCss

Anybody who used Bulma before? if so would it be a good alternative to Tailwind CSS which I quite like? https://bulma.io...

QStash and signing keys

I've recently started using QStash inside a Next.js project and I am not too familiar with the concept or "rolling signing keys" as underlined here: https://docs.upstash.com/qstash/howto/roll-signing-keys Is it mandatory, like, will the keys expire at some point? I do not use the service client-side, only through server code so if I can avoid to do so all the better. Also if it is mandatory, can I just run the Vercel API in my API route to "roll it"?...

I have an infinite loop within my hook but app works as expected, i'm confused...

when i console log inside this hook, it repeats non-stop every few seconds, but my app is working as expected there is no infinite loop per say. i'm really confused with this one. ```js import zustand from ... ...

Nested Params

Trying to get a nested param variable rn Have ``` [slug]...

`window.scrollY` error `typescript`

I'm trying to get the position of the webpage and use it as a condition to run some command if the condition is met. ```const getScroll = () => { const check = window.scrollY; // If I set the type here to HTMLElement the condition below here becomes invalid because check can't be compared to a number. if (check >= 100) {...

Why am I getting cert_date_invalid when using the www. version of my domain (vercel)

Why am I getting cert_date_invalid when using the www. version of my domain (vercel)

NextAuth: Cannot login with CredentialsProvider

I'm currently developing my web app using the full-featured t3 app, and I don't want to connect to the real provider while developing. (Since there are roles and it's much better if I can switch my role during development directly on my UI) According to the answer of the following GitHub issue and a side note from t3-app docs, I added a credential provider in the authOptions object inside src/api/auth/[...nextauth].ts with some hardcoded users. https://github.com/nextauthjs/next-auth/issues/5587...

Hydration failed because the initial UI does not match what was rendered on the server

This only happens when I try to put a <figure> element inside of a paragraph, nextjs

How do you run `primsa` commands in a `create-t3-turbo` monorepo?

I can run pnpm db-push but I would like to run other commands, like prisma migrate. I can't figure out how to do this

Ternary statements with possible null/undefined

I am working with an object with the following shape:
{ image: string, previewImg: number }
{ image: string, previewImg: number }
images is just a string with UUIDs separated by commas. If the UUID is for a video they are prefixed with "video-". ...