Back to Templates

SvelteKit Hybrid Rendering Template

A SvelteKit hybrid rendering template showcasing SSR, CSR, Prerender, and Streaming with EdgeOne Pages deployment.

View Demo
FrameworkSvelte
Use CaseStarter
A SvelteKit hybrid rendering template showcasing SSR, CSR, Prerender, and Streaming with EdgeOne Pages deployment.

SvelteKit Hybrid Rendering Template

A hybrid rendering demonstration project based on SvelteKit 2 and Svelte 5, showcasing SSR, Prerender, Streaming, and other rendering strategies, built with modern web development best practices.

This template uses the @edgeone/sveltekit adapter for seamless deployment to EdgeOne Pages platform, enabling edge computing capabilities and global content delivery.

โœจ Features

  • ๐Ÿš€ Hybrid Rendering Strategies - Demonstrates SSR, CSR, Prerender, Streaming rendering methods
  • โšก Modern Frontend - SvelteKit 2 + Svelte 5 + TypeScript
  • ๐ŸŽจ Interactive Demo - Includes a Wordle-style game (Sverdle) to showcase SvelteKit capabilities
  • ๐Ÿ”ง Out-of-the-Box - Preconfigured development environment and build process
  • ๐ŸŒ Edge-Ready - Compatible with EdgeOne Pages deployment

๐Ÿ› ๏ธ Technology Stack

Frontend

  • SvelteKit 2.47.1 - Modern full-stack web framework
  • Svelte 5.41.0 - Reactive UI framework with runes
  • TypeScript 5.9.3 - Type-safe JavaScript
  • Vite 7.1.10 - Fast build tool and dev server

๐Ÿš€ Quick Start

Environment Requirements

  • Node.js 18.0 or higher version
  • EdgeOne Pages account

Install Dependencies

# Clone the project
git clone <your-repo-url>
cd sveltekit-mix-render-template

# Install dependencies
npm install

Local Development

# Start the development server
edgeone pages dev

# Access http://localhost:8088

Build

# Build the production version
edgeone pages build

๐Ÿ“š Feature Demonstrations

Hybrid Rendering Strategies

SSR (Server-Side Rendering)

  • Path: /ssr
  • Characteristics: Re-renders on the server for each request
  • Suitable for: Dynamic content and personalized pages
  • Implementation: Uses +page.server.ts with load function

CSR (Client-Side Rendering)

  • Path: /csr
  • Characteristics: Renders entirely in the browser
  • Suitable for: Highly interactive apps and SPAs that don't need SEO
  • Implementation: Set export const ssr = false in +page.ts

Prerender (Static Site Generation)

  • Path: /prerender
  • Characteristics: Pre-generates pages as static HTML at build time
  • Suitable for: Marketing pages, blogs, and documentation
  • Implementation: Set export const prerender = true in +page.server.ts or +page.ts

Streaming (Streaming Rendering)

  • Path: /streaming
  • Characteristics: Gradually renders page content, enhancing user experience
  • Suitable for: Data-intensive pages with multiple async data sources
  • Implementation: Return promises from load function and use {#await} blocks

Interactive Demo

Sverdle (Wordle Clone)

  • Path: /sverdle
  • A fully functional Wordle-style word guessing game
  • Demonstrates form handling, state management, and server-side validation
  • Shows best practices for building interactive applications with SvelteKit

๐Ÿ—„๏ธ Project Structure

sveltekit-mix-render-template/
โ”œโ”€โ”€ src/                    # Source code directory
โ”‚   โ”œโ”€โ”€ routes/            # SvelteKit routes
โ”‚   โ”‚   โ”œโ”€โ”€ +layout.svelte # Root layout component
โ”‚   โ”‚   โ”œโ”€โ”€ +page.svelte   # Home page component
โ”‚   โ”‚   โ”œโ”€โ”€ Header.svelte  # Navigation header
โ”‚   โ”‚   โ”œโ”€โ”€ Counter.svelte # Interactive counter demo
โ”‚   โ”‚   โ”œโ”€โ”€ ssr/           # SSR demonstration pages
โ”‚   โ”‚   โ”œโ”€โ”€ csr/           # CSR demonstration pages
โ”‚   โ”‚   โ”œโ”€โ”€ prerender/     # Prerender demonstration pages
โ”‚   โ”‚   โ”œโ”€โ”€ streaming/     # Streaming demonstration pages
โ”‚   โ”‚   โ””โ”€โ”€ sverdle/       # Wordle game demo
โ”‚   โ”œโ”€โ”€ lib/               # Library code
โ”‚   โ”‚   โ”œโ”€โ”€ images/        # Image assets
โ”‚   โ””โ”€โ”€ app.html           # HTML template
โ”œโ”€โ”€ static/                # Static assets
โ”œโ”€โ”€ package.json           # Project configuration
โ”œโ”€โ”€ svelte.config.js       # SvelteKit configuration
โ”œโ”€โ”€ vite.config.ts         # Vite configuration
โ”œโ”€โ”€ tsconfig.json          # TypeScript configuration
โ””โ”€โ”€ eslint.config.js       # ESLint configuration

๐Ÿ“„ License

This project uses the MIT License - View the LICENSE file for details.

๐Ÿš€ One-Click Deployment

Deploy with EdgeOne Pages