chore: reorganize project structure and ensure default queues

This commit is contained in:
Esdras Renan 2025-10-06 22:59:35 -03:00
parent 854887f499
commit 1cccb852a5
201 changed files with 417 additions and 838 deletions

23
src/lib/env.ts Normal file
View file

@ -0,0 +1,23 @@
import { z } from "zod"
const envSchema = z.object({
BETTER_AUTH_SECRET: z.string().min(1, "Missing BETTER_AUTH_SECRET"),
BETTER_AUTH_URL: z.string().url().optional(),
NEXT_PUBLIC_CONVEX_URL: z.string().url().optional(),
DATABASE_URL: z.string().min(1).optional(),
NEXT_PUBLIC_APP_URL: z.string().url().optional(),
})
const parsed = envSchema.safeParse(process.env)
if (!parsed.success) {
console.error("Failed to parse environment variables", parsed.error.flatten().fieldErrors)
throw new Error("Invalid environment configuration")
}
export const env = {
BETTER_AUTH_SECRET: parsed.data.BETTER_AUTH_SECRET,
BETTER_AUTH_URL: parsed.data.BETTER_AUTH_URL ?? parsed.data.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000",
NEXT_PUBLIC_CONVEX_URL: parsed.data.NEXT_PUBLIC_CONVEX_URL,
DATABASE_URL: parsed.data.DATABASE_URL,
}