45 ms·
Show HN: OpenWorkers – Self-hosted Cloudflare workers in Rust
I've been working on this for some time now, starting with vm2, then deno-core for 2 years, and recently rewrote it on rusty_v8 with Claude's help.
OpenWorkers lets you run untrusted JS in V8 isolates on your own infrastructure. Same DX as Cloudflare Workers, no vendor lock-in.
What works today: fetch, KV, Postgres bindings, S3/R2, cron scheduling, crypto.subtle.
Self-hosting is a single docker-compose file + Postgres.
Would love feedback on the architecture and what feature you'd want next.
- deleted 9mo ago[deleted]
- vmg12 9mo agoDoes this actually use the cloudflare worker runtime or is this just a way to run code in v8 isolates?
- max_lt 9mo agoIt's a custom V8 runtime built with rusty_v8, not the actual Cloudflare runtime (github.com/openworkers/openworkers-runtime-v8). The goal is API compatibility – same Worker syntax (fetch handler, Request/Response, etc.) so you can migrate code easily. Under the hood it's completely independent.
- indigodaddy 9mo agoPerhaps it might be helpful to some to also lay out the things that don't work today (or eg roadmap of what's being worked on that doesn't currently work?). Anyway, looks very cool!
- simonw 9mo agoThe problem with sandboxing solutions is that they have to provide very solid guarantees that code can't escape the sandbox, which is really difficult to do. Any time I'm evaluating a sandbox that's what I want to see: evidence that it's been robustly tested against all manner of potential attacks, accompanied by detailed documentation to help me understand how it protects against them. This level of documentation is rare! I'm not sure I can point to an example that feels good to me. So the next thing I look for is evidence that the solution is being used in production by a company large enough to have a dedicated security team maintaining it, and with real money on the line for if the system breaks.
- vlovich123 9mo agoSince it’s self hosted the sandboxing aspect at the language/runtime level probably matters just a little bit less.
- samwillis 9mo agoYes, exactly. The other reason Cloudflare workers runtime is secure is that they are incredibly active at keeping it patched and up to date with V8 main. It's often ahead of Chrome in adopting V8 releases.
- oldmanhorton 9mo agoI didn’t know this, but there are also security downsides to being ahead of chrome — namely, all chrome releases take dependencies on “known good” v8 release versions which have at least passed normal tests and minimal fuzzing, but also v8 releases go through much more public review and fuzzing by the time they reach chrome stable channel. I expect if you want to be as secure as possible, you’d want to stay aligned with “whatever v8 is in chrome stable.”
- kentonv 9mo agoCloudflare Workers often rolls out V8 security patches to production before Chrome itself does. That's different from beta vs. stable channel. When there is a security patch, generally all branches receive the patch at about the same time. As for beta vs. stable, Cloudflare Workers is generally somewhere in between. Every 6 weeks, Chrome and V8's dev branch is promoted to beta, beta branch to stable, and stable becomes obsolete. Somewhere during the six weeks between verisons, Cloudflare Workers moves from stable to beta. This has to happen before the stable version becomes obsolete, otherwise Workers would stop receiving security updates. Generally there is some work involved in doing the upgrade, so it's not good to leave it to the last moment. Typically Workers will update from stable to beta somewhere mid-to-late in the cycle, and then that beta version subsequently becomes stable shortly thereafter. (I'm the lead engineer for Cloudflare Workers.)
- kachapopopow 9mo agoI see anything that reduces the relience on vendor lock-in I upvote. Hopefully cloud services see mass exodus so they have to have reasonable pricing that actually reflects their costs instead of charging more than free for basic services like NAT. Cloud services are actually really nice and convenient if you were to ignore the eye watering cost versus DIY.
- geek_at 9mo agoI'm worrying that the increasing ram prices will drive more people away from local and more to cloud services because if the big companies are buying up all the resources it might not be feasible to self host in a few years
- kachapopopow 9mo agothe pricing is so insane it will always be cheaper to self host by 100x, that's how bad it is.
- Imustaskforhelp 9mo agoWait what? can you show me some sources to back this up? I assume you are exaggerating but still, what would be the definition of cheap is interesting to know. I don't think after the fact that ram prices spiked 4-5x that its gonna be cheaper to self host by 100x, Like hetzner's or ovh's cloud offerings are cheap Plus you have to put a lot of money and then still pay for something like colocation if you are competing with them Even if you aren't, I think that the models are different. They are models of monthly subscription whereas in hardware, you have to purchase it. It would be interesting tho to compare hardware-as-a-service or similar as well but I don't know if I see them for individual stuff.
- andruby 9mo ago100x is probably hyperbole. 37 signals saved between 50 and 66% in hosting costs when moving from cloud to self hosted. https://basecamp.com/cloud-exit https://basecamp.com/cloud-exit
- kristianpaul 9mo agoInteresting option to consider next to openfaas
- st3fan 9mo agoThis is very nice! Do you plan to hook this up to GitHub, so that a push of worker code (and maybe a yaml describing the environment & resources) will result in a redeploy?
- max_lt 9mo agoNot yet, but it's one of the next big features. I'm currently working on the CLI (WIP), and GitHub integration with auto-deploy on push will come after that. A yaml config for bindings/cron is definitely on the roadmap too.
- max_lt 9mo agoI'm also working on execution recording/replay – the idea is to capture a deterministic trace of a request, so you can push it as a GitHub issue and replay it locally (or let an AI debug it).
- strangescript 9mo agoCool project, but I never found the cloudflare DX desirable compared to self hosted alternatives. A plain old node server in a docker container was much easier to manage, use and is scalable. Cloudflare's system was just a hoop that you needed to jump through to get to the other nice to haves in their cloud.
- skybrian 9mo agoWould it be useful for testing apps that you're going to deploy on Cloudflare anyway?
- mohsen1 9mo agoThis is super nice! Thank you for working on this! Recently really enjoying CloudFlare Workflows (used it in https://mafia-arena.com https://mafia-arena.com) and would be nice to build Workflows on top of this too.
- max_lt 9mo agoThanks! Workflows is definitely interesting – it's basically durable execution with steps and retries. It's on the radar, probably after the CLI and GitHub integration.
- kachapopopow 9mo agoCould you add a kubernetes deployment quick-start? Just a simple deployment.yaml is enough.
- max_lt 9mo agoYes, I see this is a popular request. Will add it soon. For now, compose files are in the infra repo: https://github.com/openworkers/openworkers-infra https://github.com/openworkers/openworkers-infra Fun fact: I tried K8s early on but found it overkill for my setup, so I stayed on Compose. Will revisit it properly now.
- kachapopopow 9mo agok3s is a good non overkill alternative while benefiting from everything k8s offers.
- dangoodmanUT 9mo agoThis is similar to what rivet (1) does, perhaps focusing more on stateless than rivet does (1) https://www.rivet.dev/docs/actors/ https://www.rivet.dev/docs/actors/
- tbrockman 9mo agoCool project, great work! Forgive the uninformed questions, but given that `workerd` (https://github.com/cloudflare/workerd https://github.com/cloudflare/workerd) is "open-source" (in terms of the runtime itself, less so the deployment model), is the main distinction here that OpenWorkers provides a complete environment? Any notable differences between the respective runtimes themselves? Is the intention to ever provide a managed offering for scalability/enterprise features, or primarily focus on enabling self-hosting for DIYers?
- max_lt 9mo agoThanks! Main differences: 1. Complete stack: workerd is just the runtime. OpenWorkers includes the full platform – dashboard, API, scheduler, logs, and self-hostable bindings (KV, S3/R2, Postgres). 2. Runtime: workerd uses Cloudflare's C++ codebase, OpenWorkers is Rust + rusty_v8. Simpler, easier to hack on. 3. Managed offering: Yes, there's already one at dash.openworkers.com – free tier available. But self-hosting is a first-class citizen.
- csomar 9mo agoQuestion: Do you support WASM workers? How does the deployment experience compared to Wrangler? If I have a wasm worker and only use KV, how identical will be the deployed worker to that of Cloudflare?
- max_lt 9mo agoWASM is supported, V8 handles it natively. Tested it briefly, works, but not user-friendly at all yet. OpenWorkers CLI is in development. We're at the pre-wrangler stage honestly. Dashboard or API for now, wrangler-style DX with Github/GitLab integration is the goal.
- buremba 9mo agoI wonder why V8 is considered as superior compared to WASM for sandboxing.
- skybrian 9mo agoOn V8, you can run both JavaScript and WASM.
- buremba 9mo agoTheoretically yes, but CF workers or this project doesn't support it. Indeed none of the cloud providers support WASM as first-party support yet.
- otterley 9mo agoThe problem is that there’s not much of a market opportunity yet. Customers aren’t voting for WASM with their wallets like they are mainstream language runtimes.
- justincormack 9mo agoWorkers does support wasm https://developers.cloudflare.com/workers/runtime-apis/webassembly/ https://developers.cloudflare.com/workers/runtime-apis/webas...
- buremba 9mo agoMaybe it's better now but I wouldn't call this first-class support, as you rely on the JS runtime to initialize WASM. The last time I tried it, the cold start was over 10 seconds, making it unusable for any practical use case. Maybe the tech is not there but given that WASM guarantees the sandboxing already and supports multiple languages, I was hoping we would have providers investing in it.
- max_lt 9mo agoCF Workers does support WASM. We do too as V8 handles it natively. Tested it, works, just hasn't been polished yet.
- byyll 9mo agoIsn't the whole point of Cloudflare's Workers to pay per function? If it is self-hosted, you must dedicate hardware in advance, even if it's rented in the cloud.
- shimman 9mo agoMany companies run selfhosted servers in data centers still need to run software on top of this. Not every company needs to pay people to do things they are capable themselves. Having options that mimic paid services is a good thing and helps with adoptability.
- j1elo 9mo agoTo the author: The ASCII-art Architecture diagram is very broken, at least on my Pixel phone with Firefox. These kinds of text-based diagrams are appealing for us techies, but in the end I learned that they are less practical. My suggestion is to use an image, and think of the text-based version as the "source code" which you keep, meanwile what gets published is the output of "compiling" it into something that is for sure always viewable without mistake (that one is where we tend to miss it with ascii-art).
- vishnugupta 9mo agoRendered perfectly on my iPhone 11 Safari.
- simlevesque 9mo agoThat's why we need to test websites on multiple browsers.
- max_lt 9mo agoThanks for the heads up! Fixed – added a simplified ASCII version for mobile.
- j1elo 9mo agoThanks! Now I can make more sense of it! Very cool project by the way, thanks for posting it
- bob1029 9mo ago> It brings the power of edge computing to your own infrastructure. I like the idea of self-hosting, but it seems fairly strongly opposed to the concept of edge computing. The edge is only made possible by big ass vendors like Cloudflare. Your own infrastructure is very unlikely to have 300+ points of presence on the global web. You can replicate this with a heterogeneous fleet of smaller and more "ethical" vendors, but also with a lot more effort and downside risk.
- patmorgan23 9mo agoBut do you need 300 pops to benefit from the edge model? Or would 10 pops in your primary territory be enough.
- trevor-e 9mo agoI agree, latency is very important and 300 pops is great, but seems more for marketing and would see diminishing returns for the majority of applications.
- st3fan 9mo agomany apps are fine on a single server
- andrewaylett 9mo agoHonestly, for my own stuff I only need one PoP to be close to my users. And I've avoided using Cloudflare because they're too far away. More seriously, I think there's a distinction between "edge-style" and actual edge that's important here. Most of the services I've been involved in wouldn't benefit from any kind of edge placement: that's not the lowest hanging fruit for performance improvements. But that doesn't mean that the "workers" model wouldn't fit, and indeed I suspect that using a workers model would help folk architect their stuff in a form that is not only more performant, but also more amenable to edge placement.
- nrhrjrjrjtntbt 9mo agoFor most applications 1 location is probably good enough.I assume HN is single location and I am a lomg way from CA but have no speed issues. Cavaet for high scale sites and game servers. Maybe for image heavy sites too (but self hosting then adding a CDN seems like a low lock in and low cost option)
- nextaccountic 9mo agoAny reason to abandon Deno? edit: if the idea was to have compatibility with cloudflare workers, workers can run deno https://docs.deno.com/examples/cloudflare_workers_tutorial/ https://docs.deno.com/examples/cloudflare_workers_tutorial/
- max_lt 9mo agoDeno core is great and I didn't really abandon Deno – we support 5 runtimes actually, and Deno is the second most advanced one (https://github.com/openworkers/openworkers-runtime-deno https://github.com/openworkers/openworkers-runtime-deno). It broke a few weeks ago when I added the new bindings system and I haven't had time to fix it yet. Focused on shipping bindings fast with the V8 runtime. Will get back to Deno support soon.
- orliesaurus 9mo agoGood to see this! Cloudflare's cool, but those locked-in things (KV, D1, etc.) always made it hard to switch. Offering open-source alternatives is always good, but maintainign them is on the community. Even without super-secure multi-tenancy, being able to run the same code on your own stuff or a small VPS without changing the storage is a huge dev experience boost.
- victorbjorklund 9mo agoCool. I always liked CF workers but haven’t shipped anything serious with it due to not wanting vendor lock-in. This is perfect for knowing you always got a escape hatch.
- theknarf 9mo agoWhy would I want this over just sticking Node / Deno / Bun in a Docker container?
- m11a 9mo agoNode in Docker doesn’t have full isolation and ‘sandbox’ escapes are possible. V8 is comparatively quite hardened
- abalashov 9mo agoWhat if we hosted the cloud... on our own computers? I see we have entered that phase in the ebb and flow of cloud vs. self-hosting. I'm seeing lots of echoes of this everywhere, epitomised by talks like this: https://youtu.be/tWz4Eqh9USc https://youtu.be/tWz4Eqh9USc
- locknitpicker 9mo ago> What if we hosted the cloud... on our own computers? The value proposition of function-as-a-service offerings is not "cloud" buzzwords, but providing an event-handling framework where developers can focus on implementing event handlers that are triggered by specific events. FaaS frameworks are the high-level counterpart of the low-pevel message brokers+web services/background tasks. Once you include queues in the list of primitives, durable executions are another step in that direction. If you have any experience developing and maintaining web services, you'll understand that API work is largely comprised of writing boilerplate code, controller actions, and background tasks. FaaS frameworks abstract away the boilerplate work.
- nine_k 9mo agoIt won't be a... cloud? To me, the principal differentiator is the elasticity. I start and retire instances according to my needs, and only pay for the resources I've actually consumed. This is only possible on a very large shared pool of resources, where spikes of use even out somehow. If I host everything myself, the cloud-like deployment tools simplify my life, but I still pay the full price for my rented / colocated server. This makes sense when my load is reasonably even and predictable. This also makes sense when it's my home NAS or media server anyway. (It is similar to using a bus vs owning a van.)
- rcarmo 9mo agoIt will be a very small cloud.
- utopiah 9mo agoDX? I'm quite ignorant on the topic (as I never saw the appeal of Cloudflare workers, not due to technical problems but solely because of centralization) but what does DX in "goal has always been the same: run JavaScript on your own servers, with the same DX as Cloudflare Workers but without vendor lock-in." mean? Looks like a runtime or environment but looking at https://github.com/drzo/workerd https://github.com/drzo/workerd I also don't see it. Anyway if the "DX" is a kind of runtime, in which actual contexts is it better than the incumbents, e.g. Node, or the newer ones e.g. Deno or Zig or even more broadly WASI?
- lukevp 9mo agoDX means Developer Experience, they're saying it lets you use the same tooling and commands to build the workers as you would if they were on CloudFlare.
- utopiah 9mo agoThanks for the clarification! Damn I read "DevEx" before but not DX until today, damn I'm outdated! Anyway, back to vim ;)
- locknitpicker 9mo ago> Anyway if the "DX" is a kind of runtime, in which actual contexts is it better than the incumbents, e.g. Node, or the newer ones e.g. Deno or Zig or even more broadly WASI? I'm not the blogger, I'm just a developer who works professionally with Cloudflare Workers. To me the main value proposition is avoiding vendor lock-in, and even so the logic doesn't seem to be there. The main value proposition of Cloudflare Workers is being able to deploy workers at the edge and use them to implement edge use cases. Meaning, custom cache logic, perhaps some pauthorization work, request transformation and aggregation, etc. If you remove the global edge network and cache, you do not have any compelling reason to look at this. It's also perplexing how the sales pitch is Rust+WASM. This completely defeats the whole purpose of Cloudflare Workers. The whole point of using workers is to have very fast isolates handling IO-heavy workloads where they stay idling the majority of the time so that the same isolate instance can handle a high volume of requests. WASM is notorious for eliminating the ability to yield on awaits from fetch calls, and is only compelling if your argument is a lift-and-shift usecase. Which this ain't it.
- TZubiri 9mo agohttps://imgflip.com/i/agah04 https://imgflip.com/i/agah04
- TZubiri 9mo agohttps://imgflip.com/i/agah2y https://imgflip.com/i/agah2y
- mmastrac 9mo agoI did a huge chunk of work to split deno_core from deno a few years back and TBH I don't blame you from moving to raw rusty_v8. There was a _lot_ of legacy code in deno_core that was challenging to remove because touching a lot of the code would break random downstream tests in deno constantly.
- max_lt 9mo agoThanks for that work! deno_core is a beautiful piece of work and is still an option for OpenWorkers: https://github.com/openworkers/openworkers-runtime-deno https://github.com/openworkers/openworkers-runtime-deno We maintained it until we introduced bindings — at that point, we wanted more fine-grained control over the runtime internals, so we moved to raw rusty_v8 to iterate faster. We'll probably circle back and add the missing pieces to the deno runtime at some point.
- keepamovin 9mo agoTechnically, and architecturally this is excellent. It’s also an excellent product idea. And I’m particularly a fan of the big-ass-vendor-inversion-model where instead of the big ass vendor ripping off an open source project and monetizing it, you look at one of their projects and you rip it off inversely and open source it — this is the way.
- valdair3d 9mo agoSelf-hosted workers are becoming critical infrastructure for AI agent workloads. When you're running agents that need to interact with external services - web scraping, API orchestration, browser automation - you hit Cloudflare's execution limits fast. The 30s CPU time on the free tier and even the 15min on paid plans don't work for long-running agent tasks. The isolation model here is interesting. For agents that need to handle untrusted input (processing user URLs, parsing arbitrary documents), V8 isolates give you a security boundary that's much lighter than full container isolation. But you trade off the ability to do things like spawn subprocesses or access the filesystem. Curious about the persistence story. Most agent workflows need some form of state between invocations - conversation history, task progress, cached auth tokens. Is there a built-in KV store or does this expect external storage?
- max_lt 9mo agoGood use case. For state between invocations, we have KV (key-value with TTL), Storage (S3) and DB bindings (Postgres). Durable Objects not yet but it's on the roadmap. Wall-clock timeout is configurable (default 30s), CPU limits too. We haven't prioritized long-running tasks or WebSockets yet, but shouldn't be hard to add.
- valdair3d 8mo agonice, KV + Postgres covers most of our use cases. the TTL on KV is useful for caching auth tokens between invocations without worrying about cleanup. for long-running tasks we've been using a queue pattern anyway - worker picks up task, does a chunk, writes state to KV, exits. next invocation picks up where it left off. works around timeout limits and handles retries gracefully. websockets would be nice for real-time feedback but polling works fine for now. will keep an eye on the durable objects progress. that's the main thing missing for stateful agent workflows where you need guaranteed delivery.
- IntelliAvatar 9mo agoNice project. One thing Cloudflare Workers gets right is strong execution isolation. When self-hosting, what’s the failure model if user code misbehaves? Is there any runtime-level guardrail or tracing for side-effects? Asking because execution is usually where things go sideways.
- max_lt 9mo agoWorkers that hit limits (CPU, memory, wall-clock) get terminated cleanly with a clear reason. Exceptions are caught with stack traces (at least it should lol), logs stream in real-time. What's next: execution recording. Every invocation captures a trace: request, binding calls, timing. Replay locally or hand it to an AI debugger. No more "works on my machine". I think the CLI will look like: # Replay a recorded execution: openworkers replay --execution-id abc123 # Replay with updated code, compare behavior: openworkers replay --execution-id abc123 --worker ./dist/my-fix.js Production bug -> replay -> AI fix -> verified -> deployed. That's what I have in mind.
- deleted 9mo ago[deleted]
- deleted 9mo ago[deleted]
- IntelliAvatar 9mo agoThis makes a lot of sense. Recording execution + replay is exactly what’s missing once you move past simple logging. One thing I’ve found tricky in similar setups is making sure the trace is captured before side-effects happen, otherwise replay can lie to you. If you get that boundary right, the prod → replay → fix → verify loop becomes much more reliable. Really like the direction.
- mariopt 9mo agoAmazing work! I have been thinking exactly about this. CF Workers are nice but the vendor lock-in is a massive issue mid to long term. Bringing D1 makes a lot of sense for web apps via libSql (SQLite with read/write replicas). Do you intended to work with the current wrangler file format? Does this currently work with Hono.js with the cloudflare connector>
- max_lt 9mo agoWrangler file format: not planned. We're taking a different approach for config but we intend to be compatible with Cloudflare adapters (SvelteKit, Astro, etc). Assets binding already has the same API. We just need to support _routes.json and add static file routing on top of workers, data model is ready for it. For D1: our DB binding is Postgres-based, so the API differs slightly. Same idea, different backend. Hono should just work, it just needs a manual build step and copy paste for now. We will soon host OpenWorkers dashboard and API (Hono) directly on the runner (just some plumbing to do at this point).
- mariopt 9mo agoI think it would be worth it to keep the D1 compatibility, Sqlite and Postgres have different SQL dialects. Cloudflare has Hyperdrive to keep the connection alive to Postgres/other dbs, what D1/libSql/Turso brings to the table is the ability to run a read/write replica in the machine, this can dramatically reduce the latency.
- willtemperley 9mo agoI've decided to ditch CF because Wrangler is deployed via NPM and I cannot bear NodeJS and Microsoft NPM anymore. I get the impression this can't be run without NodeJS right now?
- max_lt 9mo agoConclusion shared. No Node required — the runtime is pure Rust + V8. The only transformation we do is transpilation for TS code.
- brainless 9mo agoI am always interested in seeing alternatives in the edge compute space but self hosting does not make sense to me. The benefit of edge is the availability close to customers. Unless I run many servers, it is simply easier to run one server instead of "edge".
- rcarmo 9mo agoNice. An obvious link to the compose file would be great (I assume you have prebuilt images on ghcr.io?), and if it happens to work on ARM, I will certainly give it a try.
- max_lt 9mo agoDocker compose is here: https://github.com/openworkers/openworkers-infra https://github.com/openworkers/openworkers-infra Images are on ghcr.io. I code on ARM myself and the runner build image is multi-platform, so it should work. Haven't tested in a while though, let me know how it goes!
- rcarmo 9mo agoSure thing. Got sidetracked this weekend with pre-work cleaning, will get back to it soon, hopefully.
- yencabulator 9mo agoI don't see a single license mentioned anywhere?