This document outlines the performance optimizations implemented in the Mac Remote Controller website.
- Using Astro's built-in
Imagecomponent for automatic optimization - Lazy loading for below-the-fold images
- Eager loading with high priority for hero images
- Automatic format conversion (WebP/AVIF when supported)
- Responsive image sizing
- Changed
client:loadtoclient:idlefor non-critical components - Components load when browser is idle, not immediately
- Reduces initial JavaScript bundle size
- CSS code splitting enabled
- Manual chunks for better caching
- HTML compression enabled
- Inline stylesheets optimization
- Preconnect to external domains (Google Play)
- Preload critical images
- Optimized viewport meta tag
Hero Section (Above the fold):
<Image
loading="eager"
fetchpriority="high"
/>Below the fold:
<Image
loading="lazy"
/>Critical (Above the fold):
- Use
client:loadfor immediate interactivity - Example: Navigation menu
Non-critical (Below the fold):
- Use
client:idle- loads when browser is idle - Use
client:visible- loads when scrolled into view - Example: Download buttons, feature cards
- Navbar:
client:load(needed immediately) - Download Buttons:
client:idle(can wait) - Other sections: Static (no JavaScript needed)
If adding custom fonts:
<link
rel="preload"
href="/fonts/font.woff2"
as="font"
type="font/woff2"
crossorigin
/>Extract and inline critical CSS for above-the-fold content.
Add a service worker for offline support and caching:
bun add @astrojs/service-workerDeploy to a CDN (Vercel, Netlify, Cloudflare Pages) for global edge caching.
Use lightweight analytics:
- Consider privacy-friendly options
- Load asynchronously
- Use
client:idledirective
- Lighthouse Score: 90+ (Performance)
- First Contentful Paint (FCP): < 1.8s
- Largest Contentful Paint (LCP): < 2.5s
- Time to Interactive (TTI): < 3.8s
- Total Blocking Time (TBT): < 200ms
- Cumulative Layout Shift (CLS): < 0.1
-
Lighthouse (Chrome DevTools)
- Run Lighthouse audit
- Check Performance score
-
WebPageTest
- Test from multiple locations
- Check Core Web Vitals
-
Chrome DevTools Performance Tab
- Record page load
- Analyze bottlenecks
# Development (fast refresh)
bun dev
# Production build (optimized)
bun build
# Preview production build
bun previewConsider adding:
- Real User Monitoring (RUM)
- Performance monitoring service
- Error tracking
- Analytics
- Astro ships zero JavaScript by default
- Only interactive components need JavaScript
- Static content is pre-rendered at build time
- Images are optimized automatically with Astro Image component