TECHNOLOGY / OPEN SOURCE
Ordinary parts. Assembled once.
Every venture needs a backend, and none of them should build one. The parts a company needs to exist are written once, as an open-source harness in Rust. A venture picks the modules it wants, wires them in one file, and ships as a single stateless worker with its own database.
HOW A VENTURE IS BUILT
One file names the company.
A venture backend is a small Rust project. It lists the modules it uses, the adapters that connect them to the world, and the venture's own name and domain. Everything else is the harness. Build it and the result is one worker that contains exactly those modules and nothing else.
If a module needs something the runtime cannot provide, or two modules claim the same table, the build fails before anything is deployed. A misconfigured venture cannot reach production.
Harness::builder()
.venture(Venture::new("factory0", "factory0.ventures")
.cors_origins(["https://factory0.ventures"]))
.module(EmailSignup::new().double_opt_in(true))
.module(Waitlist::new()
.products(["kontinuum", "undercover-rockstars"]))
.runtime(Cloudflare::new()
.db("DB")
.mailer(Resend::from_env())
.captcha(Turnstile::from_env()))
.build()?
THE STACK
- LANGUAGE
- Rust
- COMPUTE
- Cloudflare Workers, compiled to WebAssembly
- DATABASE
- Cloudflare D1 today, self-hosted Postgres later
- ROUTER
- axum, the same router on the edge and on a server
- QUERIES
- sea-query, one query rendered for SQLite or Postgres
- Resend, through a port the module never sees
- ABUSE
- Turnstile and per-address rate limits on every public write
- SESSIONS
- None. Signed tokens with key rotation
DESIGN RULES
01
Modules only see ports.
A module asks for a database, a mailer, a captcha. It never touches a Cloudflare binding or a vendor client. Adapters answer. That one rule is what makes the later move off Cloudflare a change of a single crate.
02
Composition happens at compile time.
No plugin loading, no registry service, no runtime surprises. The worker contains what the venture listed. The compiler is the first reviewer. One narrowing is designed: a module whose source should not enter the shared build can run as its own worker, mounted at the same path over a service binding. It is still composed, just not into the same binary.
03
One venture, one database.
Nothing is shared at runtime between companies. Each has its own worker, its own data, its own secrets. A venture can be backed up, moved or shut down without touching another.
04
Stateless by construction.
Nothing survives a request except what is written to the database. Confirmation and unsubscribe links are signed tokens, so there is no session store to run, scale or leak.
WHAT IS OPEN
The factory floor is public. The recipes are not.
The harness, its runtime, its adapters and the first two modules are MIT licensed and developed in the open. Anyone can build a backend on them, and every venture we run does. The modules that encode how Factory Zero operates its companies stay private. Each venture's own backend is private too.
One venture is the harness itself. Cratefield takes the open-source harness and adds the managed layer around it: it would provision the worker, the database and the secrets inside your own Cloudflare account and then operate them. The harness is real and running; that control plane is designed and not yet written. It is also where the module boundary earns its keep: a customer can build and deploy a module of their own without the source ever reaching us.
Decisions are written down as they are made. The architecture document and the decision records are in the repository, including the one recording why a first attempt was thrown away.
- MITharnesscore, runtime, adapters, email signup, waitlist, CLI, test kit
- DOCarchitecturethe full design, twelve sections
- ADRdecision recordswhy Rust, why ports, why one database per venture
- MITventure backend templatewhat a new venture starts from
- SRCthis websitestatic, no build step, no dependencies
- FZ-004Cratefieldthe managed service being built on the harness
- ORGgithub.com/Factory-Zerothe studio org; the harness itself now sits under Cratefield
STATUS
- DESIGN
- Adopted, nine decision records
- FOUNDATION
- M0 merged, 7 crates
- FIRST MODULES
- Email signup and waitlist, merged
- PUBLISHED
- Not yet on crates.io
Progress is tracked as issues and milestones in the open. When the first venture backend goes live, it will be this site's own signup.