open-compute README

项目的 README,来自 github.com/elliothux/open-compute。合并为一个 markdown 文件:README.md。

open-compute

One binary. One daemon. Isolated instances.
A self-hosted, Cloudflare Workers-compatible platform for a single machine.

CI Apache-2.0 verified workerd fork 2256 stable members and overloads Rust 1.98 macOS | Linux

Website · Docs · Compatibility · Architecture

English · 简体中文


The Workers platform, running on your hardware

You already know how to write Cloudflare Workers. open-compute runs the compatible Workers programming model — module workers, familiar bindings, and cf workflows — on a single machine you own.

One binary. One shared daemon. One object authority per instance. Local filesystem is the default; S3-compatible storage is optional.

No Kubernetes. No Redis. No service mesh. No distributed control plane to babysit. No vendor lock-in.

   Everyone else                        open-compute
   ─────────────                        ────────────
   gateway + router                     ┌──────────────┐
   control plane                        │              │
   scheduler service          ═══>      │  ocd (1 bin) │
   Redis / Valkey cluster               │              │
   Postgres                             └──────────────┘
   K8s + operators                       + SQLite + Local/S3 objects

Why open-compute

workerd is a runtime, not a platform. It executes isolated Workers brilliantly — and stops there. No multi-tenant routing, no durable state, no scheduling, no deployment lifecycle, no control API. Everyone who wants Workers on their own infrastructure has to build that layer.

open-compute is that layer — and it ships as one file.

Compatibility

Write standard module workers (export default { fetch }) with the bindings you already know. Supported means the documented public API matches Cloudflare. Single-node differences are listed in the compatibility guide. A running daemon reports its surface with ocd capabilities --json. If behavior differs from Cloudflare, please open an issue.

Supported Partial Not yet
Workers, Workers Standard limits Cloudflare v4 API: /client/v4 works with cf and the official SDK General Workers AI inference
KV, R2, D1 Dashboard: operator UI on the same /client/v4 API Hyperdrive
Durable Objects, Alarms Workers Logs and Live Tail, on one node Analytics Engine
Queues, Cron, Workflows Workers AI: Markdown Conversion and AI Search only Workers for Platforms
Static Assets, Service Bindings Browser Run: CDP, managed browser, Quick Actions, DevTools, Live View, Custom AI (operator guide) Pipelines
Cache, Images Containers: 65-member API with directory restore; needs an operator-owned Linux Broker; tag qualification pending Rate Limiting
Version Metadata, WebSocket Hibernation mTLS certificates
Vectorize, Markdown Conversion, AI Search Tail Workers, traces, Logpush
Artifacts, Dynamic Workers
cf 1.0.0-beta.21 deploys and manages the supported products

Uploads or configuration that need a "Not yet" capability are rejected.

The test suite tracks 2,256 stable API members and overloads. Ten products (Workers, Cache, KV, D1, R2, Durable Objects, Queues, Vectorize, AI Search and Observability) are compared request by request with real Cloudflare where the hosted API allows it.

Quick start

Set up with an AI coding agent

Copy this prompt into Codex, Claude Code, or another coding agent:

Read https://open-compute.dev/llms.txt and install the current open-compute release on this machine. Configure one local instance, inspect any existing installation first, preserve its configuration and instance data, ask before using sudo or making destructive changes, then run ocd status and report the result.

llms.txt contains the minimum setup and usage instructions, with links to detailed documentation when needed.

Set up manually

Install the release binary for your user, create the default user-owned instance, and start its login-scoped service:

curl -fsSL https://open-compute.dev/install.sh | sh
ocd setup --yes
ocd status
ocd dashboard

For a host-wide service that starts before login, explicitly choose system scope:

curl -fsSL https://open-compute.dev/install.sh | sudo sh
sudo ocd setup --system --yes

Use cloudflare.config.ts and the official cf + Vite plugin v2 workflow. Node.js 22.18+ runs cf; ocd cf selects the deployment target. CI pins cf 1.0.0-beta.21; user versions outside 1.0.x only warn:

npm install --save-dev [email protected] @cloudflare/vite-plugin@beta vite typescript
npm run dev
npm run build
ocd cf deploy --prebuilt --mode production

Production remains one release executable and one shared daemon, with explicit per-instance configuration and data directories. Runtime payloads are embedded and verified; daemon startup does not download or search PATH for workerd.

For the complete installation path, remote targets, CI, environments, tail, and rollback, see Get started and Develop.

Architecture

open-compute architecture

Component Role
ocd The control plane: ingress, API, scheduler, supervisor, and deployment authority
workerd Pinned, checksum-verified Worker runtime
SQLite Local authoritative state — no external database, no eventual consistency
Local / S3 object authority Bundles, static assets, R2 bytes, Artifacts, snapshots, backups, cache bodies, and AI sources

Tenants get exactly what their deployment declares — and nothing else. No SQLite or Local object paths, no S3 credentials, no internal tokens, no sibling tenants. Enforced at the capability layer, not by convention.

Built in Rust, engineered for the hot path

