diff --git a/apps/site/.env.example b/apps/site/.env.example new file mode 100644 index 0000000..0f53686 --- /dev/null +++ b/apps/site/.env.example @@ -0,0 +1,4 @@ +# Public URL of the deployed web app, used by marketing-site auth CTAs. +# Local example: http://127.0.0.1:3000 +# Production example: https://app.example.com +NEXT_PUBLIC_APP_URL= diff --git a/apps/site/.gitignore b/apps/site/.gitignore index 5ef6a52..7b8da95 100644 --- a/apps/site/.gitignore +++ b/apps/site/.gitignore @@ -32,6 +32,7 @@ yarn-error.log* # env files (can opt-in for committing if needed) .env* +!.env.example # vercel .vercel diff --git a/apps/site/README.md b/apps/site/README.md index e215bc4..7596a02 100644 --- a/apps/site/README.md +++ b/apps/site/README.md @@ -18,6 +18,16 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +## Environment Variables + +Create `apps/site/.env.local` and set: + +```bash +NEXT_PUBLIC_APP_URL=http://127.0.0.1:3000 +``` + +Use your deployed `apps/web` URL in production so the marketing site login and signup buttons resolve correctly. + This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. ## Learn More diff --git a/apps/site/components/header.tsx b/apps/site/components/header.tsx index bdfe15d..6824eea 100644 --- a/apps/site/components/header.tsx +++ b/apps/site/components/header.tsx @@ -4,6 +4,7 @@ import Link from "next/link" import React from "react" import { Logo } from "@/components/logo" import { Button } from "@/components/ui/button" +import { appLinks } from "@/lib/app-links" import { useSiteI18n } from "@/lib/site-i18n" import { cn } from "@/lib/utils" @@ -161,17 +162,17 @@ export const HeroHeader = ({ previewMode, onPreviewModeChange }: HeroHeaderProps size="sm" variant="outline" > - + {t.nav.login} diff --git a/apps/site/components/site-header.tsx b/apps/site/components/site-header.tsx index b6036a3..5242b09 100644 --- a/apps/site/components/site-header.tsx +++ b/apps/site/components/site-header.tsx @@ -4,6 +4,7 @@ import Link from "next/link" import React from "react" import { Logo } from "@/components/logo" import { Button } from "@/components/ui/button" +import { appLinks } from "@/lib/app-links" import { useSiteI18n } from "@/lib/site-i18n" import { cn } from "@/lib/utils" @@ -103,17 +104,17 @@ export const SiteHeader = () => { size="sm" variant="outline" > - + {t.nav.login} diff --git a/apps/site/lib/app-links.ts b/apps/site/lib/app-links.ts new file mode 100644 index 0000000..5ca5d4d --- /dev/null +++ b/apps/site/lib/app-links.ts @@ -0,0 +1,12 @@ +const DEFAULT_APP_URL = "http://127.0.0.1:3000" + +function normalizeBaseUrl(url: string) { + return url.endsWith("/") ? url.slice(0, -1) : url +} + +const appBaseUrl = normalizeBaseUrl(process.env.NEXT_PUBLIC_APP_URL || DEFAULT_APP_URL) + +export const appLinks = { + login: `${appBaseUrl}/login`, + signup: `${appBaseUrl}/signup`, +} diff --git a/apps/web/package.json b/apps/web/package.json index 0873cfb..f89bdaf 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -11,7 +11,7 @@ "lint": "biome lint .", "db:generate": "drizzle-kit generate", "db:migrate": "drizzle-kit migrate", - "db:push": "drizzle-kit push", + "db:push": "dotenv -e .env.local -- tsx scripts/ensure-extensions.ts && drizzle-kit push", "db:studio": "drizzle-kit studio" }, "dependencies": { diff --git a/turbo.json b/turbo.json index 47ad2ad..c5f383e 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,21 @@ "build": { "inputs": ["$TURBO_DEFAULT$", ".env*"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"], - "dependsOn": ["^build"] + "dependsOn": ["^build"], + "env": [ + "DATABASE_URL", + "BETTER_AUTH_SECRET", + "BETTER_AUTH_URL", + "NEXT_PUBLIC_APP_URL", + "BLOB_READ_WRITE_TOKEN", + "KV_REST_API_READ_ONLY_TOKEN", + "KV_REST_API_TOKEN", + "KV_REST_API_URL", + "KV_URL", + "REDIS_URL", + "CHROMIUM_EXECUTABLE_PATH", + "VERCEL_ENV" + ] }, "dev": { "cache": false,