O2K
O2K
Explore posts from servers
TTCTheo's Typesafe Cult
Created by O2K on 6/7/2023 in #questions
Configure domains for different environments without autodeploying to Vercel
Hello! I havent connected my github repo to vercel, instead I do "custom" deploys via github actions to Vercel. My problem is that I have two domains in vercel staging.foobar.com - should point to dev/preview foobar.com - should point to production but this is not configurable and they both point to production. Is there a way to make staging.foobar.com always point on the latest preview/dev deployment instead? If I have to connect my github repository, can I do that without the automatic deploys? Thank you very much!
2 replies
TTCTheo's Typesafe Cult
Created by O2K on 6/5/2023 in #questions
T3 App/tRPC/Typescript example adhering to Clean architecture?
Hi! I am running a T3 app with Prisma and wanted to hear if you guys know any good example repository to look at for following the general principles outlined in the Clean Architecture book? Primarily keeping domain/business logic separate from framework etc. I was thinking of having all business logic in a domain/ folder with a bunch of typescript files divided into "business functionality". But instead of reinventing the wheel it would be cool to see a "best practice" example. Thank you!
2 replies
TTCTheo's Typesafe Cult
Created by O2K on 5/26/2023 in #questions
Typescript giving benign error: 'caller' implicitly has type 'any'...
1 replies
TTCTheo's Typesafe Cult
Created by O2K on 2/18/2023 in #questions
Typechecking sometimes break when trying to access fields on a variable
1 replies
TTCTheo's Typesafe Cult
Created by O2K on 1/21/2023 in #questions
Ensure uniqueness for zod schema field
Hello! I am using react-hook-form and have the following zod object to validate the input participants:
z.object({
email: z // Should be unique (not same as any other participant.email)
.string()
.email({
message: tParticipant("fields.email.rules.pattern"),
})
.min(1, {
message: tParticipant("fields.email.rules.required"),
}),
name: z // Should be unique (not same as any other participant.name)
.string()
.min(1, { message: tParticipant("fields.name.rules.required") })
})
.array()
z.object({
email: z // Should be unique (not same as any other participant.email)
.string()
.email({
message: tParticipant("fields.email.rules.pattern"),
})
.min(1, {
message: tParticipant("fields.email.rules.required"),
}),
name: z // Should be unique (not same as any other participant.name)
.string()
.min(1, { message: tParticipant("fields.name.rules.required") })
})
.array()
How can I validate using Zod that each email is unique, aswell as each name ? Something like a .unique() is what I am looking for 🙂 Thank you!
14 replies
TTCTheo's Typesafe Cult
Created by O2K on 1/6/2023 in #questions
Good npm package for displaying weighted hypergraph? (T3 App)
5 replies
TTCTheo's Typesafe Cult
Created by O2K on 12/22/2022 in #questions
Securing parametrized routers
Hi! I want to generate a bunch of pages and that each belong to an individual outside of the application, lets call them customers. (Using T3) So I have a parametrized route like this: /[customerid].tsx which needs to be easily accessible from an email sent to the customer. Confidentiality is not a life or death question but the higher it is the better (without sacrificing availability). Is it enough to have a tricky [customerid] like a uuid/cuid and make sure its not indexed by search engines? Or would you add a passphrase on this page as an extra layer? Thanks
3 replies
TTCTheo's Typesafe Cult
Created by O2K on 12/15/2022 in #questions
Best practice for using router types on client-side?
I saw that in T3s src/utils/trpc.ts we are provided with:
export type RouterInputs = inferRouterInputs<AppRouter>;
export type RouterOutputs = inferRouterOutputs<AppRouter>;
export type RouterInputs = inferRouterInputs<AppRouter>;
export type RouterOutputs = inferRouterOutputs<AppRouter>;
Can I effectively use this at the client-side like: const response: RouterOutputs['example']['hello'] or would that import a lot of unnecessary types at the client? Defining the types one by one and having to name them like: type HelloOutput = RouterOutputs['example']['hello'] is doable but annoying. Preferably I would like to avoid this step. Is that possible in a non-stupid way? 😄
3 replies
TTCTheo's Typesafe Cult
Created by O2K on 10/30/2022 in #questions
tRPC queries&mutations really slow on Vercel+Planetscale deployment
3 replies