diff --git a/README.md b/README.md index 43e9f98..f955a4e 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Fill in your environment variables in the `.env` file: ```env # Database -DATABASE_URL="postgresql://username:password@localhost:5432/your_database_name" +POSTGRES_URL="postgresql://username:password@localhost:5432/your_database_name" # Authentication - Better Auth BETTER_AUTH_SECRET="your-random-32-character-secret-key-here" @@ -92,7 +92,7 @@ Your application will be available at [http://localhost:3000](http://localhost:3 2. Navigate to the **Storage** tab 3. Click **Create** → **Postgres** 4. Choose your database name and region -5. Copy the `DATABASE_URL` from the `.env.local` tab +5. Copy the `POSTGRES_URL` from the `.env.local` tab 6. Add it to your `.env` file ### Google OAuth Credentials @@ -171,7 +171,7 @@ npm run db:reset # Reset database (drop all tables) Ensure these are set in your production environment: -- `DATABASE_URL` - Production PostgreSQL connection string +- `POSTGRES_URL` - Production PostgreSQL connection string - `BETTER_AUTH_SECRET` - Secure random 32+ character string - `GOOGLE_CLIENT_ID` - Google OAuth Client ID - `GOOGLE_CLIENT_SECRET` - Google OAuth Client Secret diff --git a/drizzle.config.ts b/drizzle.config.ts index 338dc5a..490ea9e 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -1,10 +1,10 @@ -import type { Config } from "drizzle-kit" +import type { Config } from "drizzle-kit"; export default { dialect: "postgresql", schema: "./src/lib/schema.ts", out: "./drizzle", dbCredentials: { - url: process.env.DATABASE_URL!, + url: process.env.POSTGRES_URL!, }, -} satisfies Config \ No newline at end of file +} satisfies Config; diff --git a/env.example b/env.example index 0593f95..27baba2 100644 --- a/env.example +++ b/env.example @@ -1,8 +1,9 @@ # Database -DATABASE_URL= +POSTGRES_URL= # Authentication - Better Auth -BETTER_AUTH_SECRET="yourauthsecretgoeshere" +# Generate key using https://www.better-auth.com/docs/installation +BETTER_AUTH_SECRET=qtD4Ssa0t5jY7ewALgai97sKhAtn7Ysc # Google OAuth (Get from Google Cloud Console) GOOGLE_CLIENT_ID= diff --git a/src/app/api/diagnostics/route.ts b/src/app/api/diagnostics/route.ts index 0dbe60e..eb3b579 100644 --- a/src/app/api/diagnostics/route.ts +++ b/src/app/api/diagnostics/route.ts @@ -5,7 +5,7 @@ type StatusLevel = "ok" | "warn" | "error"; interface DiagnosticsResponse { timestamp: string; env: { - DATABASE_URL: boolean; + POSTGRES_URL: boolean; BETTER_AUTH_SECRET: boolean; GOOGLE_CLIENT_ID: boolean; GOOGLE_CLIENT_SECRET: boolean; @@ -29,7 +29,7 @@ interface DiagnosticsResponse { export async function GET(req: Request) { const env = { - DATABASE_URL: Boolean(process.env.DATABASE_URL), + POSTGRES_URL: Boolean(process.env.POSTGRES_URL), BETTER_AUTH_SECRET: Boolean(process.env.BETTER_AUTH_SECRET), GOOGLE_CLIENT_ID: Boolean(process.env.GOOGLE_CLIENT_ID), GOOGLE_CLIENT_SECRET: Boolean(process.env.GOOGLE_CLIENT_SECRET), @@ -41,7 +41,7 @@ export async function GET(req: Request) { let dbConnected = false; let schemaApplied = false; let dbError: string | undefined; - if (env.DATABASE_URL) { + if (env.POSTGRES_URL) { try { const [{ db }, { sql }, schema] = await Promise.all([ import("@/lib/db"), @@ -65,7 +65,7 @@ export async function GET(req: Request) { } else { dbConnected = false; schemaApplied = false; - dbError = "DATABASE_URL is not set"; + dbError = "POSTGRES_URL is not set"; } // Auth route check: we consider the route responding if it returns any HTTP response @@ -95,7 +95,7 @@ export async function GET(req: Request) { const aiConfigured = env.OPENAI_API_KEY; // We avoid live-calling the AI provider here const overallStatus: StatusLevel = (() => { - if (!env.DATABASE_URL || !dbConnected || !schemaApplied) return "error"; + if (!env.POSTGRES_URL || !dbConnected || !schemaApplied) return "error"; if (!authConfigured) return "error"; // AI is optional; warn if not configured if (!aiConfigured) return "warn"; diff --git a/src/app/page.tsx b/src/app/page.tsx index 33197bf..ec8a339 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -63,7 +63,7 @@ export default function Home() { configure: