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 css

Seriously how does one CSS? I've this idea for a lay out in my head but I'm not skilled enough in css to excute on it. Can someone please help me. Thanks for taking the time to read this. Repo link: https://github.com/mazwrld/ari (using ft/3d-me branch)...
No description

Selecting through transparent background KonvaJS

I'm making an image editor, what's the best logic or way of selecting through images with transparent background?
No description

Prisma question @default string

yo is there a @default for "user{id}" to set as the username? for example user with id 4234 -> username: user4234 ```model User { id Int @default(autoincrement()) @id...

Route handlers errors after updating

Guys anyone updated to version 13.5.2 and getting this error Expected "Response | Promise<Response>", got "Promise<NextResponse <any> | undefined>"...

How to get value from Shadcn "Select" component

Hey guys I'm mapping some categories and sub-categories over a shadcn select component in a form. My list of categories and subs is getting quite long so i want to use to Select components. I've tried a couple ways trying to get the main category name with useState to map its subcategory list into the second Select component but I'm struggling a bit. Has anyone done this before?

Using NextJS as backend for a mobile app

If you use next as your web frontend and backend and suddenly want to create a mobile app, I guess the options are to either use the next endpoints as the API for the mobile app or to create another API server in rails/fastapi/express/whatever. Let's say we decide to use NextJS as the backend for our mobile app aswell. This feels odd, but maybe it isn't lol. Like, architecturally it feels much cleaner to not have the web frontend (which is now just one of our frontends) coupled to the API layer. Because our other frontend is not coupled to the API layer, and from the API's perspective there shouldn't be any difference between these two frontends? What do you think? If you use NextJS as your frontend and backend , I guess you either have to do this or maintain two different APIs later (one for web, one for mobile)....

TypeScript error: Type 'string' is not assignable to union value

Hello friends. I've picked up my side project again this week and I'm trying to add a new feature (required field indicator). It's a component library for forms. It's expecting specific form data: ```...
Solution:
Typescript infers the types from the json to be plain types like string, and so you can assert type for it to be proper. To do so you can do the following, where Form is the type you defined ```ts import data from "../data/query.json" const mockData = data as Form...

As a nextjs + shadcnui user going to expo + react native, what libraries should I know about?

My biggest concern jumping into react native is not having the libraries I know and love like tailwind and shadcnui. What are you guys using?

auth with Fastify and redis

When it comes to db session strategy in NextAuth. I used to use a Prisma adapter that stores the session in MySQL db but afaik that's not optimal for bigger apps especially if there's lot of queries and it should be stored in a redis db instead. Now im trying to build a simple auth system using Fastify and Passport js with MySQL for storing users info and a Redis db for storing sessions. But idk really how to do that and i searched lot but i didn't find anything. Should i stick with MySQL there gonna be lot of requests btw or should make a redis db for that. If yes how can i do that?...

Vercel responding with 405 for a api route

the api path is correct, i think vercel thinks of it as a static route
Solution:
logs:
Prisma has detected that this project was built on Vercel, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the `prisma generate` command during the build process.
Prisma has detected that this project was built on Vercel, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the `prisma generate` command during the build process.
...

Refreshing NextAuth Discord provider user details

Not sure how to phrase this so will try to describe in detail: My website uses the nextauth discord provider (and no other sign in). When a user with an account changes their discord name and then signs in, it doesn't update. When a user changes their discord profile picture (that i'm using as their profile picture on my website) the link breaks (see image). Is there a way to fetch the user's current username/profile picture on signin and update the database?...
Solution:
You can type it properly like this (refer the added lines) ```ts import type { DiscordProfile } from "next-auth/providers/discord"; ...
No description

Trying to use upload thing

export const { Uploader, UploadButton, UploadDropzone } =
generateComponents<UploadFileRouter>();
export const { Uploader, UploadButton, UploadDropzone } =
generateComponents<UploadFileRouter>();
when I try to use these component it still says pass generic?...

Not sure how to move forward with NextAuth and Web3

Hi all, I have to admit that I still have to experiment with the implementation but while documenting, I started to have some doubts that I would like to ask you first. I already have a T3 app running with the authentication handled by NextAuth and the Discord provider. ...

Issues creating public route after adding Clerk auth

After adding Clerk to my application, all API routes return a 401, even the public one gets a 401 unauthorized error. I need help with this promptly, and I am willing to pay whoever can support me in an 1on1 session. Chat and call is fine. I am running the same tech stack as shown in Theos T3 stack tutorial (https://www.youtube.com/watch?v=YkOSUVzOAA4&t=2025s) and this issue is on the step where Clerk is added. This is probably some dumb simple bug, but I am stuck on this and need assistance as soon as possible. Please reach out....

Prisma Seeding

Hello, I am trying to seed my database (supabase) using the 'npx prisma db seed' command. However I keep getting this error: Running seed command ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts ... TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/folders/project_climb/prisma/seed.ts. I am using the T3 stacks so I have my script written "prisma": {...

trpc client does not have a property query

I think this is an issue on my end here is how I am defining everything ``` export const t = initTRPC.create(); export const assetsRouter = t.router({...

uploadthing custom theming not working

hey guys I am not sure if I am doing this correctly but custom theming is not working on the UploadButton The container does change color but the button doesn't change at all **My css is in globals.css...

How to use fetchpriority="high" in a <picture> element?

fetchpriority is often used to optimize images that are the LCP (a core web vitals metric) on pages. It can be used on <img>, <script> and other tags, but I don't think it works for the picture HTML tag. If I'm using the picture tag in order to have one image for each viewport, how can I optimize the image that is loaded using fetchpriority? ...

Expo problem AppEntry.js problems (create-t3-turbo)

When i run npx expo and connect it to my iphone, im getting bundling failed (Unable to resolve "../../App" from "node_modules\expo\AppEntry.js") ../../App references nothing by default, what is it supposed to reference....

I am getting errors while trying to install create-t3-turbo dependencies, how do i fix them?

This is my error message PS C:\Users\cc09p\OneDrive\Desktop\Programming\my-turborepo> npm i npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! ...