Workers foundations

Understand the Workers runtime

Compare a Worker isolate with a long-running Node.js server or container and choose workloads that fit its request-driven model.

8 minute lesson

~~~

Cloudflare Workers run JavaScript and TypeScript in V8 isolates distributed across Cloudflare’s network. They do not boot your own virtual machine or container for each request.

Workers use web-standard APIs such as Request, Response, URL, fetch, streams, and Web Crypto. Execution is event-driven and bounded, so keep request work focused and move durable state into bindings rather than process memory.

An isolate may handle many requests and may disappear at any time. Module-level constants and immutable lookup tables are fine, but an in-memory counter, cache, or login session is neither durable nor isolated to one user. Concurrent requests can also share an isolate, so global mutable state creates race conditions rather than coordination.

There is no durable local disk to treat as application storage. Use bindings for persistence and measure expensive work in terms of both CPU time and external waits. If a workflow must survive beyond one request, move it to a Queue, Durable Object, or another durable system instead of hoping the isolate stays alive.

List which parts of the Books API are portable web-standard code and which depend specifically on Node.js or local files.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →