New How To Deploy A Sveltekit App To Cloudflare Containers 2026 - Analysis

New How To Deploy A Sveltekit App To Cloudflare Containers 2026 - Analysis

Cloudflare Containers is a container service recently released by Cloudflare in beta. From a user’s perspective, it feels similar to Cloud Run, but with the ability to directly invoke, start, and shut down containers from Workers. Since it is container-based, there are effectively no runtime restrictions.

Run code written in any programming language, built for any runtime, as part of apps built on Workers.

Workers are excellent, but they come with many limitations and often feel like they don’t quite reach the itchy spots. Nowadays, standard Node.js APIs are available, making them far more usable than before. Still, due to their edge nature, there are memory limits and execution time limits. Trying to run an entire application using only Cloudflare Workers can be challenging in some scenarios.

That’s where Cloudflare Containers come in. Heavy or long-running tasks can be offloaded to Containers, where they can run for an extended period and eventually return results. Lighter processing can be handled entirely within Workers. This separation significantly improves the overall developer experience.

Because SvelteKit follows Web Standards, you can easily deploy it to Cloudflare Containers or Pages (now deprecated) using an adapter.

We assume an application that is already running on Cloudflare Workers. When a request hits a specific endpoint, a Container is launched to perform heavy processing and ultimately return a response.

(In practice, Workers still have execution time limits. If you wait for the Container to finish, the Worker execution will be forcibly terminated. So the idea is to return a response immediately, let the Container do its work, and then perform further processing inside the Container.)

To achieve this, the Worker and the Container share the same codebase. The Worker is built with adapter-cloudflare, while the Container is built with the Node adapter.

To run Cloudflare Containers, you must use Durable Objects.

If you are only running SvelteKit on Workers, there is no particular issue. You can bind R2, D1, and similar services directly and they will work as expected. However, once Durable Objects are involved, things change. The reason is that adapter-cloudflare does not support Durable Objects.

Source: Dev.to