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 handle Nextjs with external REST API

How do you guys handle using Next.js with external REST APIs? Is it okay to wrap all fetch calls within actions (in order to use revalidateTag)? How to handle jwt auth in that scenario?

How do you achieve this with T3 stack SEO

I already create sitemap, title, description & OG stuff. but my site have not yet shown this way. Its just showing the site in one line.
No description

is it wrong to call myself a software engineer if i didn't go to college

I saw some hot takes on how bad it was to call yourself a "software engineer" when you're just a "developer" (it was a long time ago, so I don't remember the entire argument, but now I have that idea in my head). are there differences between a developer and an engineer?...

Expo with Native Modules

For my expo application, I need to use a react native package to connect to a printer. The printer only has serial port or usb options so I can’t use expo print. I do not want to eject from expo. Every time I use native modules I run into build issues with gradle. Does anybody have any advice on how I can best approach this? Should I try expo dev client?

What's the best way to pass up to the frontend that my database in currently inaccessible?

t3 + trpc + primsa + Next14 + server components combo. I'm just trying to make my backend a little more robust. Assuming I've turned off my database in order to simulate issues. Currently I get a standard error. I'd like to pass this back you to the frontend as a more friendly "There was a problem with the Database. Please try again later" type message. src\trpc\server.ts catches the error just fine at.......
Solution:
if(!healthy){ // do something }...

Best Frontend Testing System?

For my NextJS app what is the BEST software out there for a small freelance team to create tests for our clients projects so as we develop we ensure each input, form, page, drawer, etc have the info and function as they need. Bonus if it connects to github to pass / fail pull requests based on those tests. Also we will be using Vercel for hosting on most if not all platforms if that info is helpful....

NPM library best practices?

I was creating my own NPM library, @menglinmaker/soundfont3 but there are so many technical decisions: - So many bundlers to choose from: esbuild, webpack, rollup, snowpack, tsup... - Do I bundle to 1 file? Tree-shake? - So many testing frameworks too: jest, vitest......

Where's the best place to get the hash of a file?

When users upload files to my app, I want to generate the md5 hash - where's the best place to hook into the uploadthing flow to do this?
Solution:
```ts .onUploadComplete(async ({ metadata, file }) => { console.log("file url", file.url); const buffer = await fetch(file.url).then((f) => f.arrayBuffer());...

How to implement a "local first" Mobile app storage

I'm trying to learn more about React Native and wanted to create a small habit tracking app. While the details are not that important for this question, one thing that I want to ensure is a local experience even when internet is not available, however all data should be saved in a DB as well. Also, you can have Habits for multiple people, meaning 2 people can edit the same habit while being on/offline. Basically, I would need a way to sync the phone's local storage with my DB. However, while thinking about it I found some gotchas that I don't have a happy solution for. 1. First of all, how does it work. E.g. when the user adds a habit, is it firstly saved locally then synced. Is it saved to the DB and locally at the same time if there is a internet connection? Or something else entirely?...

Drizzle where query problems

I am using drizzle. In my below aPI I cant get my where request to correctly get me my restricted products. When i call the API, it says no restrictions found for product id 63905 which is wrong as I have the below row that DOES have that ID???? db obj example sent in next msg ```ts...

Where can I find the full stream videos?

I used to see a playlist on the YouTube channel for the full steam, but I cannot find them anymore. Is the full video still available anywhere (want to download on YouTube for a long trip I'm going to be taking soon)?

UploadThing + CDN

Hi all, I've tried searching but haven't been able to find a clear cut answer - Has anybody used other CDNs with UploadThing? I've seen some discussions about UT using cloudflare, so does that mean I don't need to set up my own CDN if I'm using UT?...

SSR + Personalization?

Hey folks, has anyone had experience using something like Adobe Target for personalizing SSR components? If i'm understanding correctly, in SSR, all the HTML elements have to be rendered on the server before it reaches the client. What if the personalized server-side component has a dependency on a client-side rendered component? how would that usually work out?...

upload thing multiple images in one form

im attempting multiple pictures on one form but having issues with how they are being uploaded. ( only one at random is uploaded many times )

How to use uploadthing server side?

Is this the correct way?
``` export const utapi = new UTApi(); // imported from uploadthing/server // Extract image URLs and upload them to UploadThing...

Performance Analysis for Trpc api

Hey 👋 , I have been facing performance bottlnecks in some of my APIs, I used to code in django before, I used gprof2dot to profile apis, Is there a similar tool for trpc?

Types union and how to distinguish them?

doing so I can check later if kind === EventType.Click, and typescript will know that inside that block the object is ClickEvent. Is that a good approach to this? Also, could I use instead of kind: 'click'; the actual type value? EventType.Click ? ...

Sentry or Axiom? or both?

Whats sentry good at? Where should I use axiom instead? Or, can I use both, and if yes, how? My main goal is to set up alerts when requests fail in my pages/api endpoint, and if any frontend page breaks; how can I achieve this in the best way?...

I'm struggling with a large HTML file issue in my Next.js project.

The HTML byte size is huge, impacting performance. 🐢 🔍 Any tips on optimizing or reducing the HTML size?...
No description

Enabling small edits to webpage by non-technical clients, similar to WordPress

Bit of a nebulous question, but are there any tools that exist/yall recommend to allow non-technical people to edit small potions of a website, such as text? Essentially I'm wondering if I can get the dev experience from something like Next.js, while having the benefits of easy editing that something like wordpress gives.