Mendy
Explore posts from serversDTDrizzle Team
•Created by Mendy on 10/31/2023 in #help
Smart or Idiotic? The Great BigInt-to-Hash Adventure!
Alright, fellow code-wranglers, here's a spicy tech taco for you: we're dancing with regular bigint IDs for all our database entities, thanks to our waltz with planetscale row-reads pricing.
Now, I don't know about you, but I’d rather our users not play detective and guess how many entities are populating our database by spotting the latest ID. Feels a bit like showing your poker hand, right?
Enter the possible hero of our story: a nifty method that takes these IDs and morphs them into encrypted random strings using a sprinkle of secret salt. In this magical world, our database is blissfully unaware, munching on regular int-type IDs, while our users get served fancy hashed strings that look like UUIDs. Fancy, huh?
But... plot twist! What if our secret salt takes a vacation and ends up in the wrong hands? We'd be stuck with a bunch of links that might as well lead to Narnia. Picture a "https://tinyurl.com/WhereDidTheMagicGo" that's lost its sparkle.
Given that I’ve been known to occasionally doubt the genius-level of my brainstorm sessions (hey, humility, right?), what say you? Smart or Idiotic? Bring on the verdict!
58 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 8/7/2023 in #questions
How to import images in NextJS and t3-turbo?
2 replies
DTDrizzle Team
•Created by Mendy on 7/15/2023 in #help
How to update multiple rows with one query?
Take this array as an example:
Is it possible to update all the rows with the new data in one query?
Using plain sql, something like this will be possible:
Thanks for your help!
6 replies
DTDrizzle Team
•Created by Mendy on 6/20/2023 in #help
IS IT POSSIBLE: to use a relation field in a where clause?
11 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 6/6/2023 in #questions
NextJS build Fails Only In CI - Can't find module
3 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 5/3/2023 in #questions
My DB shouldn’t be this slow, RIGHT❓
A fresh DB (pscale) and Table with just two entries, but takes 10s to fetch them (prisma studio)
I’m referring to dev mode, fetch through prisma studio, I haven’t deployed yet - so didn’t check prod.
It’s a user table with 4 one to many relationships, and a few fields.
User => chains[]
User => daycares[]
User => rooms[]
User => children[]
It’s all indexed (as mandatory by Prisma).
My connection is ok, but I’m regularly getting 10s loads, even with consecutive requests.
33 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 5/1/2023 in #questions
Running tRPC as a standalone!
A monorepo with multiple clients calling the same api.
Api will be deployed to varcel under api.mydomain.com
and will be called by all apps, and some 3rd party clients.
Is it possible to deploy the api package using nextjs on varcel - as a backend only?
1 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 4/30/2023 in #questions
Best practice on running tRPC in a monorepo.
In create-t3-turbo I noticed that what actually runs the tRPC sever is the nextjs app inside the apps folder.
Meaning that the package api dose not run by itself and depends on it.
If I got it right, what happens when you have multiple web applications consuming the same api? Isn’t it best practice to isolate it to its on service?
2 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 4/22/2023 in #questions
WHAT IS YOUR FAVORITE LOGGER?
Hi all 👋
I'd love to know what is the 'best' logging solution I can use in my T3 app?
Also, a few weeks ago there was some talk that a good error handling tutorial is needed, do you know of a good resource to learning best practices in error handling?
Thank you for your time!
59 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 3/23/2023 in #questions
Handling OAuth Login Errors with Dynamically Generated URLs in Vercel Deployments
1 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 3/5/2023 in #questions
How to structure pages and components for a simple web app using t3 stack?
I am new to front-end development and I am using the t3 stack to create a simple web app for our customers to view their data. The homepage of the app consists of a login screen and once logged in, the user is taken to their dashboard. Currently, the dashboard has two pages: "My Lines" and "Billing".
My question is: how should I structure the pages and components directories? I was thinking of creating a dashboard page with a header and a sidebar, which will render the other pages for the user. Specifically, my folder structure would look like this:
Is this the correct approach or should I redirect the user from the dashboard to other pages? I am concerned about having to deal with the layout of the header and sidebar for each separate page. Additionally, more pages might be added in the future.
What is the best approach to building such an app?
6 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 3/5/2023 in #questions
Pagination in Prisma query not working correctly near end of results
I'm using Prisma to query a Postgres database and implement pagination. However, I'm running into an issue where the pagination doesn't seem to be working correctly near the end of the results.
Here's the query I'm using for reference:
The issue I'm experiencing is that as I get closer to the end of the dataset, the page size starts to decrease by 1 for each page, until the last page only shows 1 record. I've double-checked that the values being passed to the query are correct, so I'm not sure what's causing this issue.
I've read that using skip to implement pagination can lead to performance issues, but I don't understand why it would cause this particular issue. Can someone explain what might be causing this issue and how I can fix it?
Thanks in advance for any help!
3 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 3/1/2023 in #questions
tRPC, Is it just for front end?
I just spent a few hours trying to use tRPC endpoint inside a NextAuth callback function, only to finally give up and use prisma directly.
Now that I reflect on it, tRPC IS part of the server right? Did I just try to call an endpoint from my own server? 🤦♂️🤦♂️🤦♂️
I hope I’m wrong. be gentle 🤣
9 replies
TTCTheo's Typesafe Cult
•Created by Mendy on 2/19/2023 in #questions
PostgreSQL: Best pgAdmin4 Alternative?
Very frequently I need to query the DB, I have
pgAdmin4
deployed to web and it works fine but is tow major issues are driving me to find a new solution.
1. Autocomplete just sucks.
2. Query editor is lacking basic functionality’s (can’t move up rows for example).
Most of you are probably using Prisma exclusively or one of the new managed databases with great UIs. Not the case for me…
Any ideas? 💡
Thanks for helping || reading.13 replies