2 Commits

Author SHA1 Message Date
e9b5fcce43 fix: improve env onboarding and dev error messages 2026-01-04 01:22:25 +05:30
1648a56680 script update 2025-11-02 15:49:58 +05:30
5 changed files with 20 additions and 10 deletions

3
.env.example Normal file
View File

@@ -0,0 +1,3 @@
ADMIN_DOMAIN = http://localhost:9001
DATABASE_URL = postgresql://postgres:postgres@localhost:5432/nextplacement
AUTH_SECRET= change_me_to_a_long_random_string

View File

@@ -5,8 +5,8 @@
"private": true,
"scripts": {
"dev": "dotenv -e ../../.env -- next dev --turbopack -p 9001",
"build": "dotenv -e ../../.env -- next build",
"start": "dotenv -e ../../.env -- next start -p 9001",
"build": "dotenv -e ../../.env -- next build && cp -r .next/static .next/standalone/apps/admin/.next/static && cp -r public .next/standalone/apps/admin/public",
"start": "PORT=9001 dotenv -e ../../.env -- node .next/standalone/apps/admin/server.js",
"lint": "next lint",
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit"

View File

@@ -2,6 +2,7 @@
import path from 'path';
const __dirname = path.resolve();
const adminDomain = process.env.ADMIN_DOMAIN || "http://localhost:9001";
const nextConfig = {
transpilePackages: ['@workspace/ui', '@workspace/db'],
@@ -11,15 +12,15 @@ const nextConfig = {
return [
{
source: '/admin',
destination: `${process.env.ADMIN_DOMAIN}/admin`,
destination: `${adminDomain}/admin`,
},
{
source: '/admin/:path+',
destination: `${process.env.ADMIN_DOMAIN}/admin/:path+`,
destination: `${adminDomain}/admin/:path+`,
},
{
source: '/admin-static/:path+',
destination: `${process.env.ADMIN_DOMAIN}/admin-static/:path+`,
destination: `${adminDomain}/admin-static/:path+`,
}
];
}

View File

@@ -5,8 +5,8 @@
"private": true,
"scripts": {
"dev": "dotenv -e ../../.env -- next dev --turbopack -p 9000",
"build": "dotenv -e ../../.env -- next build",
"start": "dotenv -e ../../.env -- next start -p 9000",
"build": "dotenv -e ../../.env -- next build && cp -r .next/static .next/standalone/apps/student/.next/static && cp -r public .next/standalone/apps/student/public",
"start": "PORT=9000 dotenv -e ../../.env -- node .next/standalone/apps/student/server.js",
"lint": "next lint",
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit"
@@ -20,7 +20,7 @@
"framer-motion": "^12.22.0",
"lucide-react": "^0.475.0",
"next": "^15.3.4",
"next-auth": "5.0.0-beta.30",
"next-auth": "5.0.0-beta.29",
"next-themes": "^0.4.6",
"react": "^19.1.0",
"react-dom": "^19.1.0",

View File

@@ -1,6 +1,12 @@
import { drizzle } from 'drizzle-orm/neon-http';
import * as schema from './schema.ts';
export const db = drizzle(process.env.DATABASE_URL!, { schema });
const databaseUrl = process.env.DATABSE_URL;
export * from './schema.ts';
if(!databaseUrl) {
throw new Error{
"DTABASE_URL is missing. Create the required env file (see .env.example) and set DATABASE_URL"
};
}
export const db = drizzle(databaseUrl, { schema });