sveltekit-cloudflare Svelte Themes

Sveltekit Cloudflare

SvelteKit + Cloudflare Pages with shims for CF service bindings in local development

sveltekit-cloudflare

This is a template for a SvelteKit project specifically designed to be deployed to Cloudflare Pages with a fully working local development environment that simulates several Cloudflare services such as KV store, D1 database, and R2 storage.

How to use

Clone the project and install the dependencies:

git clone https://github.com/johnrcui/sveltekit-cloudflare.git

cd sveltekit-cloudflare

npm install

To start the local development server:

npm run dev

View the app in a browser at localhost:5173.

How to deploy

Follow instructions in the Cloudflare Pages documentation to deploy the app to Cloudflare Pages.

For additional help, you can refer to the SvelteKit documentation.

About the demo

The demo consists of

  • simple todo application backed by a D1 database
  • an example of using R2 storage to serve an image

On initial load, the app will not have a database or storage created. You can initialize the database and storage by clicking the "Initialize" button.

Resetting the demo

To reset the demo, you can delete the database and storage by deleting the .data directory in the root of the project.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes