Cloudflare Workers Svelte screenshot

Cloudflare Workers Svelte

Author Avatar Theme by Jpwilliams
Updated: 11 Mar 2021
10 Stars

A template for a Svelte site with TypeScript support hosted on Cloudflare Workers Sites.

Overview:

The Cloudflare Workers Svelte Template is a simple template for deploying a Svelte site with TypeScript support to Cloudflare Workers Sites. It includes automated deployment using GitHub Actions and offers the ability to customize and enhance the template as needed.

Features:

  • Automated deployments: The template includes a deployment workflow using GitHub Actions, making it easy to deploy updates to Cloudflare Workers Sites.
  • Prettier: Prettier is integrated into both the Svelte and Workers Sites projects, allowing for consistent code formatting.
  • TypeScript support: Both the main Svelte project and the Workers Sites project have TypeScript support, enabling the use of TypeScript in the development process.
  • Customization: The template can be customized by adding additional features and functionality using the provided files, repositories, and sites.

Installation:

To install the Cloudflare Workers Svelte Template, follow the steps below:

  1. Add your Cloudflare account_id and zone_id to the wrangler.toml file.
  2. (Optional) For automated deployments, add a CF_API_TOKEN secret to your GitHub repository, which should be a Cloudflare API Token with the “Edit Cloudflare Workers” template permission.
  3. Run npm install to install the necessary dependencies.
  4. Run npm run dev to start a development server.
  5. Run npm run format to format your code using Prettier.
  6. Run wrangler publish to deploy the Svelte site to Cloudflare Workers Sites.

Summary:

The Cloudflare Workers Svelte Template provides an easy and efficient way to deploy a Svelte site with TypeScript support to Cloudflare Workers Sites. It includes automated deployment, Prettier code formatting, and the ability to customize and expand the template as needed. By following the provided installation guide, developers can quickly get started with building and deploying their Svelte projects on Cloudflare.