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

t3 turbo firebase functions

So I converted my t3 app to t3 turbo using this https://github.com/t3-oss/create-t3-turbo as my base. Everything is working great. Now I'm trying to add firsbase functions. via the fire base cli firebase init functions. But after i install and run the basic command "serve": "pnpm run build && firebase emulators:start --only functions", I get about 63 errors that say something like this ../../node_modules/@types/react-native/globals.d.ts:337:15 - error TS2300: Duplicate identifier 'URLSearchParams'. which isn't being used. ...
Solution:

Old Imac i want to turn into monitor but its not working

I have an old broken imac but the display is fine i want to turn it into a second monitor but for some reason its not working idk why im using a display port cable to connect to an imac that transits to an hdmi connected to my pc pls help

How to remove default/example stuff

So I'm wondering what stuff I should be removing to have a bit more of a barebones t3 app. I've installed everything because previously I was using regular react and piecing together other packages, but now I'm just trying to have it like an all in one kind of thing I guess? However there is just a lot of boilerplate code and I'm not sure what are the core files I should be keeping, and what I can remove because it's just example files. Thanks for the help...

fetch failed with app directory

Hey guys, I'm kind of stuck with drizzle at my first try using the app directory. I have defined the following db query in my page.tsx: ```tsx export default async function Home() {...
Solution:
Yes! I found the issue. It was, that somehow the creator of my repository, that I used as template, used @planetscale/database, but I was not using planetscale for my dev environment and so it did not work. This now also makes sense with the port 443, which was actually the tried connection to the database url (which was 127.0.0.1 at this moment) and so it did not find any database, because there was none. Now I've changed to drizzle-orm/mysql2 and I will use @planetscale/database in production...

Confused with t3-stack

I have planned a production project with nextjs, but confused, should I use t3-stack or not?? Because as I can see nextjs pushed app/ but t3 doesn't support it so just asking what is the best option, also i wanna use chakra ui with it, but emotion is not supported in app/ properly i guess

Issue communicating with backend and frontend on same machine (localhost)

Hey any full stack devs here, how did you work with , hmm basically i have made simple server with mongo then run in on host:3000 then building react frontend host:5173 but on working with Axios or fetching data from server it throws me error what am i supposed to do am i missing something (basically it is error or some cors policy), Is there any yt video or blog on fixing it

How can I use a TurboRepo to have multiple Apps? Do I use multiple Next.JS projects? Help with infra

Hi folks, I need some help in understanding how I can setup my infrastructure I want: - Any number of apps, that consume a single backend. (Or maybe I need multiple backends, I still don't know.) - My idea is to have one single TRPc Endpoint being served on one MASTER server, which would probably be a Next.JS app on Vercel....

Issues With Prisma Return types

I have really dug deep to try and find a solution online before coming here but I really can't find anything. I'm seeing an issue where the return types I get back from calling prisma are not showing the actual model type, but instead showing this strange 'GetResult' type. Has anyone encountered this before? Again apologies if this is a low brow question I truly could not find anything online when searching GetResult type and prisma.

Getting data from database with zact

Guys do you know if I can use zact library to get data from database? I only see a mutation funct...

What do y'all use for sending emails?

Things like AWS SES, Postmark, SendGrid, etc

Intercepting route with route groups and catch all routes

Can't get intercepting route to work with route groups and catch all routes, but it does at least compile. I also tried @authModal/(...)sign-in/[[...sign-in]]/page.tsx and this doesn't compile at all.

Uploadthing for a large project

I want to use uploadthing for a big ebook project. Will it be cost-effective? Our rough guesses for usage are 30-50mb pdf and opened about 10000-50000 times daily. Another solution is to convert the books to JSON format but that's difficult for thousands of pdfs. If there's any other solution please suggest. The reason I want to convert these into JSON is to search in them. If I use uploadthing what will be the estimated costing of this?

Clerk auth 'authMiddleware' vs 'withClerkMiddleware' and setting cookies

(https://clerk.com/docs/nextjs/middleware) I'm trying to set two cookies inside authMiddleware (afterAuth) and it works for setting the first cookie, but any subsequent cookies aren't set at all. If i try to do it using the older 'withClerkMiddleware', it works tho. ...

Contentlayer error when deploying onto Vercel

Hey all, I ran into this problem when trying to deploy a blog using mdx, contentlayer, etc on vercel. Anyone know a fix? Here is the build command in my package.json "build": "next build && contentlayer build"...

React Native Error: [TRPCClientError: JSON Parse error: Unexpected token: <]

I started using a acme corp repo using expo with android studio I created a new public procedure for a mutation but, calling the mutation from expo apps/expo/src/index.tsx doesn't work and I get this error message in the onError callback...

Next-Auth Access to custom data in sessions database

Hi All, I implemented a new column into the "sessions" table called "selectedClientID". Users will have access to multiple clients and I want the session to keep track of what client they have selected. In my current implementation, I can't seem to retrieve the "selectedClientID" in the sessions table. This is the current code:...

I am confused about Prisma and CUID (deprecated v1 vs v2). Does anyone understand?

I started using Prisma and checked how the T3 stack generates IDs. I see that the schema uses cuid() and Prisma documentation doesn't say anything about the version used. Is it v1 or v2? I've found a thread but it's not much helping (https://github.com/prisma/prisma/issues/17102). So, is Prisma using v1 or v2? If v1, isn't anyone concerned about using a deprecated version for security reasons ?! (https://github.com/paralleldrive/cuid#status-deprecated-due-to-security-use-cuid2-instead) Also, why the T3 app is not using the middleware solution proposed in the thread in that case? This seems quite important....
Solution:
From what I understand, the rust port of cuid that Prisma uses in production doesn’t suffer from the same security issues as the js package. Cuid2 is still better due to being even more collision resistant, but if there isn’t a significant security risk then imo it’s better to just wait until cuid2 is supported natively by Prisma. Am I misunderstanding the situation?...

Authentication (next-auth) Persistence Issue with iOS Home Screen Web App

Hello Everyone, I'm currently working on a web application built with next-auth and react and I'm trying to enable web push notifications for users that have iOS mobile devices. To achieve this, I need my users to bookmark the app to their home screen, making my app appear similarly to native apps on the iPhone's home screen (basically a PWA?). However, I am encountering an issue. After users bookmark the app to their home screen and open the app from there, they are required to sign in again, even though they were previously authenticated. My aim is to have the users automatically signed in when they open the app from the home screen, without having to re-enter their login credentials the first time they open the home screen app....

making sure nothing runs with SSR

I've created an app with create-t3-app, it uses trpc and has two procedures that create a new entry in a firebase database and show all the entries respectively. I then use the usequery hooks to access them I also have the trpc ssr option disabled. so with that description is my app using SSR in any way? the reason I am asking is because I want to host on firebase hosting and you have to pay to use cloud functions so I can't do SSR at all
Solution:
I've created an app with create-t3-app, it uses trpc and has two procedures that create a new entry in a firebase database and show all the entries respectively. I then use the usequery hooks to access them I also have the trpc ssr option disabled. so with that description is my app using SSR in any way? the reason I am asking is because I want to host on firebase hosting and you have to pay to use cloud functions so I can't do SSR at all

Custom protected routes?

Hey guys I'm wondering about the best way to achieve something. I added a custom property to my User table which is ROLE Role can be USER, ADMIN, or SUPER_ADMIN...