Back to Templates

React Router Hybrid Rendering Template

A hybrid rendering demonstration project based on EdgeOne Pages and React Router v7, showcasing SSR, CSR, SSG, Streaming, and other rendering strategies, as well as the use of Node Functions and Edge Functions.

View Demo
A hybrid rendering demonstration project based on EdgeOne Pages and React Router v7, showcasing SSR, CSR, SSG, Streaming, and other rendering strategies, as well as the use of Node Functions and Edge Functions.

EdgeOne Pages React Router Starter

A comprehensive React Router v7 starter template for EdgeOne Pages, showcasing various rendering modes and full-stack capabilities.

๐Ÿš€ Features

  • Server-Side Rendering (SSR) - Real-time server-side rendering
  • Client-Side Rendering (CSR) - Dynamic rendering in the browser
  • Streaming SSR - Progressive rendering with deferred data loading
  • Static Site Generation (SSG) - Static generation at build time
  • Pages Functions - Edge and Node.js serverless functions
  • Modern UI - Beautiful interface with Tailwind CSS

๐Ÿ› ๏ธ Tech Stack

  • React Router v7 - Full-stack React framework
  • TypeScript - Type safety
  • Tailwind CSS - Styling framework
  • Lucide React - Icon library
  • Vite - Build tool

๐Ÿ“ฆ Installation

# Clone the project
git clone <repository-url>
cd react-router-v7-demo

# Install dependencies
npm install

# Start development server
edgeone pages dev

# deploy the project
edgeone pages deploy

Learn more about EdgeOne CLI.

๐ŸŽฏ Pages Overview

Home (/)

Displays project overview and entry points to various feature modules.

SSR (/ssr)

Demonstrates server-side rendering:

  • Re-renders on the server for each request
  • Real-time data fetching
  • SEO friendly
  • Suitable for dynamic content

CSR (/csr)

Demonstrates client-side rendering:

  • All rendering happens in the browser
  • Data fetching after JavaScript loads
  • Rich interactive experiences
  • Reduced server load
  • Suitable for interactive applications

Streaming (/streaming)

Demonstrates streaming SSR:

  • Progressive rendering with deferred data loading
  • HTML shell sent immediately with fast data
  • Slow data streams in as it becomes available
  • Optimal user experience with Suspense boundaries
  • Works for both SSR and client-side navigation

Pre-render (/prerender)

Demonstrates static site generation:

  • Pre-generates pages at build time
  • Fastest loading speed
  • CDN friendly
  • Suitable for static content

Pages Functions (/pages-functions)

Demonstrates EdgeOne Pages Functions:

  • Edge Functions - Ultra-low latency on 3200+ global edge nodes
  • Node Functions - Full Node.js runtime with npm ecosystem
  • Serverless architecture with auto-scaling
  • Perfect for APIs and backend logic

๐Ÿ“ Project Structure

app/
โ”œโ”€โ”€ components/          # Components
โ”‚   โ”œโ”€โ”€ ui/             # UI components
โ”‚   โ”œโ”€โ”€ layout/         # Layout components
โ”‚   โ”œโ”€โ”€ Header.tsx      # Header navigation
โ”‚   โ”œโ”€โ”€ Hero.tsx        # Home hero section
โ”‚   โ”œโ”€โ”€ Features.tsx    # Features showcase
โ”‚   โ””โ”€โ”€ FeatureCard.tsx # Feature card
โ”œโ”€โ”€ lib/                # Utility functions
โ”‚   โ””โ”€โ”€ utils.ts        # Common utilities
โ”œโ”€โ”€ routes/             # Route pages
โ”‚   โ”œโ”€โ”€ home.tsx        # Home page
โ”‚   โ”œโ”€โ”€ ssr.tsx         # SSR demo
โ”‚   โ”œโ”€โ”€ csr.tsx         # CSR demo
โ”‚   โ”œโ”€โ”€ streaming.tsx   # Streaming SSR demo
โ”‚   โ”œโ”€โ”€ prerender.tsx   # Pre-render demo
โ”‚   โ””โ”€โ”€ pages-functions.tsx    # Pages Functions demo
โ”œโ”€โ”€ app.css             # Global styles
โ”œโ”€โ”€ root.tsx            # Root component
โ””โ”€โ”€ routes.ts           # Route configuration
edge-functions/         # Edge runtime functions
node-functions/         # Node.js runtime functions
public/                 # Static assets

๐Ÿ“š Learning Resources

๐Ÿค Contributing

Issues and Pull Requests are welcome!

๐Ÿ“„ License

MIT License