Mendy
Mendy
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Mendy on 8/7/2023 in #questions
How to import images in NextJS and t3-turbo?
2 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.
.
└── my-repo/
├── packages/
│ ├── api
│ └── ...
└── apps/
├── mobile-1
├── next-1
├── next-2
└── ...
.
└── my-repo/
├── packages/
│ ├── api
│ └── ...
└── apps/
├── mobile-1
├── next-1
├── next-2
└── ...
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:
pages:
- index.tsx
- dashboard:
- index.tsx
- myLines.tsx
- billing.tsx

components:
- header.tsx
- sidebar.tsx
pages:
- index.tsx
- dashboard:
- index.tsx
- myLines.tsx
- billing.tsx

components:
- header.tsx
- sidebar.tsx
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:
get: protectedProcedure
.input(
z.object({
pageSize: z.number().min(1).max(100),
pageIndex: z.number().min(0),
})
)
.query(async ({ input, ctx }) => {
return await prisma.subscription.findMany({
where: {
clients: {
user_email: ctx.session.user.email,
},
},
include: {
lines: {
select: {
phone_number: true,
sim_number: true,
sim_status: true,
},
},
},
take: input.pageSize,
skip: input.pageIndex,
});
}),
get: protectedProcedure
.input(
z.object({
pageSize: z.number().min(1).max(100),
pageIndex: z.number().min(0),
})
)
.query(async ({ input, ctx }) => {
return await prisma.subscription.findMany({
where: {
clients: {
user_email: ctx.session.user.email,
},
},
include: {
lines: {
select: {
phone_number: true,
sim_number: true,
sim_status: true,
},
},
},
take: input.pageSize,
skip: input.pageIndex,
});
}),
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