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

verify thought process: TS and python serverless functions

im making the backend for a chrome extension that downloads the mp4 audio file from a youtube video and runs it through the whisper api from openai i have a job queue table in my DB that tracks the status of jobs that are queued for 1. downloading audio from YT or 2. running audio through whisper i have a supabase edge function (deno so only TS is supported) that will download audio and save to supabase storage...

Weird bug? Can't import {PrismaClient} from @prisma/client

The problem is only with typescript I guess, because the code I wrote works perfectly. pic 1 - my schema pic 2 - db.ts pic 3 - api/hello.ts ...
Solution:
I updated my IDE(PyCharm - same thing as webstorm but with python support) from 2022.2 to 2023.1, and the bug is no more present

Is expo trpc supposed to work without nextjs?

I have a fresh copy of create-t3-turbo. When launching expo only I can get it to load but it is not displaying posts. When i run general dev command which launches nextjs + expo, posts load on expo. Is this supposed to happen or is expo trpc supposed to work without nextjs running? If this is correct behavior how does it work in production if your website goes offline?...
Solution:
trpc "extends" nextjs api routes and works just like a simple REST server in this aspect. if you don't run the nextjs app, no server will be running, so the expo client wont have anything to connect to. ideally in production your website wont go offline, otherwise the api will not work.

Async set state

You are looking at the logic behind my search functionality. The highlighted part of my code is not working the way its supposed to. Every time there is a new search I would like to empty out my playlist array and assign it to the new results returned from the server. Currently the new results are being appended to the older results. ...

Add required relation on User model when user is created (next-auth/Auth.js)

Is it possible to modify the User model to include a required association? I want to create an organization that is created when the user is created and is associated with the user. Like shown in the pic. I've tried playing with the various "events" https://authjs.dev/guides/basics/events, but haven't gotten anywhere.

trpc with nextjs 13 (api folder inside app folder) with a custom context

Hi, im trying to integrate trpc with my nextjs 13 project, i already tried to replicate something like this repo but it does not work and i get an error on my client page [Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (users.getAll, line 0) repo: https://github.com/trpc/next-13...

Linking 2+ T-3 apps together. Any advice for linking up two repos together to make a composite app?

I have an application shell app and I want to bring in an app that handles "user-settings" (each app has its own pages and api routes with tRPC). I have have tried git sub-modules but that caused conflicts between both apps. Is there a good way to combine the two apps together to use one URL for access. And use the Layout from the application shell with the pages from "user-settings" app?

Is it safe to get all data based on a route query parameter?

I have a dynamic route which renders a single Project-page. The page itself is being rendered based on the id of the route-query. Like this: ``` const router = useRouter(); ...
Solution:
yep, you'll wanna make sure that the project belongs to the user too

Is T3 good to build an application for one to one video chat using twilio webrtc go?

Requirements: 1. One to one video call with voice and realtime messaging 2. Authentication using oauth. I am considering using Video WebRTC Go https://www.twilio.com/en-us/video/pricing instead of the WEBRTC or agora, as twilio is free for one to one video calls, I've also heard that implementing WEBRTC from scratch is time-consuming....

Next.js and GCP Cloud Functions

I've been able to deploy a Next.js application to Cloud Run and GKE, but not to Cloud Functions. I've been banging my head against this challenge for enough time now... Figured I'd ask the community, so here are my questions? Has anyone attempted to get a Next.js project running on GCP Cloud Functions? How was your experience? Were you ever successful? Did you run into any limitations?...

How to store MD

Im building a CRM/Task management tool, i want users to be able to write MD descriptions for tasks how do i go about storing this in the db (mysql & prisma)

What do you use for carousels?

I have to implement carousel, there is so many libraries. What do you go for usually?

Environment variables validation not working with Jest (env.mjs)

Hi, did anyone else have problems with env.mjs in tests (I use env.SOME_VAR in my components)? I get this error: ``` .../env.mjs:1 ({"Object.<anonymous>":function(module,exports,require,dirname,filename,jest){import { z } from "zod"; ...

With tRPC, is it safe to validate only on the client?

So with REST, we have to validate input on the server since people can bypass client. Is that possible with tRPC? Can I use zod to validate input only on the client side?
Solution:
tRPC is also REST

@tanstack/table with editable cells, using react query, cells losing focus

Hello everyone! As mentioned in the title, I have a table that's rerendering every blur, which causes the user to lose focus when moving from one input to another. Has anyone run into a problem like this before?...

mapping a column in model to another model

I have nextauth with github I want github usernames to be fetched so I can display them alongside comments. working state of my schema.prisma:...

Workaround SSG Helpers

Hey all, following Theo's latest tutorial I got to the SSG part and found out the docs aren't working for this exact section, I tried with createServerSideHelpers instead but now I cannot import from '@trpc/react-query/server' as I get Cannot find module '@trpc/react-query/server' or its corresponding type declarations.. Does anybody know what can be the reason? Appreciate the help and time!
Solution:
Hey all, following Theo's latest tutorial I got to the SSG part and found out the docs aren't working for this exact section, I tried with createServerSideHelpers instead but now I cannot import from '@trpc/react-query/server' as I get Cannot find module '@trpc/react-query/server' or its corresponding type declarations.. Does anybody know what can be the reason? Appreciate the help and time!

Offering Custom Domains to Users with T3

Hi, As part of my app I want to offer users the ability to add their own domain that will serve certain pages on my t3 app. Curious the best way to handle this with the t3 stack? The straightforward method of having a custom express server and intercepting requests to certain domains and rerouting them doesn't seem like it makes sense with this setup....

Session within components

Should I be passing the session from my page down to my components or using the useSession() hook within my component. What is the standard or best practice of doing this?

@next/mdx with slug in app dir

Doing some experimentation with the app directory, and I’m curious if anyone has seen or can find documentation for how to do dynamic slugs for posts within the app directory using @next/mdx to fetch content? So that /blog/dynamic-slug would fetch the right MDX doc. Should I just opt for contentlayer instead?