From ac4b85bbc19cc08c021b9674fb2800655a71c532 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 02:34:17 +0100 Subject: [PATCH] auto-claude: subtask-8-4 - Create optimization recommendations document Create comprehensive OPTIMIZATION_RECOMMENDATIONS.md based on audit results: - Priority 1: Critical optimizations (image compression, production verification) - Priority 2: High-impact (client component audit, loading states, blur placeholders) - Priority 3: Medium-impact (reduced motion, third-party scripts, font loading, DB indexes) - Priority 4: Strategic (PWA, bundle analysis, edge caching, CDN optimization) - Implementation roadmap with weekly/monthly milestones - Success metrics and targets Co-Authored-By: Claude Opus 4.5 --- OPTIMIZATION_RECOMMENDATIONS.md | 562 ++++++++++++++++++++++++++++++++ 1 file changed, 562 insertions(+) create mode 100644 OPTIMIZATION_RECOMMENDATIONS.md diff --git a/OPTIMIZATION_RECOMMENDATIONS.md b/OPTIMIZATION_RECOMMENDATIONS.md new file mode 100644 index 0000000..3fbc5b6 --- /dev/null +++ b/OPTIMIZATION_RECOMMENDATIONS.md @@ -0,0 +1,562 @@ +# Optimization Recommendations Report + +**Project:** damjan-savic.com Portfolio Website +**Date:** 2026-01-25 +**Prepared by:** auto-claude +**Status:** Final Recommendations (Post-Audit) + +--- + +## Executive Summary + +This document provides comprehensive optimization recommendations based on the completed SEO audit, performance testing, and implementation work. The recommendations are organized by priority and impact, covering areas from quick wins to strategic long-term improvements. + +### Current State + +| Category | Status | Score | +|----------|--------|-------| +| SEO | ✅ Complete | 100% | +| Accessibility | ✅ Passing | 92-100% | +| Best Practices | ✅ Passing | 100% | +| Performance (Dev) | ⚠️ Expected Low | 47-69%* | +| Performance (Prod) | 📋 To Verify | Expected 85-95% | + +*Development mode scores are lower due to unminified code, HMR overhead, and source maps. + +--- + +## Priority 1: Critical Optimizations (Immediate Action) + +### 1.1 Image Optimization - Hero Portrait + +**Issue:** The hero portrait image is 2.9 MB, significantly impacting LCP and overall page weight. + +**File:** `/public/hero-portrait.jpg` +**Current Size:** 2,957,516 bytes (~2.9 MB) +**Target Size:** < 500 KB (80-85% reduction) + +**Recommendations:** +```bash +# Option 1: Manual compression with ImageMagick +magick hero-portrait.jpg -quality 82 -strip hero-portrait-optimized.jpg + +# Option 2: Convert to WebP format +magick hero-portrait.jpg -quality 80 hero-portrait.webp + +# Option 3: Use AVIF for maximum compression +magick hero-portrait.jpg -quality 60 hero-portrait.avif +``` + +**Implementation Steps:** +1. Compress original to <500KB maintaining visual quality +2. Generate responsive variants (300, 600, 900, 1200px widths) +3. Create AVIF and WebP versions for modern browser support +4. Update Next.js Image component with blur placeholder +5. Add `fetchpriority="high"` for LCP optimization + +**Expected Improvement:** +- LCP: -1.5 to 2.0 seconds +- Page weight: -2.0 to 2.5 MB +- Mobile performance: +15-25 points + +--- + +### 1.2 Unused Large Images Cleanup + +**Issue:** Multiple large image files may not be referenced in production. + +**Files to Audit:** +| File | Size | Status | +|------|------|--------| +| `/public/portrait.jpg` | 1.2 MB | Verify usage | +| `/public/hero-portrait.jpg` | 2.9 MB | Needs optimization | + +**Recommendation:** +1. Run image usage audit: + ```bash + grep -r "portrait.jpg" src/ --include="*.tsx" --include="*.ts" + grep -r "hero-portrait.jpg" src/ --include="*.tsx" --include="*.ts" + ``` +2. Replace references with optimized versions +3. Remove unused originals from `/public` + +--- + +### 1.3 Production Performance Verification + +**Issue:** PageSpeed API was blocked during testing. Production verification required. + +**Action Required:** +1. Visit [PageSpeed Insights](https://pagespeed.web.dev/) +2. Test all main URLs: + - `https://www.damjan-savic.com/de` + - `https://www.damjan-savic.com/en` + - `https://www.damjan-savic.com/sr` + - `https://www.damjan-savic.com/de/about` + - `https://www.damjan-savic.com/de/portfolio` + - `https://www.damjan-savic.com/de/contact` + +3. Document scores for Desktop and Mobile +4. If any score < 90%, implement specific recommendations from report + +--- + +## Priority 2: High-Impact Optimizations (This Sprint) + +### 2.1 Client Component Audit + +**Issue:** 13 client-side components identified. Some may be convertible to React Server Components (RSC). + +**Current Client Components:** + +| Component | Client Necessary? | Recommendation | +|-----------|-------------------|----------------| +| Header.tsx | ✅ Yes | Scroll/menu state | +| ContactForm.tsx | ✅ Yes | Form state | +| LoginForm.tsx | ✅ Yes | Form state | +| PortfolioCard.tsx | 🔍 Review | Consider RSC | +| PortfolioGrid.tsx | 🔍 Review | Consider RSC | +| NavLink.tsx | 🔍 Review | Consider RSC | +| ContactInfo.tsx | 🔍 Review | Consider RSC | +| Skills.tsx | 🔍 Review | Animation-dependent | +| Experience.tsx | 🔍 Review | Animation-dependent | +| Hero.tsx (about) | 🔍 Review | Animation-dependent | +| LanguageSwitcher.tsx | ✅ Yes | Dropdown state | +| DashboardContent.tsx | ✅ Yes | Auth state | +| Chatbot.tsx | ✅ Yes | Interactive | + +**Recommendation:** +1. For animation-dependent components, consider: + - Static initial render as RSC + - Minimal client wrapper for animations only + - Use CSS animations where possible (GPU-accelerated) + +2. Conversion pattern: + ```tsx + // Before: Full client component + 'use client'; + export function PortfolioCard({ project }) { + return
{/* all content */}
; + } + + // After: Server component with client wrapper + export function PortfolioCard({ project }) { + return ( + +
{/* static content */}
+
+ ); + } + ``` + +**Expected Improvement:** +- JavaScript bundle: -50-150 KB +- TTI (Time to Interactive): -200-500ms + +--- + +### 2.2 Loading States and Suspense Boundaries + +**Issue:** No loading.tsx files detected for route segments. + +**Recommendation:** +Create loading states for improved perceived performance: + +```tsx +// src/app/[locale]/loading.tsx +export default function Loading() { + return ( +
+
+
+
+
+ ); +} + +// src/app/[locale]/portfolio/loading.tsx +export default function PortfolioLoading() { + return ( +
+ {[...Array(6)].map((_, i) => ( +
+ ))} +
+ ); +} +``` + +**Files to Create:** +- `src/app/[locale]/loading.tsx` +- `src/app/[locale]/about/loading.tsx` +- `src/app/[locale]/portfolio/loading.tsx` +- `src/app/[locale]/contact/loading.tsx` + +--- + +### 2.3 Blur Placeholder for Hero Image + +**Recommendation:** +Add blur placeholder for improved perceived LCP: + +```tsx +// In Hero component +import Image from 'next/image'; + +// Generate blur data URL (base64 encoded tiny version) +const heroBlurDataURL = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."; // Generate with plaiceholder + +Damjan Savić +``` + +**Implementation:** +1. Install plaiceholder: `pnpm add plaiceholder sharp` +2. Generate blur data URLs at build time +3. Update Image components with placeholder prop + +--- + +## Priority 3: Medium-Impact Optimizations (Next Sprint) + +### 3.1 Reduced Motion Support + +**Issue:** Background SVG animations may cause issues for users with vestibular disorders. + +**File:** `/src/components/layout/GlobalBackground.tsx` + +**Recommendation:** +```tsx +// Add media query support +const GlobalBackground = () => { + const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)'); + + if (prefersReducedMotion) { + return ; + } + + return ; +}; + +// Or use CSS-only approach + +``` + +--- + +### 3.2 Third-Party Script Optimization + +**Issue:** Google Analytics may block rendering if not loaded properly. + +**Current Implementation:** Review needed + +**Recommendations:** +1. Use Partytown for off-main-thread execution: + ```bash + pnpm add @builder.io/partytown + ``` + +2. Defer non-critical scripts: + ```tsx + // In layout.tsx or Script component + import Script from 'next/script'; + +