A comprehensive, interactive demonstration of different page rendering strategies in modern web development using Next.js 14. This project goes beyond basic examples to show real HTML/JavaScript differences, performance metrics, and technical deep dives for each rendering approach.
- π Technical Deep Dives: See actual HTML source code, bundle analysis, and rendering timelines
- π Performance Metrics: Real TTFB, FCP, LCP, and TTI comparisons
- π¨ Visual Demonstrations: Each rendering method uses technique-specific styling approaches
- β‘ Interactive Examples: Live cache states, loading demonstrations, and state management
- π Educational Content: Comprehensive explanations, use cases, and best practices
π Try it Now: https://page-rendering-demo.vercel.app
Experience all rendering strategies live with:
- Interactive demos of CSR, SSR, SSG, and ISR
- Real-time performance metrics and bundle analysis
- Technical deep dives with actual HTML source code
- Live cache state visualization for ISR
οΏ½ Repository: https://github.com/sandeepmshetty/page-rendering-demo
Local Development: Visit http://localhost:3000 after setup
- Route:
/csr
- Key Features:
- Live JavaScript bundle analysis (~250KB React + ~45KB components)
- Initial HTML vs. final DOM comparison
- State management demonstration with real-time updates
- Performance timeline showing 4-stage rendering process
- Best For: Interactive dashboards, user-specific content, SPAs
- Performance: Fast navigation, slower initial load (TTI ~2100ms)
- Route:
/ssr
- Key Features:
- Generated HTML source code display
- Server vs. client processing breakdown
- Request flow visualization with unique request IDs
- Critical CSS inlining demonstration
- Best For: Dynamic content, SEO-critical pages, personalized content
- Performance: Balanced approach (FCP ~300ms, server-dependent)
- Route:
/ssg
- Key Features:
- Build vs. runtime comparison table
- Generated static file structure visualization
- Build-time CSS computation examples
- Static optimization demonstrations
- Best For: Blogs, marketing pages, documentation, high-traffic sites
- Performance: Fastest loading (FCP ~100ms, CDN-served)
- Route:
/isr
- Key Features:
- Live cache state visualization (Fresh/Stale-Revalidating/Fallback)
- 5-step revalidation lifecycle demonstration
- Real-time cache status with adaptive styling
- Comparison table with other rendering strategies
- Best For: E-commerce, news sites, content that updates periodically
- Performance: Best of both worlds (Static speed + fresh content)
- Next.js 14 - React framework with App Router and server components
- TypeScript - Full type safety across all components
- Tailwind CSS - Utility-first styling with custom animations
- React 18 - Server and client components with modern patterns
- PostCSS - CSS processing and optimization
- Node.js 18+
- npm, yarn, pnpm, or bun
# Clone the repository
git clone https://github.com/sandeepmshetty/page-rendering-demo.git
cd page-rendering-demo
# Install dependencies
npm install
# Start development server
npm run dev
# Open your browser
open http://localhost:3000
npm run dev # Start development server (port 3000)
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
This project is deployed on Vercel for optimal performance and global edge distribution.
π Live Demo: https://page-rendering-demo.vercel.app
- β Automatic deployments from main branch
- π Global CDN for fastest loading worldwide
- β‘ Edge functions for optimal SSR performance
- π Real-time analytics and performance monitoring
- π HTTPS enabled by default
- Fork this repository
- Connect to Vercel via GitHub
- Deploy automatically with zero configuration
- Explore all rendering strategies live!
- Netlify: Works out of the box with
npm run build
- AWS Amplify: Full SSR support with serverless functions
- Railway: Simple deployment with automatic HTTPS
- Self-hosted: Use
npm run build && npm run start
src/
βββ app/
β βββ layout.tsx # Root layout with enhanced navigation
β βββ page.tsx # Landing page with method comparisons
β βββ globals.css # Global styles and animations
β βββ csr/
β β βββ page.tsx # CSR with bundle analysis & state demo
β βββ ssr/
β β βββ page.tsx # SSR with HTML source & request flow
β βββ ssg/
β β βββ page.tsx # SSG with build process visualization
β βββ isr/
β βββ page.tsx # ISR with cache lifecycle demo
βββ components/
β βββ Navigation.tsx # Enhanced navigation with active states
βββ next.config.js # Next.js configuration
βββ tailwind.config.ts # Tailwind customization
βββ tsconfig.json # TypeScript configuration
βββ postcss.config.js # PostCSS setup
'use client'
// Real-time state management demonstration
// JavaScript bundle breakdown visualization
// Initial HTML vs. rendered DOM comparison
// 4-stage rendering timeline with performance metrics
// Server-generated HTML with inline styles
const sampleGeneratedHTML = `<!-- Complete HTML structure -->`
// Request flow diagram with timestamps
// Server vs. client processing breakdown
export const dynamic = 'force-static'
// Build-time CSS computation examples
// Static file structure visualization
// Performance comparison tables
export const revalidate = 60
// Live cache state visualization
// 5-step revalidation lifecycle
// Adaptive styling based on cache status
Method | TTFB | FCP | LCP | TTI | Bundle Size | Server Load | SEO Score |
---|---|---|---|---|---|---|---|
CSR | ~50ms | ~800ms | ~2000ms | ~2100ms | ~310KB | Low β | Poor β |
SSR | ~200ms | ~300ms | ~400ms | ~500ms | ~45KB | High β | Excellent β |
SSG | ~20ms | ~100ms | ~150ms | ~200ms | ~45KB | None β | Excellent β |
ISR | ~50ms | ~120ms | ~200ms | ~250ms | ~45KB | Low β | Excellent β |
Scenario | Recommended Method | Why? |
---|---|---|
Blog/Documentation | SSG | Static content, fastest loading |
E-commerce Product Pages | ISR | Static speed + inventory updates |
User Dashboard | CSR | Highly interactive, personalized |
News Website | SSR/ISR | Fresh content + SEO requirements |
Marketing Landing Page | SSG | Performance critical, static content |
After exploring this demo, you'll master:
β
When to use each rendering strategy with real-world examples
β
Performance implications with actual metrics and timelines
β
SEO considerations and search engine optimization strategies
β
Next.js 14 implementation patterns with App Router
β
Bundle optimization and JavaScript delivery strategies
β
Cache management and revalidation strategies
β
Server vs. client processing trade-offs
- Live Bundle Analysis: See JavaScript bundle sizes and composition
- Cache State Visualization: Watch ISR cache states change in real-time
- Performance Timelines: Visual representation of rendering stages
- HTML Source Comparison: Side-by-side initial vs. final markup
- Request Flow Diagrams: Visual representation of each rendering process
- Performance Metrics: Real-time TTFB, FCP, LCP measurements
- Code Examples: Actual implementation code for each strategy
- Best Practice Guidance: When and why to use each approach
We welcome contributions! Here's how to get started:
- Fork the repository on GitHub
- Clone your fork locally
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes with appropriate tests
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to your branch (
git push origin feature/amazing-feature
) - Open a Pull Request with a clear description
- Follow TypeScript best practices
- Maintain consistent code formatting
- Add comments for complex logic
- Test all rendering methods thoroughly
This project is open source and available under the MIT License.
next.js
react
typescript
rendering
performance
seo
ssr
ssg
csr
isr
web-vitals
tailwind-css
javascript
frontend
education
demo
β If this demo helped you understand rendering strategies, please star the repository!
π Found an issue? Open an issue
π‘ Have a suggestion? Start a discussion
git clone <repository-url>
cd Page-Rendering-Demo
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLint
src/
βββ app/
β βββ layout.tsx # Root layout with navigation
β βββ page.tsx # Home page with overview
β βββ globals.css # Global styles
β βββ csr/
β β βββ page.tsx # Client-Side Rendering demo
β βββ ssr/
β β βββ page.tsx # Server-Side Rendering demo
β βββ ssg/
β β βββ page.tsx # Static Site Generation demo
β βββ isr/
β βββ page.tsx # Incremental Static Regeneration demo
βββ components/
βββ Navigation.tsx # Navigation component
'use client'
// Uses React hooks for client-side data fetching
// Shows loading states and error handling
// Server component with no-cache fetching
const response = await fetch(url, { cache: 'no-store' })
// Forces static generation at build time
export const dynamic = 'force-static'
// Revalidates every 60 seconds
const response = await fetch(url, { next: { revalidate: 60 } })
After exploring this demo, you'll understand:
- When to use each rendering strategy
- Performance implications of different approaches
- SEO considerations for each method
- Implementation patterns in Next.js 14
- Trade-offs between loading speed and dynamic content
Method | Initial Load | Navigation | SEO | Dynamic Content | Server Load |
---|---|---|---|---|---|
CSR | Slower | Fast | Poor | Excellent | Low |
SSR | Fast | Slower | Excellent | Excellent | High |
SSG | Fastest | Fast | Excellent | None | None |
ISR | Fast | Fast | Excellent | Good | Medium |
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
π Try the Live Demo
Experience all rendering strategies in action with real performance metrics!
β Star on GitHub
If this demo helped you understand rendering strategies, please give it a star!
π€ Contribute
Found an issue or have an improvement? Contributions are welcome!
Help other developers learn by sharing this resource:
- Twitter/X:
"Check out this comprehensive Next.js rendering demo: https://page-rendering-demo.vercel.app π #NextJS #WebPerformance #ReactJS"
- LinkedIn:
"Great resource for understanding SSR, SSG, CSR, and ISR with real examples and performance metrics"
π·οΈ Tags: nextjs
react
typescript
rendering
performance
ssr
ssg
csr
isr
web-vitals
education
demo
tutorial