{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cloudflare-workers",
  "type": "registry:block",
  "title": "Cloudflare Workers",
  "description": "Cloudflare Worker entrypoint, Wrangler config example, and edge API route starter.",
  "dependencies": [],
  "devDependencies": [
    "wrangler"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "cloudflare/workers/api-worker.ts",
      "type": "registry:file",
      "target": "cloudflare/workers/api-worker.ts",
      "content": "export interface Env {\n  APP_NAME: string;\n}\n\nexport default {\n  async fetch(request: Request, env: Env) {\n    const url = new URL(request.url);\n    if (url.pathname === \"/health\") {\n      return Response.json({ ok: true, app: env.APP_NAME });\n    }\n\n    return new Response(\"Not found\", { status: 404 });\n  },\n};\n"
    },
    {
      "path": "cloudflare/workers/wrangler.example.jsonc",
      "type": "registry:file",
      "target": "cloudflare/workers/wrangler.example.jsonc",
      "content": "{\n  \"name\": \"stackfoundry-api\",\n  \"main\": \"./api-worker.ts\",\n  \"compatibility_date\": \"2026-01-01\",\n  \"vars\": {\n    \"APP_NAME\": \"stackfoundry\"\n  }\n}\n"
    },
    {
      "path": "apps/web/src/app/(console)/admin/cloudflare/workers/page.tsx",
      "type": "registry:page",
      "target": "apps/web/src/app/(console)/admin/cloudflare/workers/page.tsx",
      "content": "const checks = [\n  \"Install provider package and configure env\",\n  \"Run the local example path\",\n  \"Add auth, retries, and audit events before production\",\n];\n\nexport default function CloudflareWorkersPage() {\n  return (\n    <main className=\"flex flex-col gap-6 p-6\">\n      <div>\n        <h1 className=\"text-2xl font-semibold\">Cloudflare Workers</h1>\n        <p className=\"text-muted-foreground\">Edge compute examples for API routes, health checks, and bindings.</p>\n      </div>\n      <div className=\"grid gap-3\">\n        {checks.map((check) => (\n          <div key={check} className=\"rounded-lg border p-4 text-sm\">{check}</div>\n        ))}\n      </div>\n    </main>\n  );\n}\n"
    }
  ],
  "maintenanceSkills": [
    {
      "name": "cloudflare-workers",
      "target": ".stackfoundry/skills/cloudflare-workers/SKILL.md",
      "content": "---\nname: cloudflare-workers\ndescription: Maintain the Cloudflare Workers provider adapter module installed by StackFoundry.\n---\n\n# Cloudflare Workers Skill\n\n## Boundary\n\nThis block owns the Cloudflare Workers integration example only. Keep product-specific business logic outside the provider adapter until the app has chosen this provider.\n\n## Shared Skills\n\nWhen provider, framework, or database behavior changes, load the installed shared skill before editing implementation details:\n\n- `.stackfoundry/skills/cloudflare/SKILL.md` (source: `registry/skills/cloudflare/SKILL.md`)\n- `.stackfoundry/skills/nextjs/SKILL.md` (source: `registry/skills/nextjs/SKILL.md`)\n\nKeep this module skill focused on ownership, installed files, env vars, deployment checks, and module-specific invariants.\n\n## Source Files\n\n- `cloudflare/workers/api-worker.ts`\n- `cloudflare/workers/wrangler.example.jsonc`\n- `apps/web/src/app/(console)/admin/cloudflare/workers/page.tsx`\n\n## Dependencies\n\n- `wrangler (dev)`\n\n## Environment\n\n- `CLOUDFLARE_ACCOUNT_ID`\n- `CLOUDFLARE_API_TOKEN`\n\n## Deployment Checks\n\n- Create the provider project/resource before deploying.\n- Add env vars to preview and production environments.\n- Run the included smoke route, task, worker, or helper after deploy.\n- Confirm logs do not include secrets, tokens, raw webhook payloads, or customer data.\n\n## Maintenance Rules\n\n- Keep SDK imports and examples aligned with current provider docs.\n- Keep secrets server-only and out of client components.\n- Update `module.json`, `docs.md`, and `tests/checklist.md` together when dependencies, env vars, or files change.\n- Prefer small provider adapters over coupling shared domain modules to one provider.\n"
    },
    {
      "name": "cloudflare",
      "target": ".stackfoundry/skills/cloudflare/SKILL.md",
      "content": "---\nname: cloudflare\ndescription: Cloudflare platform guidance for installed Workers, storage, and edge modules.\n---\n\n# Cloudflare Guidance\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/cloudflare/SKILL.md`\n- Registry source: `registry/skills/cloudflare/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep bindings explicit in config and docs.\n- Do not commit wrangler secrets or account credentials.\n- Document local dev, preview, and production deployment commands.\n- Verify bindings, routes, and logs after deploy.\n"
    },
    {
      "name": "nextjs",
      "target": ".stackfoundry/skills/nextjs/SKILL.md",
      "content": "---\nname: nextjs\ndescription: Maintain Next.js App Router code installed by StackFoundry modules.\n---\n\n# Next.js Operating Instructions\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/nextjs/SKILL.md`\n- Registry source: `registry/skills/nextjs/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep server-only data access out of Client Components.\n- Put route handlers under `app/api` and UI routes under the relevant App Router segment.\n- Prefer Server Components for data loading and add `\"use client\"` only for interactivity.\n- Keep public environment variables prefixed with `NEXT_PUBLIC_`; keep secrets server-only.\n- Re-run typecheck and build after changing route handlers, layouts, or shared app configuration.\n"
    }
  ],
  "envVars": {
    "CLOUDFLARE_ACCOUNT_ID": "",
    "CLOUDFLARE_API_TOKEN": ""
  },
  "docs": "# Cloudflare Workers Module\n\nCloudflare Worker entrypoint, Wrangler config example, and edge API route starter.\n\n## Official Docs\n\n- [Cloudflare Workers Docs](https://developers.cloudflare.com/workers/)\n\n## Owns\n\n- `cloudflare/workers/api-worker.ts`\n- `cloudflare/workers/wrangler.example.jsonc`\n- `apps/web/src/app/(console)/admin/cloudflare/workers/page.tsx`\n\n## Dependencies\n\nNo package dependencies.\n\n## Environment\n\n- `CLOUDFLARE_ACCOUNT_ID`\n- `CLOUDFLARE_API_TOKEN`\n\n## Maintenance\n\n- Keep this module focused on the provider adapter boundary.\n- Keep secrets in environment variables and never commit local credentials.\n- Verify the example route or worker path before promoting this module beyond experimental.\n- Update docs, checklist, and manifest metadata when provider APIs change.\n",
  "meta": {
    "category": "edge",
    "env": [
      "CLOUDFLARE_ACCOUNT_ID",
      "CLOUDFLARE_API_TOKEN"
    ],
    "status": "ready",
    "maturity": "ready",
    "recommendedFor": []
  }
}
