Cloudflare Snippets

cloudflareWorkercloudflare-snippets

Short JavaScript run at the edge for requests matched by a snippet rule.

Provider
cloudflare
Kind
Worker
Category
Compute
Properties · 4 set by this component
propertytypevaluesrequiredkind defaultthis component
acceleratorenumnone | gpu | asicnonone▸ none
codeSizeLimitKb · component propertyinteger—no32inherited
concurrencyinteger—no—inherited
cpuTimeLimitMs · component propertyinteger—no5inherited
fanoutStrategy · advancedenumnone | push | pull | hybridnononeinherited
fanoutThreshold · advancedinteger—no—inherited
idempotentboolean—nofalseinherited
instancesinteger—no—inherited
managedboolean—nofalse▸ true
maxSnippetsPerZone · component propertyinteger—no25inherited
memoryLimitMb · component propertyinteger—no2inherited
plan · component propertyenumpro | business | enterprisenoproinherited
rateControl · advancedenumnone | fixed | aimdnonone▸ none
schedulestring—no—inherited
triggerenumqueue | stream | schedule | batch | manualyes—▸ manual
Rules that apply · 3

Every rule whose selector covers this component's kind or its category. Whether a rule fires depends on the design: its properties, its edges and its groups.

push-fanout-without-celebrity-path

Pure push fan-out over a social graph is brutal at the tail: one post from an account with millions of followers becomes millions of cache writes. A follower threshold above which readers merge at read time bounds that write amplification.

  • — all of these hold:
  • — the node's `fanoutStrategy` is "push"
  • — the node's `fanoutThreshold` has no value
  • — the design contains a node of kind graph-database
shared-worker-pool-across-queues

One worker pool consuming several queues lets a slow or poisoned queue starve the others. That is precisely what the design's per-queue isolation requirement forbids.

  • — all of these hold:
  • — the node has more than 1 incoming edge from a queue
  • — the design requirement `isolation.perQueue` is true
stateful-node-without-zone-redundancy

A stateful compute node pinned to exactly one availability zone disappears with that zone, and its state goes with it. Nodes inside a cell are exempt, because there the cell is deliberately single-zone and redundancy comes from the other cells.

  • — all of these hold:
  • — the node's `stateless` is false
  • — the node sits inside exactly 1 availability-zone group
  • — this does not hold:
  • — the node sits inside at least one cell group
Use it in a design
nodes:
  - { id: "snippets", component: "cloudflare-snippets" }
Other Worker products · 82
SchedulerXalibaba-schedulerxalibabacloudworkerAmazon AppFlowaws-appflowawsworkerAWS B2B Data Interchangeaws-b2b-data-interchangeawsworkerAWS Batchaws-batchawsworkerAWS Glue DataBrewaws-databrewawsworkerAWS DataSyncaws-datasyncawsworkerAWS Deadline Cloudaws-deadline-cloudawsworkerAWS Entity Resolutionaws-entity-resolutionawsworkerAmazon EventBridge Scheduleraws-eventbridge-schedulerawsworkerAWS Fault Injection Serviceaws-fisawsworkerAWS Glue crawleraws-glue-crawlerawsworkerAWS Glue for Ray jobaws-glue-ray-jobawsworkerAWS Application Migration Serviceaws-mgnawsworkerAmazon MSK Connectaws-msk-connectawsworkerAmazon SageMaker AI Training Jobaws-sagemaker-training-jobawsworkerAWS Systems Manageraws-systems-managerawsworkerAWS Thinkbox Deadline 10aws-thinkbox-deadlineawsworkerAWS Glue jobglue-jobawsworkerAzure Automationazure-automationazureworkerAzure Batchazure-batchazureworkerAzure Chaos Studioazure-chaos-studioazureworkerAzure Data Factoryazure-data-factoryazureworkerAzure Data Shareazure-data-shareazureworkerAzure Database Migration Serviceazure-database-migration-serviceazureworkerMicrosoft Entra Connect Syncazure-entra-connect-syncazureworkerMicrosoft Graph Data Connectazure-graph-data-connectazureworkerAzure Storage Moverazure-storage-moverazureworkerAzure Update Managerazure-update-managerazureworkerBrowser Runcloudflare-browser-runcloudflareworkerCloudflare Zarazcloudflare-zarazcloudflareworkerAirbyteairbyteworkerAirflow DAGairflow-dagworkerChaos Meshchaos-meshworkerChunkrchunkrworkerContainer workercontainer-workerworkerCron jobcron-jobworkerDaytonadaytonaworkerE2Be2bworkerEmbulkembulkworkerFan-out daemonfanout-daemonworker
and 42 more → Worker page
Source
# yaml-language-server: $schema=../../schema/component.schema.json
# Snippets: short JavaScript run on the edge for requests matched by a snippet rule, after Cache
# Rules. "Rules - Snippets" gives the 5 ms execution budget, 2 MB memory, 32 KB package and the
# per-plan snippet counts (none on Free, 25 on Pro, 50 on Business, 300 on Enterprise).
schemaVersion: "1"
type: "component"
id: "cloudflare-snippets"
kind: "worker"
provider: "cloudflare"
docs: "https://developers.cloudflare.com/rules/snippets/"
defaults:
  managed: true
  trigger: "manual"
  accelerator: "none"
  rateControl: "none"
properties:
  plan:
    type: "enum"
    values: ["pro", "business", "enterprise"]
    default: "pro"
  maxSnippetsPerZone:
    type: "integer"
    default: 25
  cpuTimeLimitMs:
    type: "integer"
    default: 5
  memoryLimitMb:
    type: "integer"
    default: 2
  codeSizeLimitKb:
    type: "integer"
    default: 32

The same page as markdown, for an agent: /catalogue/components/cloudflare-snippets.md