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 add getLayout property to Component, nextJS 12.3

Help me, NextJs12 --> NextJs12.3, don't know how to use getLayout,

tRPC app with SSR true, getStaticProps or getServerSideProps

Hi all, I've been trying to figure out what is the best way to fetch queries on my website that I'm building with T3 stack. Long story short: I'm creating a website that will be like a portfolio and an online resume. I have a page called /projects and I'm trying to fetch all the projects on the server, so all the projects can be available when the users arrives on the page. I've been reading a lot of stuff lately about SSR and which methods to use to fetch data, either getServerSideProps or getStaticProps. On top of this, I know that tRPC configuration accepts a ssr: true | false property....

What was the reason for removing req, res from context?

What was the exact reason for doing so? While implementing a simple rate limiter like this: https://github.com/vercel/next.js/tree/canary/examples/api-routes-rate-limit I found a use case where I needed the res object, because of which I had to change the context to include it, similar to how it was before. Is there some other way around this or would it be better to bring it back?...

Running a cron job alongside T3 stack locally

I want to have a cron job fetch some RSS feeds externally every 2 minutes and post to the db. I can use an external service when deployed but what’s the best way to implement when developing locally? I started creating a simple express app to run alongside but wondering if there’s any better alternatives?...

why re-mcompile JS each time?

why V8 doesn't compile the js once and cache the binary output for the next run? instead of recompiling each time. it'll be almost like wasm except that you just write JS scripts....

can i remove a background from an image using Js

hey guy i was wondering if i can create a javascript api that removes the background from an Image , does js have that capability ?

Documentation past comments, is it needed?

Hey y'all, just wanted to ask a question about if one might need internal documentation like website (e.g., something built with like https://www.docz.site/). I understand if its like an open source library and you want people to know how things works and the props it has. But I just don't see how it may be useful like internally. Maybe im in the wrong? But not sure if trying to actively maintain it is beneficial?...

Quick question about TRPC query with date

Hi, Just a quick question about TRPC Query why do I always get the same date in the query? Date in this case is a state. ...

Internationalization with T3?

Did anyone successfully manage to implement internationalization on both static and SSR pages with T3?

I need ideas for Data viz & Metrics framework in t3 stack ?

Hi, I created my app with the T3 stack (Prisma, next-auth, tRPC, Planetscale) and added axiom for logging and monitoring. It feels like I am missing something for data visualization... This stack allowed me to implement so much by letting great libs and services do all the heavy lifting. ...

Project time Estimate

Hi all i am trying to get an estimate of how long it would take to build an app like this. How many hours would you say it would take to build a multi tenant project with 2 api integrations. The app will have 1 superadmin and regular users that can create organisations. all actions are scoped to organisation the owners of orgs or org admin can invite new users to their organisation users can create customers in the org (id verification integration)...

File storage in T3

Yes, I know about S3 & presigned POST URLs! Hi, I have a question about file upload in T3 stack. What could you recommend for free (afaik S3 does not offer free tier over 12 months) to handle file upload? The thing is, I will definitely not use more than 100MB. I need the file upload because I'll need to assign images to specific entities in my app from my admin panel and I'll probably be doing this once a day (that's why I'm not using static assets). I'll need maybe up to 50 images at once. Besides the pricing, S3 will be too much for that simple use case (just admin panel -> update few images a day)....

Are tRPC endpoints awaited internally? Endpoint being called again before it finishes

I'm having this weird issue where I want to add a value to an array only if it doesn't already exist. I test this in my endpoint and return an error if so. But it's being called twice due to react's strict mode and in both cases the server hasn't seen the update yet. ```Typescript // tRPC endpoint console.log(arrayFromPrisma);...

supabase auth with trpc?

I can't seem to figure out a good way to add supabase auth to trpc similar to how nextauth is integrated in create-t3-app. I am specifically having issues creating a protected trpc route with supabase auth They have the withApiAuth for protected routes, but I want something similar to getServerSession that just returns a null value that I can write code to handle....

What's the best way to bulk insert with a many-to-many relationship (posts & categories) in prisma?

What's the best way to bulk insert with a many-to-many relationship (posts & categories) in prisma?

routes

Folder structure examples in server/routes What is the recommended way to structure server/routes folder? Are there any examples online with lots of routes?...

Prisma nexth-auth role based access control model

Hi, just getting started with the t3-stack and prisma. I'm a little confused on why the Account model is required for next-auth. Also, I'm not sure how to add a role that would give me type definitions when using the session. Yes, I did looked it up and I followed the tutorial from next-auth, but that doesn't give me the type definitions on the user when setting up the session. https://next-auth.js.org/tutorials/role-based-login-strategy...

tRPC, ssr specific route

Hello. I'm migrating to tRPC and I ran into this specific issue. In this scenario I prefetch data on server using getServerSideProps and then pass them to initialData inside useQuery. I use it for SEO purposes. What can I do when I'm using tRPC, I'm unable to do the fetch on server using useQuery. I know there's option ssr: true, but I don't want to all routes to run on SSR just because of this one specific case....

How do you guys handle server errors on tRPC

I wanted to know what methodologies or opinions some of you may have with regards to handling errors that come from the server or preventing/'doing another way' the if (error) ... lines on every file

T3Stack 'react-query' not found

Hey, I'm trying to migrate to t3 stack, but I've been using react-query, but I am getting this error: ``` ./node_modules/@trpc/next/dist/trpc-next.esm.js:8:0 Module not found: Can't resolve 'react-query'...