https://sproutboat.com
The CLI for Sproutboat. Compiles a
fetch handler to a native binary and ships it to any Sproutboat control plane.
Tracked centrally in sproutboat/sproutboat
(label area:cli). Please file there.
Wrangler-shaped, MIT licensed. build and deploy cross-compile your handler
to a static linux-x86_64 binary with Porffor and Zig —
no Docker, no root, nothing to run as a daemon.
Full reference: sproutboat.com/docs (plain text for agents: sproutboat.com/llms.txt).
The npm package installs a small Node launcher and the matching native
platform package, so npm i -D sproutboat, npm i -g sproutboat and npx sproutboat work
without Bun on darwin and linux for arm64 and x64. The self-hosted
runtime exports remain in the root package for Bun-based platform integrations.
Nothing is needed on the machine that runs a sprout: that gets a static
binary.
The first build downloads the pinned Porffor source into
~/.cache/sproutboat, verifies its SHA-256, applies Sproutboat's compiler
patches there, and publishes the cache entry atomically. Installation itself
does not clone Porffor or invoke Git, Make, or a compiler. Warm-cache builds can
run offline.
Install it in each project, as you would Wrangler. The CLI is the compiler, so a project that pins its version builds the same way on every machine and in CI:
npm i -D sproutboat # pnpm add -D sproutboat, bun add -d sproutboat, yarn add -D sproutboatsproutboat init does this for you: it writes a package.json with
sproutboat in devDependencies and dev, deploy and check scripts.
npx sproutboat init hello # or: pnpm dlx sproutboat init hello, bunx sproutboat init hello
cd hello
npm install
npm run dev # runs it right here, no control plane neededWant a starting point with more in it? init has four starters, each standard Workers TypeScript with a README,
tests and a current worker-configuration.d.ts, and each one runs unchanged on Cloudflare:
npx sproutboat init --list-templates
npx sproutboat init chat --template realtime-room # Durable Object, hibernating WebSockets, presence
npx sproutboat init tasks --template api-d1 # JSON API on D1 with migrations and validation
npx sproutboat init site --template site-api # static site and its API routes in one Worker
npx sproutboat init nightly --template jobs # cron enqueues, a queue consumer works, KV holds stateIn a terminal init asks for the template, the directory, whether to install and whether to use git, the way
npm create cloudflare does; -y takes the defaults and --no-install / --no-git skip a step.
Happy with it? Log in once, then ship it:
npx sproutboat login # one approval in the browser; add --api-url for a self-hosted box
npm run deploy # or: npx sproutboat deployFor quick commands outside a project, install it globally. A global install is
not pinned to anything, so keep it for init, login and whoami:
npm i -g sproutboat # then: sproutboat init, sproutboat whoami, ...login is one-time. It writes the credential to credentials.json in the user
config directory (mode 0600), keyed by API URL, so you can hold logins for
several instances at once. Profile names and the default profile are in profiles.json beside it;
credentials.json keeps the format older CLIs read, so projects pinned to an older version keep working. The directory follows Wrangler: SPROUTBOAT_CONFIG_DIR
or XDG_CONFIG_HOME if set, else ~/Library/Preferences/sproutboat on macOS and
~/.config/sproutboat elsewhere (the old macOS place is still read).
The default endpoint is https://dash.sproutboat.com, the Sproutboat Cloud.
login there is the device-code flow, like gh auth login:
sproutboat login # prints a code and a link, opens the browser when it can
sproutboat whoami # the team, the key and what it may do
sproutboat deploy # uploads the app, waits for a host, prints the live URL
sproutboat logout # deletes the key on the server, then the local copyOpen the link on any device where you are signed in, pick the team, check the
machine name and Approve. That mints an account API key named
CLI on <hostname> for that team, with your role capped at Developer. It shows
up under Settings, API keys, where you can revoke it. --account <team>
preselects the team on the approval page.
-
Which target. Like Wrangler, there is one target, chosen by your credentials: the endpoint you are logged in to (
--api-url, thenSPROUTBOAT_API_URL, then the saved active endpoint, then the default). The CLI asks the endpoint what it is (GET /v1/config) and works with a Sproutboat Cloud only: any other endpoint is refused, and a self-hosted Community server is no longer supported. There is no--cloudflag. -
CI.
SPROUTBOAT_API_TOKEN(an account API key, likeCLOUDFLARE_API_TOKEN) always wins over a stored login.SPROUTBOAT_TOKENis the older name. With no terminal and no token,deployfails and namesSPROUTBOAT_API_TOKEN; in a terminal it starts the login itself. -
Which team.
accountinsproutboat.settings.jsonc(a legacysproutboat.jsonckeeps its ownaccount), else--account, elseSPROUTBOAT_ACCOUNT, else your only stored team, else a prompt. Precedence is--account, the environment variable, then the file. A key from the environment belongs to one team, so a differentaccountis an error. -
Which addresses. A deploy puts
<app>.<team>.sproutboat.appamong the app's routes, the way a Worker gets itsworkers.devaddress.workers_devinsproutboat.jsonc(or the file named with--config) is Wrangler's switch for it:"workers_dev": falsemakes a deploy take that name out and leave every other route as it is, and without the key the name is on (Wrangler defaults it to true when the config declares norouteorroutes, and this config has none). Every deploy,--dry-runand--prepare-outincluded, prints arouteline saying whether the name is on or off and why. An app may have no route at all, as a Worker may (a cron-only app, or one reached only by a service binding); the deploy says it has no public address. Turning the name off in the dashboard does not stick: the next deploy puts it back unless the config saysworkers_dev: false. Wrangler'spreview_urlshas no counterpart, since a Cloud app has no version or preview URLs. -
Build. The Cloud builds your app.
deploybundles the project here, uploads that one file by its sha256 (it skips the upload when the Cloud already has it), asks the Cloud to build it and streams the build log:Bundling src/index.js (212 KiB) Uploading source a3f1c9d2e044 (212 KiB) Building queued (position 1) | porffor: compiled in 1.0 s ✓ Built in 4.1 s · peak memory 742 MB (cap 1200 MB)An identical build is answered from the Cloud's cache. Ctrl-C cancels the build.
--no-waitreturns once the build is accepted and prints/v1/builds/<id>. A queued build shows why it is held back (such as waiting for memory) and keeps waiting. A build that fails prints the reason and its peak memory, and exits 1; a source is limited to 8 MiB.--module app.soand--sproutdwith--generationare operator paths for a prebuilt or locally compiled module; a team key is refused with "modules are built by the Cloud", and regular deploys never need them. -
Result. The first deploy creates the app (
Created), later ones sayUpdated. The app is served athttps://<app>.<team>.sproutboat.app, and the deploy waits until a host has applied the generation it printed.--dry-runprints the plan and says it would build in the Cloud, without uploading;--no-waitskips the wait. -
Secrets. As with Wrangler, secrets belong to the app and a deploy never wipes them.
sproutboat secrets put NAME(value on stdin, or--value),secrets listandsecrets delete NAMEact on the deployed app at once; they need thesecret:writeandsecret:listpermissions and say so on a 403. An app that is not deployed yet has nowhere to keep them: deploy first, or passdeploy --secrets-file <file>(.dev.varsor.envsyntax, or JSON{"NAME": "value"}as in Wrangler;UPPER_SNAKEnames; an empty value is a value) on the first deploy; its values are merged into the app's secrets and nothing else is removed. A build deploy stores its spec in plaintext, so the secrets are never in it: once the build is ready they are set with onePATCH /v1/apps/<app>/secrets, and the deploy waits for that newer generation. On a first deploy the app is briefly live before its secrets land, and--secrets-filecannot be combined with--no-wait. A deploy never reads.dev.varson its own: name the file. Production values do not belong in.dev.vars; keep a separate file. -
Required secrets.
secrets: { "required": ["API_KEY"] }in awrangler.jsonc(per environment:env.<name>.secrets, not inherited) is Wrangler's list of secrets the app cannot run without. Since an unset secret readsundefined, as on Cloudflare, code that does not check it can fail open; the list makes the platform check.deploystops, before anything is built or uploaded, when a name is neither stored on the app nor in--secrets-file(an empty value counts, as in Wrangler), with Wrangler's message ("The following required secrets have not been set: ..."); a first deploy has no app to put a secret on, so it can only supply them with--secrets-file.--dry-runnever fails on it (it warns), as in Wrangler. The Cloud enforces the same rule for a deploy that does not pass the CLI (a Git push, the API, the Alchemy provider), and refuses to delete a secret the live version requires (secrets deleteshows the reason) until a deploy without it in the list is live.devreads only those names from.dev.vars/.env(secrets: {}counts too; the process environment is read in the.envbranch, and a non-empty value there beats the file's, as in Wrangler) and warns "Missing required secrets: ...";typeswrites them asstring. The legacysproutboat.jsoncsecretslist keeps its warning. Deploy with a Cloud that has the rule first (an older Cloud refuses the list by name). -
Service bindings.
services: [{ "binding": "PEER", "service": "quote-service" }]binds to the Cloud app of that name in the same team.deploylooks the app up first and refuses, before uploading anything, when it is not deployed (deploy it first, withsproutboat deployin its directory), when it is the app itself, or whencompatibility_dateis older than2026-11-18, the date from which the platform runtime serves service bindings between Cloud apps. Hosts need the matching sproutd support. -
Every other binding.
kv_namespaces,d1_databases,r2_buckets,queues,analytics_engine_datasets,durable_objects,ratelimiters, thesecretsnames, theassetsbinding andtriggers.cronsgo to the Cloud in the app record. On the Cloud each app's storage is private to it, so nothing is provisioned and no id is needed: the binding is the name (DBis the databased1 execute --remoteaddresses,UPLOADSthe bucketr2 objectaddresses), and the record's resource id is that name in lowercase (a queue's is its queue name). An account-levelidpinned insproutboat.jsoncis ignored, with a warning. The worker consumes every queue it binds, so each queue becomes one queue consumer carrying itsmax_batch_size,max_batch_timeout,max_retriesanddead_letter_queue(Cloudflare's defaults when unset).deployrefuses, before uploading anything, more than 16 crons, 16 queues or 64 bindings in all, a cron or name the Cloud would refuse, and adurable_objectsclass the entry module does not export.deploy --dry-runlists what would be sent. Storage itself is created by the host on first use and survives deploys.
A profile an older CLI stored for a self-hosted Community server stays in your
config; sproutboat logout --api-url <url> forgets it.
The everyday loop:
| Command | What it does |
|---|---|
init [name] [--template <name>] |
Scaffold a project: the hello starter, or one of four TypeScript starters with tests (--list-templates) |
dev [--port <n>] [--ip <address>] |
Run it here against a real broker, rebuilding on save; --ip 0.0.0.0 makes it reachable on your network |
deploy |
Build, provision bindings, upload, wait until the URL serves |
tail [filters] |
Live request events, console output and exceptions, like wrangler tail |
rollback <id> |
Re-activate a previous version (not on Cloud yet) |
Then check, build, versions, delete, login / logout / whoami, and
one command per storage product — kv, d1, r2, queues, secrets,
domains. The storage commands use Wrangler's spellings (kv namespace create, kv key put <key> --binding X,
r2 bucket create, d1 create, queues create); the names this CLI had before (kv create, r2 create,
kv key put <namespace> <key>, and rename) still work and are left out of the help.
On Sproutboat Cloud an app's storage is created by deploy from the bindings in its config, so the resource verbs
(create, list, info, delete), kv export and kv key / kv bulk with --remote answer that they are not
available on Cloud yet, and what works instead, without calling anything. Like Wrangler 4, kv key, kv bulk, r2 object and
d1 execute act on local dev storage unless --remote; d1 migrations and r2 object --remote work as before.
Run sproutboat with no arguments for the grouped list.
sproutboat tail streams one app's events as they happen. Each request prints
its time, method, URL, status, outcome and CPU and wall milliseconds; the app's
console.* output and uncaught exceptions print as their own lines.
sproutboat tail # pretty, colored
sproutboat tail --status 5xx --search checkout # server-side filters
sproutboat tail --format json | jq 'select(.outcome != "ok")'
sproutboat tail --recent # the last 100 request records (the old behaviour)
sproutboat tail --sprout # the sprout's raw stdout/stderr| Flag | Meaning |
|---|---|
--format pretty|json |
Colored lines (default), or one JSON event per line |
--status |
ok (below 400), error (5xx or a platform failure), a code like 404, or a class like 5xx; repeat or comma-separate |
--method |
GET,POST; repeat or comma-separate. Console-only events have no method, so this hides them |
--sampling-rate |
Keep this fraction of events, 0 to 1 |
--search |
Case-insensitive substring over the URL, console messages and exception text |
--outcome |
ok, exception, exceededWallTime, canceled, unavailable, noRoute, proxyError, ... |
Things to know:
- Console lines are not tied to a request. Concurrent requests share one
process and the runtime does not tag a line with a request id, so console
output is printed on its own, flush left, and never indented under a request.
Lines carry the time the control plane saw them (about one second of
resolution). The runtime sends
console.log,warnanderrorto the same stream without a level, so they all show aslog; uncaught exceptions are recognised and shown as errors with their stack. - The server caps the stream at ten minutes and the CLI reconnects; events in
the gap are not replayed. It also caps events per second and reports the
count it dropped on stderr, which keeps stdout clean for
--format json. - Needs a control plane with
GET /api/projects/<name>/tail(Sproutboat platform after v0.12.0). Against an older one, use--recent. - Ctrl-C stops the stream and exits 0.
SURFACE.mdis the generated inventory: every command, every argument, every env var, kept honest by a drift test.
sproutboat toolchain doctor reports the selected Porffor, Zig, SQLite, and
BearSSL inputs, cache locations, active overrides, and host compiler
prerequisites. It never downloads a toolchain or starts a compiler. Use
sproutboat toolchain doctor --json for CI or support tooling.
Manage one namespace by a kv_namespaces binding of the project (--binding) or by an id that binding pins in
sproutboat.jsonc (--namespace-id; Cloudflare ids in a Wrangler file are ignored, so use --binding there). As in
Wrangler 4, kv key, kv bulk and r2 object get | put | delete act on local dev storage by default: the same
files sproutboat dev uses in .sproutboat/dev (or the directory of --persist-to <dir>), so what you write is what
the dev server reads, and nothing is sent anywhere. --local is accepted and says the same; --remote addresses a
deployed store, which for KV keys on Sproutboat Cloud says it is not available yet. --preview is refused with a reason.
kv export has no local form, and on Sproutboat Cloud says it is not available yet.
These commands print exactly what Wrangler 4.170.0 prints: the same lines on the same stream (everything on stdout, errors
on stderr), the same JSON, the same exit codes (1 for a bad argument too) and the same flags, so a script written for
Wrangler reads them unchanged. kv key get writes the value's raw bytes (--text decodes it and adds a newline) and
prints Value not found for a missing key; kv key list prints every key as { "name", "expiration"?, "metadata"? };
kv key put takes a value or --path <file>, --ttl, --expiration and --metadata; kv bulk get prints an
object keyed by key; a kv bulk delete without -f / --force asks in a terminal and otherwise goes ahead, as
Wrangler's does. d1 execute prints JSON with --json (and only JSON, an error too, as { "error": { "text" } }) and
a table in a terminal. What is left out is Wrangler's own chrome: its wrangler <version> banner, the ✘ [ERROR]
frame and the help dump after a usage error. test/wrangler-golden/ holds what Wrangler printed for each case, and
src/wrangler-golden.test.ts compares.
sproutboat kv key list --binding REGISTRATIONS --prefix email:
sproutboat kv key get email:[email protected] --binding REGISTRATIONS --text
sproutboat kv key put email:[email protected] joined --binding REGISTRATIONS
sproutboat kv key delete email:[email protected] --binding REGISTRATIONS
sproutboat r2 object put UPLOADS/logo.png --file logo.png # local; --remote for the Cloud's bucket
sproutboat d1 execute DB --command "SELECT count(*) AS n FROM users" --jsonThe spelling that takes the namespace's account-level name first still works:
sproutboat kv key get registrations email:[email protected] --text.
Bulk put uses the version 1 text-value format:
[
{ "key": "email:[email protected]", "value": "joined" }
]kv bulk get and kv bulk delete accept a JSON array of key strings (or of { "name" } objects, what kv key list
prints). kv bulk put accepts the entry array above, with expiration, expiration_ttl, metadata and base64.
The project file is the one Cloudflare uses: wrangler.jsonc, wrangler.json or wrangler.toml, read as written
(name, main, compatibility_date, vars, kv_namespaces, d1_databases, r2_buckets, durable_objects and
migrations, queues, triggers.crons, services, assets, ratelimits, env.<name>). The first of
wrangler.json, wrangler.jsonc, wrangler.toml, then the legacy sproutboat.jsonc, in the directory or the nearest
parent, is the project. --env or CLOUDFLARE_ENV selects env.<name> (the app is then named <name>-<env>). A Cloudflare
product Sproutboat does not run (Workers AI, Hyperdrive, Vectorize, Containers, …) loads with one warning that says what will
be missing; fields that mean nothing here (observability, upload_source_maps, …) are silent. Cloudflare ids on KV, D1 and R2
bindings are ignored: every app's storage is its own, named after the binding.
What is Sproutboat's own goes in sproutboat.settings.jsonc beside the file, so the Wrangler file stays stock: account (the
team), name (the app name, when the Wrangler name is not a valid one: the Cloud takes 3 to 51 characters of a-z, 0-9 and -), limits
(memory_mb, wall_ms, storage_mb; cpu_ms is Wrangler's own limits.cpu_ms) and an optional env.<name> block.
SPROUTBOAT_LIMITS_MEMORY_MB, SPROUTBOAT_LIMITS_WALL_MS and SPROUTBOAT_LIMITS_STORAGE_MB override the file.
compatibility_date in a Wrangler file is Cloudflare's: an older (or missing) date runs as 2026-11-22, so handlers always get (request, env, ctx) and bindings behave like Workers, and a later date is kept. deploy and check print the date the build uses. Only the legacy sproutboat.jsonc keeps Sproutboat's own dates.
A build tool that generates the config (the Cloudflare Vite plugin writes .wrangler/deploy/config.json) is followed: check and deploy read the generated wrangler.json from your build output, so run your build first.
The legacy file, sproutboat.jsonc (below), still works and prints a deprecation note.
The entry point plus Cloudflare-shaped env.* bindings.
A bare "CACHE" binding is auto-provisioned on deploy: the CLI creates an
account-level resource and writes its id back into sproutboat.jsonc, so the
store survives redeploys. --no-provision keeps it a throwaway per-deploy
store instead.
The handler is export default { fetch(request) }. It may import from other
files in the project and from its own node_modules, and may also export
scheduled(event) / queue(batch) handlers and Durable Object classes. env
is a global, not a parameter. Binding calls are synchronous until the compatibility
date that makes each one return a Promise, as on Workers (D1 from 2026-10-24, KV from
2026-10-25, R2 from 2026-10-26); await works at every date, so always await them.
examples/ has one small example per binding.
For objects larger than one request, use resumable R2 multipart uploads. The large-object guide covers part sizing, browser chunking, resume state, cleanup, and the remaining download limitation.
sproutboat dev runs against a real local broker, so bindings behave like
production without a deploy — except secrets, which live only in the control
plane. Put values in a .dev.vars file next to sproutboat.jsonc
(API_KEY=whatever, one per line, gitignored), or use the .env files or
sproutboat dev --env-file <file>, as in Wrangler (.dev.vars or .env, never
both), and env.API_KEY resolves under dev only. A declared secret with no
value is a warning. The rules, the dotenv syntax, and sproutboat run for
launching a standalone binary (which fails on a missing declared secret) are in
docs/standalone.md.
Bun 1.4+. The CLI fetches Zig automatically on first use and ships a prebuilt uWebSockets, so it compiles nothing else from source. On Windows, build from WSL.
Capability profile http-sync-v0: one synchronous fetch handler, optional
scheduled / queue handlers. WebSockets (from compatibility date 2026-10-30; standalone
and platform sprouts from 2026-11-01) and outbound new WebSocket(url) (2026-11-01) are
supported. Binding values are
text/JSON, one at a time over a 32 MiB loopback frame. Sprout uploads cap at
16 MiB, assets at 64 MiB / 4096 files.
Porffor is pre-1.0, so some JavaScript does not survive the compile — CommonJS
require, dynamic import(), anything reaching process/Bun/Deno/node:*,
and new Proxy(...) (it compiles, then silently ignores every trap).
sproutboat check catches most of it before a build. The full list, and the
current sharp edges, are at sproutboat.com/docs.
File issues at sproutboat/sproutboat/issues.
PRs welcome. MIGRATION.md maps this repo back to the
monorepo it was extracted from.
{ "name": "app", "main": "src/index.js", "compatibility_date": "2026-08-26", "vars": { "SITE": "hi" }, "secrets": ["API_KEY"], "kv_namespaces": ["CACHE"], // bare name, or { "binding": "CACHE", "id": "kv_..." } "d1_databases": ["DB"], "r2_buckets": ["UPLOADS"], "queues": ["JOBS"], // or { "binding": "JOBS", "queue": "jobs", "max_retries": 3, "dead_letter_queue": "failed" } "analytics_engine_datasets": ["METRICS"], // bare name only, no id "durable_objects": { "COUNTER": "Counter" }, "ratelimiters": [{ "binding": "API", "limit": 100, "period": 60 }], // env.API.limit({ key }) "triggers": { "crons": ["*/5 * * * *"] }, "assets": { "directory": "public", "binding": "ASSETS", "run_sprout_first": ["/api/*"] } }