diff --git a/.env.example b/.env.example index 1e526d56..4852d63e 100644 --- a/.env.example +++ b/.env.example @@ -2,23 +2,11 @@ # Database # DATABASE_URL="postgres://postgres:password@localhost:5432/postgres" - # # AUTH # NEXTAUTH_SECRET="koXrQGB5TFD4KALDX4kAvnQ5RHHvAOIzB" NEXTAUTH_URL="http://localhost:3000" - -# PRISMA STUDIO DOCKER -POSTGRES_URL=postgres://postgres:postgres@db:5432/job-board-db -POSTGRES_HOST=db -POSTGRES_USERNAME=postgres -POSTGRES_PASSWORD=postgres - -AWS_S3_REGION=your-aws-region -AWS_S3_ACCESS_KEY_ID=your-access-ID -AWS_S3_SECRET_ACCESS_KEY=your-access-key -AWS_S3_BUCKET_NAME=your-bucket # # Bunny CDN # diff --git a/docker-compose.yaml b/docker-compose.yaml index 1b8a171c..7d0f3826 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -46,4 +46,4 @@ services: - 5555:5555 volumes: - postgres-data: + postgres-data: \ No newline at end of file diff --git a/next.config.js b/next.config.js index ae3b9839..5093fc1e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,12 @@ +import { fileURLToPath } from "node:url"; +import createJiti from "jiti"; + +const jiti = createJiti(fileURLToPath(import.meta.url)); + +// Import env here to validate during build. Using jiti we can import .ts files :) +jiti("./src/env/client"); +jiti("./src/env/server"); + /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, @@ -9,12 +18,11 @@ const nextConfig = { images: { remotePatterns: [ { - protocol: 'https', - //Change it with your cdn access domain here - hostname: 'job-board.b-cdn.net', + protocol: "https", + hostname: "job-board.b-cdn.net", // Change this to your CDN domain }, ], }, }; -module.exports = nextConfig; +export default nextConfig; // ES module export \ No newline at end of file diff --git a/package.json b/package.json index 71e1acb9..c4a08bcd 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "100xdevs-job-board", "version": "0.1.0", "private": true, + "type": "module", "scripts": { "dev": "next dev", "build": "next build", @@ -47,6 +48,7 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", + "@t3-oss/env-nextjs": "^0.11.1", "@types/lodash": "^4.17.7", "@types/uuid": "^10.0.0", "@uidotdev/usehooks": "^2.4.1", @@ -56,6 +58,7 @@ "dayjs": "^1.11.13", "framer-motion": "^11.5.4", "linkify-react": "^4.1.3", + "jiti": "^1.21.6", "lodash": "^4.17.21", "lucide-react": "^0.426.0", "next": "^14.2.12", diff --git a/src/app/api/upload-to-cdn/route.ts b/src/app/api/upload-to-cdn/route.ts index 35167c03..9f34d64a 100644 --- a/src/app/api/upload-to-cdn/route.ts +++ b/src/app/api/upload-to-cdn/route.ts @@ -1,9 +1,10 @@ +import { serverEnv } from '@/env/server'; import { NextResponse } from 'next/server'; import { v4 as uuidv4 } from 'uuid'; -const CDN_BASE_UPLOAD_URL = process.env.CDN_BASE_UPLOAD_URL; -const CDN_BASE_ACCESS_URL = process.env.CDN_BASE_ACCESS_URL; -const CDN_API_KEY = process.env.CDN_API_KEY!; +const CDN_BASE_UPLOAD_URL = serverEnv.CDN_BASE_UPLOAD_URL; +const CDN_BASE_ACCESS_URL = serverEnv.CDN_BASE_ACCESS_URL; +const CDN_API_KEY = serverEnv.CDN_API_KEY!; export async function POST(req: Request): Promise { try { diff --git a/src/components/UserCard.tsx b/src/components/UserCard.tsx index 11323614..7bdaa4f8 100644 --- a/src/components/UserCard.tsx +++ b/src/components/UserCard.tsx @@ -93,7 +93,7 @@ function UserCard() { {profiles.map((profile, index) => (