Skip to content

chore(map,me,auth): small Next.js hygiene fixes from best-practices review #656

Description

@BigGillyStyle

Grab-bag of small, independently shippable Next.js hygiene fixes found during a best-practices review. None warrants its own issue.

1. map: internal <a>next/link

apps/map/src/app/auth/error/error-component.tsx uses raw <a href> for internal navigation in 3 places (lines 24, 45, 61: /, /auth/signin ×2), forcing full page loads. Everywhere else the app correctly uses next/link. (The shared ESLint config disables @next/next/no-html-link-for-pages, which is why this slipped through.)

2. me: route env vars through the validated env schema

apps/me has a zod-validated src/env.ts (t3-oss, the repo standard) but reads process.env.F3_API_BASE_URL raw in ~7 files (src/app/profile/page.tsx, src/app/api/profile/route.ts, api/profile/{roles,avatar,positions}/route.ts, …) and process.env.NEXT_PUBLIC_SITE_URL raw in the auth route handlers. F3_API_BASE_URL is never validated at all — a missing value fails at request time instead of boot/build. Add both to the src/env.ts schema and import env (matches auth/admin/map/api).

3. @acme/auth: next/react/react-dom should be peerDependencies

packages/auth/package.json declares next, react, react-dom as direct catalog: dependencies, while @acme/api and @acme/shared correctly declare them as peers (next: ">=15.5.18 <17" etc.). Align to peers so the consuming app owns the framework instance.

4. layout metadata polish (auth, me)

  • viewport export (with themeColor) exists in homepage/admin/map layouts but is missing in apps/auth/src/app/layout.tsx and apps/me/src/app/layout.tsx.
  • metadataBase is set only in map; harmless for the auth-gated apps but worth adding wherever OG/absolute URLs get used.
  • apps/me/next.config.ts is the only Next app config without explicit reactStrictMode: true — consistency-only; defer the "what belongs in every config" decision to chore(repo): extract a shared next-config helper and settle the ignoreBuildErrors / build-time-env policy #618's shared helper.

Verification

pnpm turbo build lint typecheck test green; map error page navigates client-side; me fails fast at boot when F3_API_BASE_URL is unset.


🤖 Filed by Claude Code - Fable 5 (Next.js best-practices review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    Low

    Effort

    Low

    App

    Monorepo

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions