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

Authenicating API routes to be only be request by same-origin Nextjs 13

So i am looking to lock down some of my API routes to be only requested by my domain and any subdomains but not any other person that might try to do the same. How would i do something like this in Nextjs 13 app router?...

How To Reduce Bundle Size For Edge?

Error: The Edge Function "index" size is 1.08 MB and your plan size limit is 1 MB. What function is "index"? Does that mean my route "/" is too big? But none of my route is even close to 1mb. Does it just add every route together?...
No description

Signup & Next Auth

Hey all! I'm new to sign up and Next Auth and had a question about handling both. I'm using T3 Stack for my app and have a signup form setup and working. I'm wondering when it comes to signin, I query the DB with the user input, if successful should I be using Next Auth Email Provider or Credentials Provider? There are a ton of guides out there for Next Auth but pretty much all of them cover OAuth and not handling email/password signup/login. I like the MFA provided by Next Auth Email Provider so it'd be nice to keep and and not have to build it from scratch...

MongoDB Noob question: how to add likes

Hi, so I am building a threads inspired app and would need to implement likes. Now I get CastError: Cast to ObjectId failed. I just pass the value of the MogoDB _id. does anyone know where I got it wrong ?

Hydration issue implementing getStaticProps

I switched my site over to using static generation and now I'm getting a hydration error, but only on production. When I turn off javascript and test the site everything looks good, but I'm getting errors in the console that the text doesn't match the server. Here's an abbreviated version of the code:...

Designer -> Developer Handoff

As a developer, I've always referenced Storybook for our component library. What do designers do to convert their Figma components to Tailwind components typically? Would a designer handle converting that, or a frontend developer? I've been researching tools and there doesn't seem to be anything on the market that will easily convert Figma to Tailwind....

Noob question: How to pass a string to a child component?

I used prisma to get two strings from a database, now I want to give those two strings to a client component. This is because client components cant use prisma.
I'm new to react, how can I pass these strings to the client component? I'm thinking something like this: ```...

T3 real-time / offline

I have a t3 app i made a PWA. I would like to integrate some offline first functionality but there are very few resources regarding this matter that are not - rudimentary dives into indexdb with no sync with your db - graphql solutions (aws amplify / data store , rxdb, couchdb ) Is there a way to support offline first with good database synchronization with t3 stack code base ? I enjoy the stack and would prefer to keep it vs going to a gql alternative...

how to do a passwordless login

We collect the user email and then send OTP to the mail address. How can we do that

UploadThing error: Call unsuccessful when using useUploadThing and startUpload

I am using startUpload in a next client component, when I do the server logs this error: - ┌ POST /api/uploadthing?actionType=upload&slug=imageUploader 200 in 5571ms │ └──── POST https://uploadthing.com/api/prepareUpload 200 in 5460ms (cache: MISS) ...

Deploy T3 stack on Fly.io

I get this error when i try to run fly deploy ``` #0 2.229 ❌ Invalid environment variables: { #0 2.229 DATABASE_URL: [ 'Required' ], #0 2.229 NEXTAUTH_SECRET: [ 'Required' ],...

Getting user data given their ID on Clerk

How do I get user info using their ID on Clerk? I'm using NextJS pages router....

Download individual components through the CLI

I really like how the @shadcn ui library makes its components available through the cli. Anyone have any resources on how he did that?

Custom 404 page with multiple layouts

Hi all!, i'm just trying to create a custom 404.tsx in pages router with custom layouts, one with SiteLayout and another with DashboardLayout, but i'm getting an error in the server having different render from client when i use asPath from useRouter to check if i'm in the dashboard. any help ?? ``` import type { NextPage } from "next"; import Link from "next/link";...
No description

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?