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

Seeking robust multi-tenant authentication for NextJS/Node app

We're developing a full-stack application using NextJS and Node (split backend), with Prisma as our ORM, tRPC for API calls, and other modern tools. We're looking to implement multi-tenancy in our app, but we want to ensure it's both secure and elegantly designed. Our main concerns are: 1. Finding a clean approach to implementation...

dotfiles

More and more I want to create my own dotfiles repo to ease sync between workstations, have a backup and share my settings if any co-worker or random people on internet ask. Any good resources, examples, do-and-do-not you can recommend? Of course I saw few other people dotfiles repos and it's interesting, but maybe something interested I missed; Some people even include their full system config, like those NixOS users - maybe I will join them one day when W10 goes out of support finally. BTW: Does Theo have his dotfiles public somewhere?...

MonkeyType

So im trying to make a type test webapp, and i was wondering how monkeytype (or any other typing site) verifies that the data sent from the client to the server is legit. For example monkeytype calculates statistics like words per minute all on the client (i think), and that data is then saved on the server. What is preventing anyone from fabricating post requests with fake data (such as a higher wpm) to then be processed on the server?
No description

Session not complete on expo but it is on NextJS

Hey everyone, I'm trying to build a mobile app using t3-turbo-with-prisma but it seems like three things aren't being found in the session that do work on the NextJS app that uses same database and auth. Specifically username (string), onboarded and admin (booleans) I'm also getting the following when trying to signOut only on expo again:
```bash ERROR << mutation #2 auth.signOut {"elapsedMs": 158, "input": undefined, "result": [TRPCClientError: ...
No description

How are y'all handling custom icons?

I never need them frequently enough to actually set up my own template, but boy everytime I need them i wish I had. Curious how everyone's dealing with custom icons? I just really want SVG optimising, auto component creation, and intellisense to work - or in summary the Lucide repo in it's simplest form.

Tailwind alias/rename utility?

I've got a theme color config that looks a little like this: ```ts theme: { colors: { text: {...

Rate my stack?

Rust grpc api(command&control not malware just gives out tasks), t3 for data display, rust client.

How to webpack? (in nextjs)

I can do what I want to do super easy in rollup but I can't for the life of me figure out how to do it in webpack. Essentially all I want to do is run my source code through a tool to transform it before it's compiled. My source code is in TypeScript but my tool only works with JavaScript, so I need to add the transformation after the the TypeScript transpilation. I created a webpack loader that seem to work fine for js file, but I don't know how to get it to work for ts files too. ...

which approach is better in regards to better code

i have a signUp function that need the useDispatch redux hook I have defined this function in a useRegister() hook which is then used in register page the signUp function is called internally in my useRegister hook, the question is since i need my useDispatch hook , along with other functions (setLoadingState ,setModalToggle) these funtions set the state of my App do i keep the sign up function defined in useRegister() hook or do i define it in another file `functions....

tRPC error Unhandled Runtime Error

Hi, I added tRPC to my nextjs react app and I'm trying to use useQuery() and it's showing me an error that I don't really know how to fix. I was using these sites as examples: https://trpc.io/docs/client/react/setup https://github.com/trpc/trpc/issues/3297#issuecomment-1423905894 src/server/routers/_app.tsx...
No description

"next dev" ignores imports with customConditions

It ignores tsconfig "customConditions" setting which i use to import from src on development. The whole idea of customContions is to do development on the source code, without the need to compile any other monorepo's package and make the app work properly run by nodejs after successful compilation. I can't see any SO or GH issues about that. Tried to fallback "import" section of package.json exports into source code and it works well. Application build with tsc & next export works well. Any idea how i can force nextjs to use "@source" exports during development? ``` //util's package.json "exports": {...

UseSuspenseQuery is called twice

When useSuspenseQuery is used from the client, the query is called twice on the server and client side together. (When useQuery is used, it is only called once). I want to avoid sql being issued repeatedly, is this normal behaviour? We believe the problem is probably that the request is also being executed on the browser side. I do not want to do a complex implementation using cache. I would like to know how to control the fetching of the latest data, for example, during screen transitions or when new data is registered....

NextJS learning advice

I have been trying to learn NextJS from Udemy for sometime and I feel like I am just listening to a person blabber and I am just copying down whatever is written on the screen. Is there a better way to do this? I am new to NextJS so I don’t know all the concepts yet and can’t start building projects right away. #nextjs

I need to embet a YouTube video in my Expo app. Need to support web too.

Currently I import a library called "react-native-youtube-iframe" to embed YT videos into my iOS/Android app, but it keeps failing when I try to run the app on the web (browser). I tried doing conditional imports, but I can't figure it out. I keep getting the same error about "Unable to resolve module react-native-web-webview from..." I tried setting platform extensions like YoutubePlayer.web.js and such, but that didn't help either. Is there a good solution to this problem? I really want my app to work on the web as well. Thank you!!...

How to best approach coding this carousel

I am having to make a carousel for my work, and I am feeling very stuck on how to implement it. I have tried Swiper, but there are some weird incompatibilities, or shortcomings which I have been pulling my hair out a bit with, I've also tried some of my own implementation but I have been pressured to get this out so I put that to the side and I've been plugging away at some libraries. Has anyone implemented anything similar in the past and has had some success with any libraries?...
No description

Discord oAuth: message: 'State cookie was missing.'

I have this error whenever I redirect my users to my discord login callback URL. I used to have it before error in the console, but it would simply error in the console and display a small message on the UI to the user so I didn't really look further into it, but now, it redirects my users to a 404 page. The error I have in the console is:...
No description

Invalid Signature in uploadthing

Hi - I'm getting an error "Invalid Signature" when I use upload thing with production settings. I can't find any reference to this error anywhere apart from in the code so I'm not sure where to start to resolve this The error in the console looks like this
⨯ UPLOADTHING 1:28:56 PM Invalid signature
⨯ UPLOADTHING 1:28:56 PM Invalid signature
...

can you make REST requests with node on a t3 project?

how does that work can I just also have a node backend or

From 0 to production tutorial help with uploadthing implementation - UploadButton stuck on loading

So I am following Theo's guide to learn nextjs and react a bit, coming from sveltekit, but I am having an issue where the UploadButton component from uploadthing is stuck on loading instead of showing 'choose file' like in theo's video. The button is imported from ~/utils/uploadthing where I have the import code for it and it's not showing me any errors in VScode, but on the server I get this error which I assume is the issue "Warning: Only plain objects can be passed to Client Components from Server Components. URL objects are not supported. <... endpoint=... url={URL}>" ...