The host is a single async Rust process — no GC pauses, no interpreter, no sidecar hops between the socket and your Worker.

Layered crates with enforced boundaries

CI checks the dependency direction:

core ── storage ── artifacts ── runtime      (siblings, lower level)
                    └── workers              (may use core/storage/artifacts, never runtime)
                          └── service        (composition root: CLI, HTTP, workerd bridge)

ocd compiles the runtime configuration, starts workerd as a supervised child, and communicates over a loopback-only channel. It owns readiness, graceful shutdown, restart backoff, and recovery.

Deployments are immutable and content-addressed. workerLoader keys are deployment identities, so promotion and rollback move a pointer — they never mutate what is already running.

Dashboard

open-compute Dashboard in dark and light mode

The Dashboard manages the compute, storage, AI, and platform resources exposed through /client/v4. It also switches between the instances registered with the current ocd daemon.

Native extensions

When a Worker needs local hardware, a proprietary library, or an internal daemon, an operator can register a native extension: a native Provider process with a small JavaScript facade, exposed to Workers through cf Service Bindings (bindings.worker + props).

The extension tutorial walks through the complete setup. The repository also includes a small Rust reference Provider.

What it's not

Documentation

Goal Start here
Understand the design Architecture and project guide
Check API support Compatibility · Worker API index
Track unsupported features Not available
Build and deploy Workers Develop
Download and release GitHub Releases · Project guide
Run in production Get started · Operate
Operate and recover Operate · Incident guides
Contribute Contributing guide · Code of conduct

Security

Report vulnerabilities privately using SECURITY.md.

Sponsors

This project is sponsored by Lynx AI.

License

Apache-2.0. The packaged open-compute workerd fork remains under the applicable upstream Cloudflare workerd licensing.

open-compute (elliothux/open-compute)

正在搜索数据库…

这是什么?open-compute 是一个自托管平台,可以在你自己控制的硬件上原样运行 Cloudflare Workers 代码,把 Workers、KV、D1、R2、Durable Objects、Queues、Workflows、Cron、Cache、Images、Vectorize 和 AI Search 重新实现为单个 Rust 二进制文件。
这只是 workerd 运行时,还是一个完整的平台?它是构建在 workerd 之上的完整平台。workerd 只在沙箱中执行隔离的 Workers;open-compute 补上了缺失的控制平面——路由、持久化状态、调度和部署生命周期——并将这一切打包为单个二进制文件(ocd)。
我怎么在上面部署我的第一个 Worker?先在本地把平台启动起来,然后使用你已有的、与 Cloudflare 相同的 Wrangler CLI 进行部署。一条命令即可完成类型检查、打包、部署并运行 Worker。在生产环境中,它以一个可执行文件、一个配置文件和一个数据目录的形式运行。
构建和运行它需要安装什么?构建它需要 Rust 1.98、Bun 1.3.14、Node 26 和 Git LFS。编译好的生产二进制文件则完全不需要这些——启动时宿主机上既无需构建工具,也无需网络访问。
还有哪些 Cloudflare 功能尚未实现?Workers AI、Containers、Hyperdrive、Analytics Engine、Workers for Platforms、Pipelines、Rate Limiting、mTLS 证书以及 Tail Workers/Logpush 都还处于 0%,尚未实现。Vectorize 和 AI Search 只完成了 80%。
它能像真正的 Cloudflare 那样跨多台机器扩展吗?不能,它从设计上就明确是单节点的:一个数据目录、一个进程、一台机器,没有 Cloudflare 真实边缘网络那样的 Anycast 路由或跨区域复制。
它会向 Cloudflare 回传信息或需要账户吗?不会——它完全离线运行,不需要 Cloudflare 账户,没有外呼请求,没有遥测,也没有账单。
它与真实 Cloudflare 行为的实际吻合度有多高?团队用相同的测试夹具对 open-compute 和真实 Cloudflare 进行验证,出现不一致就拒绝发布:实现了 2,097 个 API 成员且零缺口,7 个产品面全部逐一通过字节级验证,一个生产环境的 Next.js 16 构建在两者上的运行结果完全一致。
我的数据实际存放在哪里?平台元数据保存在本地 SQLite 数据库中,R2 数据、bundle 和缓存快照等对象字节默认存放在本地文件系统上,唯一的替代选项是可选的 S3 兼容存储——不需要 Redis 或外部数据库。
为什么要构建这个,而不直接使用 workerd?workerd 只运行隔离的 Workers——它本身没有路由、持久化状态、调度器或部署 API。open-compute 用完整的控制平面(ocd)包装原版 workerd,因此无需额外运行其他组件。
我还能使用 Cloudflare 控制台或 API 工具吗?Wrangler 几乎无需改动即可使用,锁定在 4.127.1 版本并经过 95% 验证,对接本地 /client/v4 API;同一 API 上还有一个单独的运维管理界面——不过它并不是 Cloudflare 自家控制台的克隆。
作者
elliothux
大小
94.3 MB
星标
4K
时长
3个月
提交 · 90 天