Back to Templates
SvelteKit Hybrid Rendering Template
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.tswith 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 = falsein+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 = truein+page.server.tsor+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.