guidance
We want a single page “Workers Best Practices” guide that is similar to the following:
Look at the issue & PR history of this repo as well as cloudflare/workers-sdk - deeply understand the most common issues, errors and configuration challenges users run into and how this best practices guide can help users.
It should use the code example format of the Workflows & Durable Objects guides in order to not only tell but SHOW users how to do things the right way. We should have opinions.
requirements
The doc should ensure it covers:
- using the latest compatibility_date
- enabling nodejs_compat
- enabling logging and tracing and using sampling rates to control volume and manage costs
- using waitUntil to do work after a request, or tail workers for logging
- using streaming for unknown or large request and/or response bodies (both)
- using
wrangler secret for secrets and not storing in source
- using
wrangler types to generate types based on your bindings
- using bindings for Cloudflare native services (R2, KV, Workflows) instead of REST APIs or SDKs
- using workflows and queues for async and long running tasks that can be done in the background
There’s probably another 10-15 here based on the issue & PR research I’ve asked for. Order the page so that the most common and obvious are at the top.
Find the right place to put this. Use the code-review skill to both review your changes as well as inspiration for best practices as it itself is a source of best practices.
guidance
We want a single page “Workers Best Practices” guide that is similar to the following:
Look at the issue & PR history of this repo as well as cloudflare/workers-sdk - deeply understand the most common issues, errors and configuration challenges users run into and how this best practices guide can help users.
It should use the code example format of the Workflows & Durable Objects guides in order to not only tell but SHOW users how to do things the right way. We should have opinions.
requirements
The doc should ensure it covers:
wrangler secretfor secrets and not storing in sourcewrangler typesto generate types based on your bindingsThere’s probably another 10-15 here based on the issue & PR research I’ve asked for. Order the page so that the most common and obvious are at the top.
Find the right place to put this. Use the code-review skill to both review your changes as well as inspiration for best practices as it itself is a source of best practices.