A thin, stable portability layer over the platform primitives an app uses — database, object storage, key/value, queues, stateful objects, vector index, and AI. It is inspired by Cloudflare's clean serverless APIs and aims for feature parity across runtimes — without promising a 1:1 match everywhere. The organizing principle:
Cloudflare is the reference implementation and stays first-class and zero-overhead. The layer never gets in the way of targeting Cloudflare: on that target your code runs against the native bindings, unchanged. The same application code can then target other runtimes — local Node and
os.mieweb.orgtoday, with AWS and GCP planned — through adapters that implement the same Cloudflare-shaped contract as faithfully as each environment allows.Design bias: compatibility over purity, parity over perfection. Adapters chase Cloudflare's behavior closely, but where a runtime genuinely can't match a primitive the difference is surfaced honestly (an explicit
UnsupportedBindingErroror a documented gap) rather than faked. The first version makes an existing Cloudflare codebase portable with the fewest possible source changes.
Packages, split by what a consumer must install, not by module:
| Package | Role |
|---|---|
mieweb |
Installable CLI entry point: run npx mieweb, or install once with npm install -g mieweb and run mieweb. Wrangler is optional and fetched on demand for Cloudflare commands. |
@mieweb/cloud |
Zero dependencies. The portable contracts (CloudDatabase, CloudBucket, CloudKV, CloudQueue, CloudStatefulNamespace, CloudVectorIndex, CloudAI, CloudContainerNamespace, UnsupportedBindingError) and, at @mieweb/cloud/workers, the DurableObject base behind the mieweb:workers import — re-exports cloudflare:workers on Cloudflare (workerd export condition), pure-JS base everywhere else. This is the only package a Cloudflare app touches. |
@mieweb/cloud-adapters |
Off-Cloudflare adapters + the Node host harness and migration runner. ./local: D1→SQLite, R2→filesystem, KV→in-memory, Queues→in-process, Durable Objects→in-process, Vectorize→sqlite-vec. ./os (os.mieweb.org / self-hosted): D1→libSQL, Vectorize→libSQL vectors, R2→S3/MinIO, KV+Queues→Valkey; ships a docker-compose.yml. Backend SDKs are optional peers — install only what your target needs. |
@mieweb/cli |
Implements the mieweb command. Its built-in providers deploy to os.mieweb.org (default) and Cloudflare. The Node host harness runs workers locally with the appropriate binding adapters. |
@mieweb/deploy-contract |
Zero dependencies. The provider-agnostic control-plane contract: the DeployProvider interface (+ AuthError, RESOURCE_KINDS) and a ./testkit conformance suite. The CLI consumes it; deploy backends implement it. |
@mieweb/deploy-wrangler |
The Cloudflare reference DeployProvider — uses an existing Wrangler installation or fetches it on demand for Cloudflare commands. Set MIEWEB_REAL_WRANGLER for an explicit override. The canonical implementation other providers (opensource-server, future AWS/GCP) are measured against via the test-kit. |
@mieweb/test-app (private) |
A tiny worker that exercises every contract surface over plain HTTP, plus a cross-target runner. The same worker + the same assertions prove the layer on cloudflare, local, and mieweb. See Try it. |
import { DurableObject } from 'mieweb:workers'resolves via three coordinated aliases —tsconfig.jsonpaths(typecheck),wrangler.jsoncalias(Cloudflare build), and the@mieweb/cloud/workersexportsconditions (runtime).mieweb initwrites the first two; they're an implementation detail you never edit.wrangler.jsoncstays the source of truth for bindings/migrations/queues/DO tags. Usemieweb.jsoncto select a target and configure its deployment provider and binding adapters.- The CLI reads both files to configure the deploy provider and runtime adapters for the selected target.
Requires Node.js 22.18 or newer. By default, mieweb login opens the
os.mieweb.org Manager in your browser. Check your identity with whoami, then
run deploy from your project directory.
npx mieweb login
npx mieweb whoami
npx mieweb deployOr install once and use the command directly:
npm install -g mieweb
mieweb login
mieweb whoami
mieweb deployRun a one-off command in a running guest with
mieweb exec --site <id> --container <id> -- node --version. This requires a
Manager and OS provider with exec support. It preserves guest stdout, stderr,
and exit status for scripts. Guest exec details
Other commands that use a target print its name to standard error. For commands
that contact an opensource-server Manager, the same line includes its URL.
Deploy, tail and destroy also show the site ID when one is configured.
Wrangler commands show the named environment selected with --env or
CLOUDFLARE_ENV.
$ npx mieweb whoami
[mieweb] Target: mieweb (https://manager.os.mieweb.org)
Authenticated as alex (login) — provider "opensource-server".For CI, set MIEWEB_OS_TOKEN to a Manager API key. The first deploy uses your
only available site or prompts you to choose one. Set MIEWEB_OS_SITE_ID or
targets.mieweb.siteId in mieweb.jsonc to select it in advance. For a new
project, npx mieweb init my-app creates a worker with the start script and
binding dependencies used by the opensource-server cloud image.
The CLI uses the first target specified by --target, MIEWEB_TARGET, or
target in mieweb.jsonc, and defaults to mieweb (os.mieweb.org).
For a Cloudflare project, set "target": "cloudflare" in mieweb.jsonc or
pass --target cloudflare on individual commands.
# os.mieweb.org
mieweb deploy
mieweb tail
# Local development with SQLite and in-memory adapters
mieweb --target local dev
# Cloudflare
mieweb --target cloudflare login
mieweb --target cloudflare deployThe mieweb target runs dev on the Node host harness, using the services
configured in targets.mieweb.bindings. Login and deployment use the bundled
@mieweb/os-cloud-provider. See the opensource-server deployment guide.
Cloudflare commands use Wrangler. The CLI resolves MIEWEB_REAL_WRANGLER
first, then a project-installed Wrangler, and fetches it on demand when needed.
The CLI installation itself does not require Wrangler. To supply a custom
deploy provider for a target, set targets.<target>.provider in mieweb.jsonc.
packages/test-app is a worker whose routes each touch
exactly one binding — D1, R2, KV, Queues, Durable Objects, Vectorize, AI — so a
single set of HTTP assertions reads like a contract checklist. The cross-target
runner boots that worker on each target and runs the same checks:
pnpm install
# one target at a time
pnpm --filter @mieweb/test-app check:local # in-process Node adapters
pnpm --filter @mieweb/test-app check:docker # mieweb/os: spins up libSQL+MinIO+Valkey
pnpm --filter @mieweb/test-app check:cf # Cloudflare via `wrangler dev` (Miniflare)
# everything available (docker auto-skips without Docker, cf without wrangler)
pnpm --filter @mieweb/test-app check:allSurfaces a target can't provide answer 501 { skipped: true } instead of
failing (e.g. Workers AI needs a model backend; Cloudflare local dev can't reach
Vectorize/AI without credentials), so one suite stays green everywhere. The
local target also runs as a plain node --test under pnpm -r test.
Cloudflare Containers (DO-controlled Linux containers) are a reserved
surface of the contract: CloudContainerNamespace / CloudContainerStub in
@mieweb/cloud. App code uses the stock Cloudflare shape — a
class MyContainer extends Container (from @cloudflare/containers) paired
with a containers entry + DO binding in wrangler.jsonc — and stays
target-agnostic.
| Target | Support |
|---|---|
cloudflare |
✅ native (wrangler dev / wrangler deploy, wrangler containers ssh for a shell) |
local |
⏳ planned — Docker-backed adapter; today a container binding throws UnsupportedBindingError on use |
mieweb |
⏳ planned — image distribution via skopeo → Harbor, cluster runtime TBD |
See container-plan.md for the milestones, the skopeo/Harbor
image pipeline, and the myapp walkthrough.
0.x — published to npm as mieweb and @mieweb/*; the API may change between minor
versions. Cloudflare is fully supported; the local Node target
and the mieweb (os.mieweb.org) target both cover D1, R2, KV, Queues, Durable
Objects, and Vectorize, with Workers AI available when a model backend is
configured. Every target is exercised by the test app
and in CI.