[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81279":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":13,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":12,"stars30d":14,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":12,"starSnapshotCount":12,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},81279,"effect-cf","danieljvdm\u002Feffect-cf","danieljvdm","Effect-native primitives for Cloudflare Workers and bindings.",null,"TypeScript",52,0,1,4,40.4,"MIT License",false,"main",true,[],"2026-06-12 04:01:32","# effect-cf\n\nEffect-native primitives for Cloudflare Workers, Durable Objects, bindings, KV, and Durable Object storage.\n\n## Install\n\n`effect-cf` currently targets Effect 4 beta.\n\n```bash\nbun add effect-cf \"effect@^4.0.0-beta.65\"\n```\n\n```bash\npnpm add effect-cf \"effect@^4.0.0-beta.65\"\n```\n\n```bash\nnpm install effect-cf \"effect@^4.0.0-beta.65\"\n```\n\n## Design\n\n`effect-cf` keeps Cloudflare code inside Effect. Cloudflare services are modeled as `Context`, `Layer`, and `Effect` values, and runtime boundaries live at Worker and Durable Object entrypoints.\n\nBinding types come from code-owned definitions such as `Worker.Tag(...)` and `DurableObject.Tag(...)`. Generated Wrangler types are only used as local config checks.\n\n## A Taste\n\nA Worker can route HTTP with Effect and call a Durable Object through a typed binding:\n\n```ts\nimport { Effect, Layer, Schema as S } from \"effect\";\nimport { HttpRouter, HttpServerResponse } from \"effect\u002Funstable\u002Fhttp\";\nimport { DurableObject, DurableObjectState, Worker } from \"effect-cf\";\n\nclass Counter extends DurableObject.Tag\u003CCounter>()(\"Counter\", {\n  increment: DurableObject.method({ success: S.Number }),\n}) {}\n\nconst CounterLive = Counter.make(Layer.empty, {\n  rpc: {\n    increment: () =>\n      Effect.gen(function* () {\n        const state = yield* DurableObjectState.DurableObjectState;\n        const current = yield* state.storage.get\u003Cnumber>(\"count\");\n        const next = (current ?? 0) + 1;\n        yield* state.storage.put(\"count\", next);\n        return next;\n      }),\n  },\n});\n\nexport class CounterDurableObject extends CounterLive {}\n\nconst CounterLayer = Counter.layer({ binding: \"COUNTER\" });\n\nconst app = Effect.gen(function* () {\n  const router = yield* HttpRouter.HttpRouter;\n  const counters = yield* Counter;\n  const counter = counters.byName(\"home\");\n\n  return yield* router\n    .get(\n      \"\u002F\",\n      Effect.gen(function* () {\n        const count = yield* counter.increment();\n        return HttpServerResponse.text(`Viewed ${count} times`);\n      }),\n    )\n    .asHttpEffect();\n});\n\nexport default Worker.make(Layer.mergeAll(HttpRouter.layer, CounterLayer), app);\n```\n\n`COUNTER` is still declared in `wrangler.jsonc`, but the callable API is inferred from the `Counter` class. The Worker and Durable Object both run through `effect-cf` runtime boundaries.\n\n## Examples\n\nThe `examples\u002F` directory demonstrates package usage across Workers, Durable Objects, service bindings, and frontend consumers.\n\n## Changelog\n\nSee [packages\u002Feffect-cf\u002FCHANGELOG.md](.\u002Fpackages\u002Feffect-cf\u002FCHANGELOG.md).\n\n## Contributing\n\nSee [CONTRIBUTING.md](.\u002FCONTRIBUTING.md).\n\n## License\n\nMIT\n","`effect-cf` 项目为 Cloudflare Workers 和 Durable Objects 提供了 Effect-native 原语和绑定。该项目利用 TypeScript 编写，通过将 Cloudflare 服务建模为 `Context`、`Layer` 和 `Effect` 值，实现了在 Effect 框架内无缝集成 Cloudflare 代码，支持 KV 存储及 Durable Object 存储等功能。它特别适用于需要在 Cloudflare 环境中构建高效、类型安全的服务器端应用或微服务场景，如处理 HTTP 请求、管理状态持久化等。开发者可以通过定义类来创建 Durable Objects 并通过类型安全的方式与之交互，同时保持对 Wrangler 配置文件中的声明式定义。",2,"2026-06-11 04:04:27","CREATED_QUERY"]