right before packages, env, db, and auth refactor

removing env validation, moving db and auth to each app
This commit is contained in:
Maze Winther
2025-11-26 09:42:44 +01:00
parent 04c09b439b
commit 811491ba9c
13 changed files with 346 additions and 31 deletions
+30
View File
@@ -0,0 +1,30 @@
import { z } from "zod";
const toolsEnvSchema = z.object({
// Node
NODE_ENV: z.enum(["development", "production", "test"]),
ANALYZE: z.string().optional(),
NEXT_RUNTIME: z.enum(["nodejs", "edge"]).optional(),
// Public
NEXT_PUBLIC_SITE_URL: z.url().default("http://localhost:3000"),
NEXT_PUBLIC_MARBLE_API_URL: z.url(),
// Server
DATABASE_URL: z
.string()
.startsWith("postgres://")
.or(z.string().startsWith("postgresql://")),
BETTER_AUTH_SECRET: z.string(),
UPSTASH_REDIS_REST_URL: z.url(),
UPSTASH_REDIS_REST_TOKEN: z.string(),
CLOUDFLARE_ACCOUNT_ID: z.string(),
R2_ACCESS_KEY_ID: z.string(),
R2_SECRET_ACCESS_KEY: z.string(),
R2_BUCKET_NAME: z.string(),
});
export type ToolsEnv = z.infer<typeof toolsEnvSchema>;
export const toolsEnv = toolsEnvSchema.parse(process.env);
+3 -3
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
const envSchema = z.object({
const webEnvSchema = z.object({
// Node
NODE_ENV: z.enum(["development", "production", "test"]),
ANALYZE: z.string().optional(),
@@ -29,6 +29,6 @@ const envSchema = z.object({
MODAL_TRANSCRIPTION_URL: z.url(),
});
export type Env = z.infer<typeof envSchema>;
export type WebEnv = z.infer<typeof webEnvSchema>;
export const env = envSchema.parse(process.env);
export const webEnv = webEnvSchema.parse(process.env);