monorepo-template / backend
louisbrulenaudet/monorepo-template/.cursor/rules/backend/workers-cache.mdc
Workers Cache - Cache-Control, gateway exports cache off, RPC vs fetch
Cursor rule19 starsChanged 6 days ago
What's in it
- Workers Cache Rules
- Repo invariants
---
description: "Workers Cache - Cache-Control, gateway exports cache off, RPC vs fetch"
alwaysApply: false
globs: **/wrangler.jsonc,apps/worker-*/src/routes/**,apps/worker-*/src/index.ts,apps/worker-*/src/handlers/**
---
# Workers Cache Rules
Tiered edge cache in front of Worker **`fetch()`** entrypoints (eyeball, binding `fetch()`, `ctx.exports.fetch()`). Not `caches.default`. Control via `Cache-Control` / `Cache-Tag`; purge via `ctx.cache.purge()`. [Docs](https://developers.cloudflare.com/workers/cache/). Out of scope: `webhook-*`, `front-app`. Depth: skill **`workers-best-practices`**.
## Repo invariants
- Unsafe methods: never cache; purge `Cache-Tag` on writes. Probes / real-time: `no-store`. Public read-heavy GET: `public, max-age=N, stale-while-revalidate=M` + `Cache-Tag`.
- Auth'd shared GET: gateway uncached → strip `Authorization` → cached inner `fetch`. Per-user: `ctx.props` + strip `Authorization`.
- Wrangler: `worker-api` enables root `"cache": { "enabled": true }` with `exports.default.cache.enabled: false`. Do not enable cache on the gateway then return `no-store` (still pays tier lookup). After `wrangler.jsonc` edits: `pnpm types` ([workers-config.mdc](workers-config.mdc)).
- Default Worker-to-Worker is **RPC** (not cacheable). Use binding `fetch()` only for hot read paths where a HIT skips callee CPU. Debug: `Cf-Cache-Status`.
More agent context in louisbrulenaudet/monorepo-template
68 other files this repository gives its agents, the first 60 shown.
CLAUDE.md
Cursor rule
- .cursor/rules/backend/hono-gateway.mdc
- .cursor/rules/backend/ports.mdc
- .cursor/rules/backend/workers-config.mdc
- .cursor/rules/contracts/contracts.mdc
- .cursor/rules/contracts/type-inference.mdc
- .cursor/rules/core/boundaries.mdc
- .cursor/rules/core/guardrails.mdc
- .cursor/rules/core/turborepo.mdc
- .cursor/rules/core/worktrees.mdc
- .cursor/rules/frontend/frontend-architecture.mdc
- .cursor/rules/frontend/react-doctor.mdc
- .cursor/rules/frontend/react.mdc
- .cursor/rules/frontend/tailwind.mdc
- .cursor/rules/frontend/tanstack-query.mdc
- .cursor/rules/frontend/tanstack-router.mdc
- .cursor/rules/frontend/vite-config.mdc
- .cursor/rules/ops/cd.mdc
- .cursor/rules/ops/ci.mdc
- .cursor/rules/ops/previews.mdc
- .cursor/rules/ops/release.mdc
- .cursor/rules/quality/code-style.mdc
- .cursor/rules/quality/comments.mdc
- .cursor/rules/quality/knip.mdc
- .cursor/rules/quality/markdown-style.mdc
- .cursor/rules/quality/naming.mdc
- .cursor/rules/quality/testing.mdc
- .cursor/rules/quality/typescript-config.mdc
- .cursor/rules/quality/vitest-config.mdc
- .cursor/rules/tests/front-react.mdc
- .cursor/rules/tests/hono-workers.mdc
- .cursor/rules/tests/vitest.mdc
Skill
- front-vitest.agents/skills/front-vitest/SKILL.md
- git-commit.agents/skills/git-commit/SKILL.md
- hono.agents/skills/hono/SKILL.md
- monorepo-agent-setup.agents/skills/monorepo-agent-setup/SKILL.md
- playwright-cli.agents/skills/playwright-cli/SKILL.md
- pnpm.agents/skills/pnpm/SKILL.md
- privileged-legal-data.agents/skills/privileged-legal-data/SKILL.md
- react-doctor.agents/skills/react-doctor/SKILL.md
- review-architecture.agents/skills/review-architecture/SKILL.md
- review-ci.agents/skills/review-ci/SKILL.md
- review-code-quality.agents/skills/review-code-quality/SKILL.md
- review-configuration.agents/skills/review-configuration/SKILL.md
- review-performance.agents/skills/review-performance/SKILL.md
- review-security.agents/skills/review-security/SKILL.md
- review-seo.agents/skills/review-seo/SKILL.md
- review.agents/skills/review/SKILL.md
- review-stack.agents/skills/review-stack/SKILL.md
- review-tests.agents/skills/review-tests/SKILL.md
- review-ui.agents/skills/review-ui/SKILL.md
- run-app.agents/skills/run-app/SKILL.md
- security-audit.agents/skills/security-audit/SKILL.md
- skills-update.agents/skills/skills-update/SKILL.md
- tanstack-config.agents/skills/tanstack-config/SKILL.md
- tanstack-devtools.agents/skills/tanstack-devtools/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

