# Next.js 14.2.35 → 15 Upgrade Checklist

## ✅ Pre-Upgrade Verification

- [ ] Create feature branch: `git checkout -b upgrade/next-15`
- [ ] Commit current work: `git add . && git commit -m "Pre-upgrade checkpoint"`
- [ ] Run full test suite: `npm run test`
- [ ] Check TypeScript: `npm run typecheck`
- [ ] Note current version: `npm ls next` (should be 14.2.35)

## 🔧 Upgrade Steps

### Step 1: Update Next.js
```bash
npm install next@15 --save
npm install
```

### Step 2: Run Development Server
```bash
npm run dev
```
- [ ] Dev server starts without errors
- [ ] No TypeScript errors
- [ ] HMR (hot reload) working

### Step 3: Type Checking
```bash
npm run typecheck
```
- [ ] No new type errors introduced
- [ ] All types resolve correctly

### Step 4: Run Tests
```bash
npm run test
```
- [ ] All tests pass
- [ ] No test breakage
- [ ] Coverage maintained

### Step 5: Production Build
```bash
npm run build
```
- [ ] Build completes successfully
- [ ] Build size similar to before (within ±5%)
- [ ] No build warnings
- [ ] Check `.next` directory size: `du -sh .next/`

### Step 6: Test Production Build
```bash
npm run start
```
- [ ] Production build starts
- [ ] No runtime errors
- [ ] Can navigate application

## 🧪 Manual Testing Checklist

### Public Pages
- [ ] Home page loads and renders
- [ ] Search page loads (with map)
- [ ] Listing detail page loads with images
- [ ] Image gallery works (previous/next buttons)

### Authentication
- [ ] Login page loads
- [ ] Register page loads
- [ ] Auth callbacks work (Google, Zalo)
- [ ] Cookies set/cleared correctly
- [ ] Redirect to login works for protected pages

### Internationalization (i18n)
- [ ] English version loads: `/en/*`
- [ ] Vietnamese version loads: `/vi/*`
- [ ] Locale switching works
- [ ] Language preference persists
- [ ] Middleware locale detection works

### Dashboard (Protected)
- [ ] Dashboard page loads
- [ ] Listings page works
- [ ] Create new listing flow
- [ ] Edit listing flow
- [ ] Payments/Subscription pages load
- [ ] Profile page loads
- [ ] KYC page loads
- [ ] Valuation page loads

### Admin Panel
- [ ] Admin dashboard loads
- [ ] Users page loads
- [ ] KYC review page loads
- [ ] Moderation page loads

### Performance
- [ ] Page load times reasonable
- [ ] No console errors
- [ ] No console warnings
- [ ] No memory leaks detected
- [ ] Network requests functioning

### Special Features
- [ ] Mapbox GL maps load correctly
- [ ] Image optimization working
- [ ] CSP headers correct
- [ ] Sentry error tracking working
- [ ] Web vitals reporting working

## 📊 Performance Baseline

Before upgrade:
- Build time: _____ seconds
- Bundle size: _____ MB
- First contentful paint: _____ ms
- Time to interactive: _____ ms

After upgrade:
- Build time: _____ seconds
- Bundle size: _____ MB
- First contentful paint: _____ ms
- Time to interactive: _____ ms

Comparison: _____ (Improvement/No change/Slight increase)

## 🔍 Compatibility Checks

### Dependencies Status
- [ ] @sentry/nextjs@10.47.0 → Working
- [ ] next-intl@4.9.0 → Working
- [ ] @tanstack/react-query@5.96.2 → Working
- [ ] mapbox-gl@3.21.0 → Maps loading correctly
- [ ] All other dependencies → Compatible

### Configuration Files
- [ ] next.config.js → No warnings
- [ ] tsconfig.json → Valid
- [ ] tailwind.config.ts → Building correctly
- [ ] sentry.*.config.ts → Error tracking working

## 🚀 Deployment

### Staging Environment
- [ ] Deploy to staging
- [ ] Full test suite passes in staging
- [ ] Manual smoke testing completed
- [ ] Monitor logs for 30 minutes
- [ ] No errors in error tracking

### Production Environment
- [ ] Create production deployment branch
- [ ] Deploy to production
- [ ] Monitor error logs
- [ ] Monitor performance metrics
- [ ] Check Sentry for new errors
- [ ] Verify all features working
- [ ] Monitor for 24 hours

## ✅ Post-Upgrade Sign-Off

- [ ] All tests passing
- [ ] Build size acceptable
- [ ] Performance acceptable
- [ ] No critical errors
- [ ] Feature parity maintained
- [ ] Ready for production

## 📝 Notes & Issues Found

```
Issue 1: ___________________________________________
Resolution: ________________________________________

Issue 2: ___________________________________________
Resolution: ________________________________________

Issue 3: ___________________________________________
Resolution: ________________________________________
```

## 🎯 Sign-Off

Upgraded by: _____________________
Date: _____________________
Verified by: _____________________
Production deployed: _____________________

---

**If any issues occur, revert with:**
```bash
git revert HEAD
npm install
npm run dev
```
