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

Noob Q - Prisma date property

does anyone have experience with prisma, i have a user object i'm sending to my backend and i want prisma to set the date property automatically for me, but is asking me to provide a date property

Does parsed data improve speed

Hello, let's say I parse data this way. Does it make my website faster / lighter when I use this query in the frontend, because I return just the stuff I want? ```const PokemonResult = z.object({ forms: z.array(z.object({ name: z.string(), url: z.string(),...

CAS with nextAuth

I have tremendous problem wrapping my head around this. My University is using CAS as authentication provider and I want to use it with NextAuth as Social Login. Does anyone have any idea how can I implement it? I'm pretty blue about authentication systems and I can't figure where to even start.

Prisma feel like it leads to bad code design patterns

I’ve been learning and working with Prisma as I rewrite a project of mine in Typescript and one thing really stood out to me with it, it’s really easy to create complex queries and create / modify data from multiple places Quick example, users can change settings in my project, that has the potential to happen from multiple places and if I made each one of those it’s own Prisma call with update, then if I ever wanted to add analytics to settings changes I’d have to go to each place and put an event listener The way I’ve set up Prisma in my project is similar to how Discord JS handles their interactions, with managers and structures ...

CRUD tutorial

Any CRUD tutorial for t3 stack for beginners to learn from?

Conditional Redirects

Hi, first time exploring the stack and NextAuth. I've extended the default NextAuth User model to include a reference to another model (Team), and I want the following behavior: 1. User logs in/is logged in 2. Check which team the User belongs to (column on the table User). 3. redirects to /<team-id> ...

NextJS Handling binary data

hey, how do you change the body parser in nextjs? I am trying to handle raw binary file POST requests...

aws lambda deploy

Does anyone know if t3 supports serverless deployments?

NextAuth Middleware config

Hey guys, first time I've used middleware, I just need a hand.

file input element doesnt work if its inside a form

i have an interesting question. i have a pretty big dynamic form that im managing rhf. one of these form elements wants to allow the user to submit a picture. Inside this I have a button to submit a new picture: ```ts <input form="test"...

Not able to console.log in NextJS 13

Alright so kind of a dumb question, but there's no such thing so here it goes. Building out a simple recipe store website, currently trying to display a single recipe, using the id slug to query my DB for it. I guess the first thing I'm not understanding is why none of these console.logs are printing anywhere? They are neither in my browser console, nor in the terminal window where I'm running npm run dev. The second problem is that the H2 that's supposed to render the recipe name isn't being rendered on the page, though I suspect I'll at least have a bit of an easier time figuring out what's going on with that if I can at least see these console.logs 😅...

Switching over from Material UI to Headless UI + Tailwind. Any recommended tutorial for tailwind v3?

I have not really done any CSS in general (started with MUI). I see a tutorial for "Tailwind CSS v2.0: From Zero to Production" on Tailwind Labs (https://www.youtube.com/watch?v=elgqxmdVms8&list=PL5f_mz_zU5eXWYDXHUDOLBE0scnuJofO0&ab_channel=TailwindLabs) but did not know how much of a difference there is between v2 and v3. Any recs for a v3 tutorial?

Websockets & Connection Upgrade on Next server

So i've been trying to bind a websocket connection from client to server on next, and i've done my usual server flow for this kind of shit: ```ts import { NextApiRequest, NextApiResponse } from "next"; import { WebSocketServer } from 'ws';...

Is this waste of space?

Hello lets say I have router ``` export const coinRouter = router({ getCoin: publicProcedure .input(z.object({ name: z.any()}))...

recommended solutions for storing images

Hey, I was wondering if anyone had any recommendations for storing images for my app. Each image will be less than 150kb. Currently unsure about how many I am going to need to store ...

What's wrong with my Next Auth and Layout code

import type { ReactElement, ReactNode } from 'react' import type { NextPage } from 'next' import { type AppType, type AppProps } from "next/app"; import { type Session } from "next-auth"; import { SessionProvider } from "next-auth/react";...

File sending on form submit

So I'm trying to make a mutation, and that should generate a txt file and send back to the user. So far I have this ```ts import { z } from "zod"; import fs from "fs"; ...

when to make new component react

After reviewing my stuff I realized that I don't make a lot of components. So my question is when should I make a new component? Also how should i structure my files? Currently src/components but should i make subfolder if projects gets bigger?

encode uuid to be accepted by google

I'm querying google's calendar api and i get back some 400's due to invalid id. i read on their docs what they match and have concluded they don't support cuid (cuid uses letters up to z and google accept a-v), so i changed to uuid but i keep getting back 400 and so i tried removing the separating dashes to make it happy. is there a proper way to do this encoding/decoding? right now i did a pretty nasty hack with regex (to remove when posting google's api) and split (to add them back when querying the api). the id's in my db uses prisma's generated uuid so they have dashes, hence i need the dashes in order to be able to match them. tldr; what's the proper way to encode/decode uuid?...