npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@joshthomas/sveltekit-adapter-cloudflare

v0.2.1

Published

Fork of @sveltejs/adapter-cloudflare with support for scheduled, queue, and email handlers

Readme

sveltekit-adapter-cloudflare

A drop-in replacement for @sveltejs/adapter-cloudflare that adds support for Cloudflare platform extensions beyond the generated SvelteKit fetch worker.

About this fork

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.

Installation

Install the adapter:

npm install -D @joshthomas/sveltekit-adapter-cloudflare

Usage

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.

Development

To work on the adapter locally:

pnpm install
pnpm build
pnpm check
pnpm test:unit
pnpm test:e2e

License

sveltekit-adapter-cloudflare is licensed under the MIT license. See the LICENSE file for more information.