Skip to main content
Implement these performance optimizations to create fast, responsive applications.

Server Components optimization

Default to Server Components

app/dashboard/page.tsx
Benefits:
  • Faster page loads (no client-side data fetching waterfall)
  • Smaller JavaScript bundles
  • Better SEO (content rendered on server)
  • Secure (API credentials never exposed)

Use React cache() for expensive operations

lib/auth-server.ts

Data fetching patterns

Parallel data fetching

Streaming with Suspense

app/dashboard/page.tsx

Caching strategies

Static Generation with ISR

On-demand revalidation

app/actions.ts

Tagged caching

Image optimization

Use Next.js Image component

Optimize generated images

For AI-generated images from Cloud API:

Code splitting

Dynamic imports

Route-based splitting

Next.js automatically code-splits by route:
Each page only loads its required JavaScript.

Bundle size optimization

Analyze bundle

Tree-shaking

Remove unused dependencies

Database query optimization

Your Starter Kit uses the Cloud API, which handles query optimization. These tips apply if you add custom backend logic.

Minimize API calls

Pagination

Client-side optimization

Debounce expensive operations

Virtualize long lists

Performance monitoring

Vercel Analytics

Already included in Starter Kit:
app/layout.tsx

Core Web Vitals

Monitor in Vercel dashboard:
  • LCP (Largest Contentful Paint): < 2.5s
  • FID (First Input Delay): < 100ms
  • CLS (Cumulative Layout Shift): < 0.1

Custom metrics

Performance checklist

  • Server Components by default
  • React cache() for expensive operations
  • Suspense for streaming
  • Proper loading states
  • Parallel fetches where possible
  • Appropriate caching strategies
  • Pagination for large lists
  • Minimize API calls
  • Next.js Image component
  • Lazy load below-the-fold images
  • Optimize generated images
  • Compress static assets
  • Dynamic imports for heavy components
  • Tree-shake unused code
  • Remove unused dependencies
  • Minimize bundle size

Next steps

Testing

Test performance improvements

Deployment

Deploy optimized application