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 to automatically sign-in user in after they click a verify email link sent to their email inbox?

Once a user registers an account, the page prompts them to click the link in the email sent to them. How can I make that link automatically log them in? Is this possible, or would they still have to log in manually after verifying their email? One idea i had was to "pseudo" sign them in upon registration, and then them clicking on the verify link re-validates the registration page, giving them full access.
Is there a better way to do this?...

Does anyone knows how Ping.gg works? (Conversation sidelined)

I mean is it built entirely with TypeScript? And how the underlying infrastructure works for Ping.gg?

How to display register/signin errors on the client from a server action?

I'm using a server action on a register page to conditionally create db entries for a new user, and send out a verification email. My question is: How can I display an error on the register form like: "that username is already taken," based on the internal logic of the server action. Attached are my form and the server action respectively...
No description

depends_on alternative docker swarm

Using docker swarm for deployment where I'm using the docker-compose file I made before. Previoulsy it had a depends_on directive where I can specify nginx to not start before the api_serivce. Running in swarm it seems it ignores depends_on completely is there any alternative?

Array<string> vs Record<key, true>?

So, this is a call for mental help lol. First this is a taste question, is not a necesary question and is clearly a dum question, but i wanna ask any way. In my lastest months i been working usually in backend stuff, and primary using Prisma for schema and some queries, because is VPS not serverless, Kysely for some complex queries, and Zod for validation (DTO and others stuffs). All is good, everything work perfectly (ignoring the lack of some query functionalities in Prisma). But there is something that really BOTHER me when i read the code. For example when picking fields in a prisma query, you do a something like this: ...
No description

tailwind linter giving me a wrong warning?

how would i go about combining this in tailwind? its giving me the warning of them being the same value but theyre not? negative y translate is not the same as positive x translate or am i tripping (im trying to make it go right and up, which works)
No description

Regular Hexagon Plane using BufferGeometry in React Three Fiber

Pretty self explanatory but i can't seem to wrap my head around this one last bit. I have all the math for the vertices properly done but it seems like there's just this middle bit missing and I can't for the life of me figure out why (image attached) https://i-work-at-the.cocaine.institute/Lizzy64dd1efeWvDArpZ3jKuW.png My code for the HexTile component: ```tsx import { ThreeElements } from "@react-three/fiber";...

t3-env is giving error module is not defined in ES module scope

i am trying to add t3-env in my project and it is giving me error ```js - error Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error
Build error occurred...

Deploying to Vercel - now errors with build and dev part 2

This is part 2, the error message ==== This is the output running either pnpm dev or build - info Loaded env from /Users/isrd1/Dropbox/web/react/t3/blog-t3-app2/.env.local - info Loaded env from /Users/isrd1/Dropbox/web/react/t3/blog-t3-app2/.env āŒ Invalid environment variables: { NEXTAUTH_URL: [ 'String must contain at least 1 character(s)' ] }...

Deploying to Vercel - now errors with build and dev part 1

I've been developing a T3 app, using first MySQL in Docker and then Postgres in Docker without any problems or errors. But I finally got around to trying to deply to Vercel, something I should have been doing from the start but hey ho.
The setup seemed straightforward but, having followed the vercel setup instructions and imported the .env, .env.local and .env.development.local I now get errors when I run pnpm dev or pnpm build. Both complain that there are invalid environmental variables, NEXTAUTH_URL, even though that variable is there and it was working fine before the import of other variables. Might anyone know the cause of the problem please? Post split into two parts ==== this is the made safe for publishing version of my .env files...

Combining tRPC and Nextjs13 Suspense

Hi there Did somebody succeed using Nextjs 13 App Routing Suspense features, like loading.tsx and tRPC? So far, tRPC returns isLoading or isFetching (please don't discuss this point, they're just handfull flags for such generic question). By using these flags we can manually return Loading UI components, but I don't see the way combining tRPC and Suspense react's component. Nor with the loading.tsx server component *. * I tried with experimental useSuspenseQuery on a page.tsx file and I could detect the loading.tsx content, but it seemed that the query was cached and therefore it no longer appeared after refreshing the page....

Use next-international without converting page.tsx or layout.tsx into client components

I'm trying to use next-international but in their github readme https://github.com/QuiiBz/next-international#app-router they suggest wrapping the lowest app file with I18nProviderClient which needs the page.tsx file to be a client component. I don't want to convert it to a client component.

Can t3 app be deployed on a traditional server and a tradition database?

I kind of fear being locked into these solutions like planelscale, vercel, clerk etc. So, in case if I am not satisfied with my applications with these services, can I just simply move out? Or do I have to create the whole thing from the start again. please forgive me for my dumbness theowat

Github Oauth not triggering

just created a new t3 app and removed discord oauth provider and added github oauth provider. Then i tried running npm run build and i got this error - info Loaded env from /home/susant/t3-ecommerce/.env āŒ Invalid environment variables: {...
Solution:
ahh. then you should remove the DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET from env.mjs. both from the server and runtimeEnv property

T3 BETA - how to query on client side?

I am using t3-app@7.13.2-beta.ca0b017 with nexjs 13. How can I make a query or a mutation on a client component? There is no /utils folder for client side queries/mutation hooks....

React-Hook-Form Issue

I attached the code, there is no errors, it just seems the handleformsubmit function isn't firing, and idk why

How to access another item in a zod object

For example If condition.type is X I want the ID to be required Is this possible to do this in the side zod...
No description

trpc useMutation ?

I am confused where is the useMutation coming from
Solution:
Sorry, I figured it out

Logging / Metrics Best Practices?

What are some recommendation for logging and/or outputting metrics in a frontend application? My tech stack is as follows: - NextJs w/ Typescript - Supabase - Vercel...

SQL Querying Best Practices?

Just want to discuss query best practices. I using drizzle here but I'm just talking about SQL in general. ```ts const userAccount = await db.query.accounts.findFirst({ where: eq(accounts.id, userId), with: {...