Cloudflare Workers SDK

repository·main·Indexed 26 days ago

https://github.com/cloudflare/workers-sdk

A monorepo providing essential tools for developing, simulating, and deploying serverless code on the Cloudflare global network. It includes the Wrangler CLI, Miniflare for local simulation, the create-cloudflare (C3) CLI for scaffolding, and specialized packages such as @cloudflare/kv-asset-handler, @cloudflare/codemod, and @cloudflare/chrome-devtools-patches.

Tokens
64.4K
Snippets
118
Records
494
Agent score
88%

What's inside cloudflare-workers-sdk

  1. Overview of Workers Devtools

    main

    The @cloudflare/chrome-devtools-patches package provides a customized version of Chrome DevTools specifically tailored for debugging Cloudflare Workers. It is used by the Wrangler CLI (via InspectorProxy), Workers Playground, and the Quick Editor (@cloudflare/quick-edit).

    Key features include:

    • Source code viewing and live updates
    • Network request inspection
    • Worker-specific UI optimizations
  2. Overview of Cloudflare Workers SDK Packages

    main

    The Workers SDK consists of several key packages for building, simulating, and deploying Workers:

    • wrangler: The primary command line tool for building and deploying Cloudflare Workers.
    • create-cloudflare (C3): A CLI for creating and deploying new applications to Cloudflare.
    • miniflare: A simulator for developing and testing Workers locally, powered by workerd.
    • chrome-devtools-patches: A fork of Chrome DevTools used for inspecting local or remote Workers.
    • pages-shared: Internal shared code used by Wrangler and Cloudflare Pages.
  3. Overview of @cloudflare/pages-shared

    main
    The @cloudflare/pages-shared package contains shared logic used by Wrangler, Cloudflare Pages, and potentially other Cloudflare clients (such as the dashboard). It is designed to be environment-agnostic, capable of running in Node.js, Deno, browsers, and Cloudflare Workers. Note that certain components like asset-server may require environment-polyfills due to specific environmental requirements.
  4. Overview of Turbo R2 Archive

    main
    Turbo R2 Archive is a Cloudflare Worker that acts as an event server for caching TurboRepo artifacts. It is compliant with the TurboRepo API and stores cache artifacts in a Cloudflare R2 bucket. To manage storage costs and space, it utilizes R2 Object lifecycle rules to purge objects on a schedule. This setup provides the benefits of remote caching TurboRepo artifacts on Cloudflare's edge network.
  5. Understand Wrangler configuration inheritance

    main

    Wrangler configuration supports multiple environments (the top-level/default environment and named environments specified via --env). Configuration values follow three inheritance patterns:

    • non-overridable: Defined once at the top-level. These apply to all environments and cannot be overridden.
    • inheritable: Defined at the top-level and can be overridden by named environments. If a named environment does not provide a value, it inherits the top-level value.
    • non-inheritable: Must be explicitly defined in each environment if they are defined at the top-level. Named environments do not inherit these values.

    All configuration values are optional and will receive a default value if not defined.