Svelte Ssr Worker screenshot

Svelte Ssr Worker

Author Avatar Theme by Lukeed
Updated: 13 Oct 2020
154 Stars

A quick demo for rendering Svelte server-side (SSR), but within a Cloudflare Worker!

Overview

The svelte-ssr-worker is a demo project that demonstrates how to render a Svelte server-side (SSR) application within a Cloudflare Worker. It is a minimal extension of the official svelte-template.

Features

  • Svelte server-side rendering within a Cloudflare Worker
  • Builds the client for production using the src/index.dom.js entry point
  • Builds the Cloudflare Worker code using the src/index.ssr.js entry point
  • Includes scripts for local development server and watching for changes
  • Easy deployment using Cloudflare’s wrangler tool

Installation

To install the svelte-ssr-worker, follow these steps:

  1. Set up a storage bucket and attach it to a CDN.
  2. Update the {{/CDN/}} value within the config/shared.js file with the CDN address.
  3. Upload the contents of the /public directory to your storage bucket.
  4. Upload the build/index.js file to Cloudflare Workers.
    • Note: Cloudflare’s wrangler tool can handle both of these steps efficiently.

That’s it! You have successfully installed the svelte-ssr-worker.

Summary

The svelte-ssr-worker is a demo project that showcases how to implement Svelte server-side rendering within a Cloudflare Worker. It provides an easy-to-follow installation guide and includes several useful features for development and deployment. This project can serve as a starting point for building SSR applications with Svelte in a Cloudflare environment.