Etan
Etan
TTCTheo's Typesafe Cult
Created by Peter on 9/13/2024 in #questions
PlanetScale vs. AWS
supabase has been solid for me. Been pretty cheap compared to neon. Neon is decent if you want excellent branching support
8 replies
TTCTheo's Typesafe Cult
Created by Timmo on 9/15/2024 in #questions
Looking for a calendar aggregation service with a decent API
What's wrong with parsing a file and merging them together?
6 replies
TTCTheo's Typesafe Cult
Created by asdfasdf on 10/20/2023 in #questions
Upgrade or Rewrite?
What is "upgrade"? Is a refactor out of the question? Typically when random errors pops up from changes, that indicates tightly coupled code. Instead of a re-write, can just refactor parts that are messy. Great for incremental changes and you should be able to rely on your unit tests for safety
5 replies
TTCTheo's Typesafe Cult
Created by EggsLeggs on 7/29/2023 in #questions
Hosting platform for docker images (discord bot specifically)
I hesitantly reccomend fly. Their platform is great, but they just migrated one of our services at my company without warning and caused a few outages for us... They're a good service but they're not the most communicative 😅
45 replies
TTCTheo's Typesafe Cult
Created by mathels on 7/1/2023 in #questions
should i buy a mac ?
i recently just swapped from windows to mac. Docker ran terribly on windows, mac seems to do alright. WSL in my experience is always really finicky and i never get a seamless experience with it. Since Macbook is FreeBSD based, developing on it has a lot of parelels with other unix based systems so it's really nice cross platform. Performance on my M2 is phenomenal and the development tools for macbook (homebrew, raycast/alfred, etc) has recently just taken off and is phenomenal. It is a bit of a luxury, and you can get away with just a windows, especially if you do a lot of gaming. But if you develop a lot, recommend you at least try out a macbook. Its a luxury and i'm a cheap ass, but i program way too much to cheap out on optimizing my workflow
20 replies
TTCTheo's Typesafe Cult
Created by Massukka on 6/18/2023 in #questions
Read pg db types and constraints automatically?
I also know Drizzle has a db inspector that generates types as well, but it's incredibly new and still lacking quite a few features
6 replies
TTCTheo's Typesafe Cult
Created by Massukka on 6/18/2023 in #questions
Read pg db types and constraints automatically?
i use https://www.npmjs.com/package/zapatos allows you to generate types from a postgres db. It's not the best tool but it's nice so far
6 replies
TTCTheo's Typesafe Cult
Created by ed.upton on 6/4/2023 in #questions
Use Clerk `getAuth(req)` in a Zact server action
So i'm trying to create a context with zact server actions
import { auth } from "@clerk/nextjs"
import { zact } from "zact/server"
import z from "zod"

import { getDb } from "./db/get-db"

export type ContextType = {
auth: ReturnType<typeof auth>
db: ReturnType<typeof getDb>
}

export function withContext<InputType extends z.ZodTypeAny>(
inputType: InputType
) {
const ctx = {
auth: auth(),
db: getDb(),
}

return function <ResponseType extends any>(
action: (actionCtx: {
input: z.infer<InputType>
ctx: ContextType
}) => Promise<ResponseType>
) {
const validatedAction = zact(inputType)(async (input) => {
return action({ input, ctx })
})

return validatedAction
}
}
import { auth } from "@clerk/nextjs"
import { zact } from "zact/server"
import z from "zod"

import { getDb } from "./db/get-db"

export type ContextType = {
auth: ReturnType<typeof auth>
db: ReturnType<typeof getDb>
}

export function withContext<InputType extends z.ZodTypeAny>(
inputType: InputType
) {
const ctx = {
auth: auth(),
db: getDb(),
}

return function <ResponseType extends any>(
action: (actionCtx: {
input: z.infer<InputType>
ctx: ContextType
}) => Promise<ResponseType>
) {
const validatedAction = zact(inputType)(async (input) => {
return action({ input, ctx })
})

return validatedAction
}
}
And then i import this into my action
"use server"

import { auth } from "@clerk/nextjs"
import { z } from "zod"

import { users } from "../db/schema"
import { withContext } from "../with-context"

export const addResource = withContext(
z.object({
url: z.string(),
name: z.string(),
tags: z.array(z.string()),
})
)(async ({ input, ctx }) => {
const user = auth()
console.log(user)

const result = await ctx.db.select().from(users)
console.log("Got resource: ", input)
return { status: 1 }
})
"use server"

import { auth } from "@clerk/nextjs"
import { z } from "zod"

import { users } from "../db/schema"
import { withContext } from "../with-context"

export const addResource = withContext(
z.object({
url: z.string(),
name: z.string(),
tags: z.array(z.string()),
})
)(async ({ input, ctx }) => {
const user = auth()
console.log(user)

const result = await ctx.db.select().from(users)
console.log("Got resource: ", input)
return { status: 1 }
})
And then i prop drill the action into my client component and it still errors out. Is this not allowed?
14 replies
TTCTheo's Typesafe Cult
Created by ed.upton on 6/4/2023 in #questions
Use Clerk `getAuth(req)` in a Zact server action
i'm calling a server action from my client component but clerk is yelling at me with the same "auth() are only supported in app router"
14 replies
TTCTheo's Typesafe Cult
Created by ed.upton on 6/4/2023 in #questions
Use Clerk `getAuth(req)` in a Zact server action
sorry do you mind elaborating on this?
14 replies