diff --git a/bun.lockb b/bun.lockb index b75ed39b..933fa979 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/drizzle.config.ts b/drizzle.config.ts index 815185fd..3347bf9b 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -1,5 +1,5 @@ import type { Config } from "drizzle-kit"; -import { env } from "./src/env.mjs"; +import { env } from "./src/env"; export default { schema: "./src/db/schema/index.ts", diff --git a/next.config.mjs b/next.config.mjs index ecad3871..40783fec 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,12 +1,17 @@ import createMDX from "@next/mdx"; +import { fileURLToPath } from "node:url"; import rehypeSlug from "rehype-slug"; import remarkGfm from "remark-gfm"; -import "./src/env.mjs"; + +import createJiti from "jiti"; + +const jiti = createJiti(fileURLToPath(import.meta.url)); + +jiti("./src/env"); /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, - swcMinify: true, pageExtensions: ["mdx", "ts", "tsx"], experimental: { serverComponentsExternalPackages: ["libsql"], diff --git a/package.json b/package.json index df40bb46..dd41521e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@nextui-org/react": "^2.3.6", "@paralleldrive/cuid2": "^2.2.2", "@radix-ui/react-scroll-area": "^1.0.5", - "@t3-oss/env-nextjs": "^0.7.1", + "@t3-oss/env-nextjs": "^0.10.1", "@tanstack/react-query": "4.36.1", "@tanstack/react-query-next-experimental": "^5.36.0", "@tanstack/react-virtual": "beta", @@ -73,10 +73,10 @@ "encoding": "^0.1.13", "eslint": "8.55.0", "eslint-config-next": "14.2.3", - "framer-motion": "^10.16.16", - "lucide-react": "^0.294.0", + "framer-motion": "^11.2.0", + "lucide-react": "^0.378.0", "next": "14.2.3", - "next-themes": "^0.2.1", + "next-themes": "^0.3.0", "node-fetch": "^3.3.2", "postcss": "8.4.38", "react": "18.3.1", @@ -97,20 +97,21 @@ "tailwindcss": "3.4.3", "typescript": "5.4.5", "use-resize-observer": "^9.1.0", - "usehooks-ts": "^2.9.1", + "usehooks-ts": "^3.1.0", "utf-8-validate": "^6.0.4", "zod": "^3.23.8" }, "devDependencies": { - "@savvywombat/tailwindcss-grid-areas": "^3.1.0", - "@tailwindcss/typography": "^0.5.10", + "@savvywombat/tailwindcss-grid-areas": "^4.0.0", + "@tailwindcss/typography": "^0.5.13", "@types/eslint": "^8.56.10", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", + "@typescript-eslint/eslint-plugin": "^7.9.0", + "@typescript-eslint/parser": "^7.9.0", "drizzle-kit": "^0.20.6", + "jiti": "^1.21.0", "node-gyp": "^10.1.0", "prettier": "^3.2.5", - "prettier-plugin-tailwindcss": "^0.5.9", + "prettier-plugin-tailwindcss": "^0.5.14", "rimraf": "^5.0.7" } } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6719b768..3ea75566 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,6 +2,7 @@ import { CookieBanner, NoodleAnalytics } from "@/components/cookie-banner"; import { ClerkProvider } from "@clerk/nextjs"; import { dark } from "@clerk/themes"; import type { Metadata } from "next"; +import { ThemeProvider } from "next-themes"; import { Inter, JetBrains_Mono } from "next/font/google"; import { siteConfig } from "./config"; import "./globals.css"; @@ -56,7 +57,9 @@ export default function RootLayout({ > - {children} + + {children} + diff --git a/src/app/providers.tsx b/src/app/providers.tsx index 0f56afa4..62b72a43 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -1,8 +1,8 @@ "use client"; import { NextUIProvider } from "@nextui-org/react"; -import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes"; -import { type PropsWithChildren, useEffect, useState } from "react"; +import { useTheme } from "next-themes"; +import { useEffect, useState, type PropsWithChildren } from "react"; import { Toaster } from "sonner"; const ToastProvider = () => { @@ -29,10 +29,8 @@ const ToastProvider = () => { export function Providers({ children }: PropsWithChildren) { return ( - - - {children} - + + {children} ); } diff --git a/src/db/index.ts b/src/db/index.ts index c125c114..7c89a97d 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,4 +1,4 @@ -import { env } from "@/env.mjs"; +import { env } from "@/env"; import { createClient } from "@libsql/client"; import { drizzle } from "drizzle-orm/libsql"; import * as schema from "./schema"; diff --git a/src/env.mjs b/src/env.ts similarity index 69% rename from src/env.mjs rename to src/env.ts index cf284977..50e41220 100644 --- a/src/env.mjs +++ b/src/env.ts @@ -1,30 +1,38 @@ -// @ts-check import { createEnv } from "@t3-oss/env-nextjs"; +import { vercel } from "@t3-oss/env-nextjs/presets"; import { z } from "zod"; export const env = createEnv({ - server: { - DATABASE_URL: z.string().url(), - DATABASE_AUTH_TOKEN: z.string().optional(), + extends: [vercel()], + + shared: { NODE_ENV: z .enum(["development", "test", "production"]) .default("development"), + }, + server: { + // Turso DB + DATABASE_URL: z.string().url(), + DATABASE_AUTH_TOKEN: z.string().optional(), + + // Upstash UPSTASH_REDIS_REST_URL: z.string().optional(), UPSTASH_REDIS_REST_TOKEN: z.string().optional(), + + // Clerk CLERK_SECRET_KEY: z.string().min(1), }, client: { + // Clerk NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1), }, - runtimeEnv: { - DATABASE_URL: process.env.DATABASE_URL, - DATABASE_AUTH_TOKEN: process.env.DATABASE_AUTH_TOKEN, + + experimental__runtimeEnv: { NODE_ENV: process.env.NODE_ENV, - CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, - UPSTASH_REDIS_REST_TOKEN: process.env.UPSTASH_REDIS_REST_TOKEN, - UPSTASH_REDIS_REST_URL: process.env.UPSTASH_REDIS_REST_URL, }, + skipValidation: !!process.env.SKIP_ENV_VALIDATION, + emptyStringAsUndefined: true, }); diff --git a/src/middleware.ts b/src/middleware.ts index 1f9e4621..2c539047 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -2,7 +2,7 @@ import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server"; import { Ratelimit } from "@upstash/ratelimit"; import { Redis } from "@upstash/redis"; import { NextResponse } from "next/server"; -import { env } from "./env.mjs"; +import { env } from "./env"; let redis: Redis; let ratelimit: Ratelimit; diff --git a/src/server/api/trpc.ts b/src/server/api/trpc.ts index 748c49c7..e0236392 100644 --- a/src/server/api/trpc.ts +++ b/src/server/api/trpc.ts @@ -1,5 +1,5 @@ import { db } from "@/db"; -import { env } from "@/env.mjs"; +import { env } from "@/env"; import { getAuth } from "@clerk/nextjs/server"; import { TRPCError, initTRPC } from "@trpc/server"; import { Redis } from "@upstash/redis"; diff --git a/tsconfig.json b/tsconfig.json index bea640ab..28ed41ac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "noEmit": true, "esModuleInterop": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve",