an example of how to use a sveltekit app with cloudflare workers, KV, and R2
pnpm add -D @sveltejs/adapter-cloudflare wrangler
wrangler.jsonc
(use the one in this repo as an example)pnpm dlx wrangler kv namespace create svelteflare-example
https://developers.cloudflare.com/r2/get-started/
see package.json for the scripts i have added
cf-typegen
: generate types for the projectdeploy
: deploy the projectpnpm run cf-typegen
to generate types for the projectsrc/app.d.ts
, see this project for an exampleYou can access the cloudflare services you've created with event.platform.env
. See this project for examples on how to use KV. R2 works the same way, see the docs for R2.