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:
- Add your Cloudflare account_id and zone_id to the
wrangler.tomlfile. - (Optional) For automated deployments, add a
CF_API_TOKENsecret to your GitHub repository, which should be a Cloudflare API Token with the “Edit Cloudflare Workers” template permission. - Run
npm installto install the necessary dependencies. - Run
npm run devto start a development server. - Run
npm run formatto format your code using Prettier. - Run
wrangler publishto 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.