
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
@joshthomas/sveltekit-adapter-cloudflare
Advanced tools
Fork of @sveltejs/adapter-cloudflare with support for scheduled, queue, and email handlers
A drop-in replacement for @sveltejs/adapter-cloudflare that adds support for Cloudflare platform extensions beyond the generated SvelteKit fetch worker.
This is a fork of @sveltejs/adapter-cloudflare that adds support for a user-owned Cloudflare platform file. If you do not use one, it behaves like the upstream adapter.
This was requested upstream multiple times and at least partly explored there, but never landed in the official adapter. I also got tired of copying the same handler wiring from project to project — and later, of bending over backwards to get Durable Objects to work alongside it. This fork takes a narrower version of "own the worker": SvelteKit still owns fetch, and the user supplies a single platform file with everything else — scheduled, queue, email, and tail handlers, plus named exports such as Durable Object classes, WorkerEntrypoint classes, and WorkflowEntrypoint classes.
Install the adapter:
npm install -D @joshthomas/sveltekit-adapter-cloudflare
Configure SvelteKit to use the adapter:
import adapter from '@joshthomas/sveltekit-adapter-cloudflare';
export default {
kit: {
adapter: adapter()
}
};
Then create src/platform.cloudflare.js (or .ts) and export any Cloudflare-specific additions you need:
import { DurableObject } from 'cloudflare:workers';
export class MyDurableObject extends DurableObject {}
export async function scheduled(controller, env, ctx) {
// run cron work here
}
export async function queue(batch, env, ctx) {
for (const message of batch.messages) {
// process message.body here
message.ack();
}
}
export async function email(message, env, ctx) {
// handle incoming email here
}
The adapter re-exports everything from this file and merges any scheduled, queue, email, or tail exports into the generated worker's default export. It does not replace SvelteKit's fetch handler.
See the Cloudflare docs for handler signatures — scheduled, queue, email, tail — and for class-based exports: Durable Objects, WorkerEntrypoint, and Workflows.
The adapter discovers platform files automatically by looking for platform.cloudflare.<ext> in kit.files.src using kit.moduleExtensions. If you want to use a different file, pass it explicitly:
adapter({
platform: 'src/workers/my-platform.js'
});
These exports are wired in the adapter output, so they are not available in plain vite dev. To test them locally, use your normal Cloudflare preview flow — for example wrangler pages dev for Pages or vite build followed by wrangler dev for Workers.
For the rest of the adapter behavior and options, see the upstream docs.
To work on the adapter locally:
pnpm install
pnpm build
pnpm check
pnpm test:unit
pnpm test:e2e
sveltekit-adapter-cloudflare is licensed under the MIT license. See the LICENSE file for more information.
FAQs
Fork of @sveltejs/adapter-cloudflare with support for scheduled, queue, and email handlers
We found that @joshthomas/sveltekit-adapter-cloudflare demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.