- User model with bcrypt-hashed passwords and admin/user roles
- Auth.js v5 with Credentials provider + JWT sessions
- First-run /setup page creates admin account
- /login page with email+password
- proxy.ts middleware: redirects to /setup or /login for unauthenticated users
- API routes exempt (bridge uses token auth)
- AUTH_SECRET added to env
- Add Prisma 7 with better-sqlite3 adapter
- Define schema: AviationHistory, InstalledPlugin, Setting
- Create data access layer (repository pattern)
- Migrate aviation history queries from Supabase to Prisma
- Auto-migrate on npm run dev via predev script
- Database auto-creates at data/wwv.db on first run
Implemented Vercel Web Analytics for Next.js App Router Project
Changes Made:
=============
1. Installed @vercel/analytics package
- Added @vercel/analytics ^1.6.1 to dependencies in package.json
- Updated package-lock.json with new dependency tree
2. Modified src/app/layout.tsx
- Added import statement: `import { Analytics } from "@vercel/analytics/next";`
- Added <Analytics /> component inside the <body> tag, after {children}
- Preserved all existing code structure, including suppressHydrationWarning and CesiumJS styles
Implementation Details:
======================
This is an App Router Next.js project (using the app directory structure), so the Analytics component was added to the root layout file (src/app/layout.tsx) as per Vercel's official documentation.
The Analytics component was placed after {children} in the body tag to ensure:
- It doesn't interfere with page content rendering
- Analytics scripts load after the main content
- Follows Vercel's recommended placement pattern
Verification:
============
✓ Build completed successfully (npm run build)
✓ All tests passed (npm test) - 30 tests across 5 test suites
✓ TypeScript compilation successful
✓ No linting errors introduced
The implementation follows Next.js 16.1.6 best practices and preserves all existing functionality while adding comprehensive web analytics tracking.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>