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

Next-Auth with my own supplied credentials (from a MySQL database)

Hello! I am creating an application that will be for internal employees. I would like to use Next-Auth for authentication. However for now I have only tried out the standard providers like (Discord, GitHub, Google etc..) For this project I have to use my own credentials. Supplied from a database that I host. I have tried looking at the web for some examples on how to do this, but im not able to find any good examples. In the docs you get a lot of the code for you, but not the logic for verifying the user/password and getting it from the database. Does anyone have a good example/tutorial for this? That would work in a real life application. I have heard bcrypt is good for hashing? šŸ™‚...

How why to replace min-width in my CSS

I've been getting into replacing all the styles in my app with tailwind recently. I've mostly found this to be rewarding, but I'm confused about the lack of options available for min-w-*. I asked a question about it here before and I was told that using min-width with specific pixel values was generally not a good idea. That being said, I'm having a hard time getting the desired behavior I need without it. For instance I have the following div: ```html <div className="border-1 mt-3 flex min-w-[300px] flex-col gap-4 border-solid border-divider p-4 shadow-xl"> ......

Next Auth Discord Callback error...

I really can't see what i/m doing wrong here. I've added `https://hciav.vercel.app/ to my NEXTAUTH_URL and NEXTAUTH_SECRET as a hashed string to my vercel environment variables. but i'm having no luck with this. the localhost:3000 implementation works fine...

Is there an 'easy' way to expose tRPC function as an external REST API?

I'm just curious if there is a way to expose certain tRPC functions as a REST API. One of the reasons I'm asking this is, imagine you have built an application and now you might wanna sell (or expose it, don't have to sell it) your backend to other consumers.

How to deal with env variable being string | undefined when clientId is expecting only string?

I'm trying to think of a solution to this... any ideas? So far I'm just doing typeof, and if it is not string then error.

invalid environment variables

Hey all. I'm using create t3 app but having some difficulties with custom environment variables. The .env type safe code is messing me up. ...

Link Error NextJS 13

I have removed all the a tags inside of the link tags and have run the auto codemod provided by next. I am still getting this error. Can anyone help me out? Thanks...

Help me type this function

I have a function that takes in an input function and returns another function who's input is the same type as the function passed into it. ```ts function Foo<T>(callback: (input?: T) => void){ return async function(input?: T) => {...

Reusable components folder location?

Hey guys, where do we put reusable components in Nextjs?

I can't inner join with a table twice

I have these two tables: ```sql CREATE TABLE users( id, username,...

Nextjs Middleware to redirect

Hi I want to redirect this route / to /dashboard for that I created a middleware.ts inside src ```ts import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server'...

Host pdf files locally or online

Hi! I'm building an application where a user can upload a pdf. Is there any way i can host these files in nextjs(using ct3a with mysql) similar to how we can do that in express Also is there any free tier service which allows to host static files online which i can access using nodejs . ...

Jest on dynamic routing

Doing unit tests on Nextjs page with route of id, how do I pass in the query of id to not get the Error: Uncaught [TypeError: Cannot read property 'query' of null] error? ```js import Scholarship from '../pages/scholarship/[id]' describe('Single scholarship page', () => {...

Why is noUncheckedIndexedAccess enabled by default?

I started a project using create-t3-app and I was getting all these type checker errors throughout my code, which forced me to manually reassert types all over the place. Setting "noUncheckedIndexedAccess": false in tsconfig.json solved the problem with my type checker but I'm left wondering why this was enabled by default in the first place. Manually reassert types all over the place seems to run contrary to this discussion: https://www.youtube.com/watch?v=RmGHnYUqQ4k

T3 Docs - code explanation

```js import { DefaultSession } from "next-auth"; declare module "next-auth" { interface Session {...

Astro or NextJS for single page website with contact form?

Hello everyone, I'm currently remaking a single page website with contact form and wanted to ask for advice. I thought is would a be an overkill to make it in NextJS so I thought I would go with Astro, is it possible to use nodemailer with Astro if i want to host my website on cpanel? Thank you in advance

converting TailwindUI syntax documentation to a page in my app.

Hey I’m just struggling to convert the Syntax docs template from TailwindUI into a page in my application.

How to use tailwindui app shells with t3

I am not sure on how i would go implementing a tailwind ui application shell. Usually i would just add my header and footer components between <Component {...pageProps}> but i keep getting errors related to the way useState is different between the one rendered on the sv and the client one. Tried looking at nextjs docs for a way to add the layout but cant figure out what type i should give my component. If any of you have a repo that implements it or anything i could use i would truly be grateful thanks...

Large POST request on ESP32 over SIM

Hey, bit of a pot shot putting it in here but anyways My Microcontroller is an esp32-cam, and I am trying to currently write a function to send a POST request containing form data to my server. I am using TinyGSM with a SIM7600 module....

Next 13 AppDir + middleware

I tried to create an app with Next 13 and play with the new app dir (beta), but I couldn't make middleware to work. I had no pages dir, all pages were rendered correctly but it seems like middleware was not firing. Is this not yet supported ? I couldn't find anything in the stable or beta docs of Next...