Spindle is a CLI that provisions a private, full-stack website —
static frontend, SQL database, file storage, gated sign-in via Cloudflare
Access, subdomain routing — entirely on infrastructure you own: your own free
Cloudflare account, no credit card, no paid plan. No domain required — every
site gets a free *.workers.dev URL by default; a custom domain is an
upgrade you add later, never the entry fee.
git clone https://github.com/spindlehq/spindle.git && cd spindle
pnpm install && pnpm build && (cd packages/cli && pnpm link --global)
spindle create my-family-site --db --storage && spindle deploy my-family-site
Status: pre-alpha, under active development. Not yet published to npm.
No code path here has been run against a live Cloudflare account yet.
Every Cloudflare-touching operation — init, create, deploy, destroy,
backup, and the rest — is unverified end to end; treat all of it as
unproven until you've run it yourself against a real account. Commands and
flags below reflect the current design
(docs/spindle-architecture.md) and the
authoritative shared contract
(packages/core/src/types.ts); some are
not wired up end to end yet.
Every row below runs on Cloudflare's free plan. No credit card, no paid Cloudflare plan required for any of it.
| Capability | Cloudflare service | Free-tier limit | Enabled by |
|---|---|---|---|
| Static hosting | Workers Static Assets | 100k Worker-invocation requests/day; unlimited static-asset requests; 100 projects/account | every site |
| SQL database | D1 | 5 GB total storage (500 MB/database), 10 databases/account, 5M rows read/day, 100k rows written/day | --db |
| File storage | R2 | 10 GB-month storage, 1M Class A + 10M Class B ops/month, zero egress fees | --storage |
Private login (Google if init registered it) |
Access | 50 authenticated users, hard permanent cap | --auth |
| Subdomain routing | Workers Custom Domain | 100 custom domains/zone; DNS record and TLS auto-provisioned | --subdomain |
| Backup | R2 sync + wrangler d1 export, to a target you control |
off-platform by design — not a Cloudflare service | spindle backup (manual; no automatic schedule) |
| Push-to-deploy | GitHub Actions, via your own gh session + cloudflare/wrangler-action |
governed by your GitHub account, not Cloudflare | spindle connect-github |
| Realtime (opt-in) | Durable Objects, SQLite-backed, Hibernation WebSocket API only | 100k requests/day, 13,000 GB-s/day compute, 5 GB storage | --realtime |
| Semantic search (opt-in) | Vectorize + Workers AI embeddings | 30M queried vector dimensions/month, 5M stored vectors | --search |
| AI (opt-in) | Workers AI binding | 10,000 "Neurons"/day | --ai |
Spindle checks the environment before it ever asks you to do anything. Only one external tool needs a separate install:
ghCLI — installed and authenticated (gh auth status), with theworkflowscope. Needed only forspindle connect-github(push-to-deploy). If you're not setting up push-to-deploy, you don't need it at all.
What is not a separate install, on purpose:
- Wrangler — a bundled npm dependency of
@spindle/core, not a system tool you install yourself.spindle initcollects your Cloudflare API token directly; there is nothing to check for or install. - Node/pnpm — implied by running from source (
pnpm install/pnpm build) even running at all.Node >= 20is required.
What you still need, unrelated to tooling:
- A free Cloudflare account, and an API token you create yourself there —
spindle initverifies it against Cloudflare; it never mints one for you. If the token can see more than one account,spindle initprompts you to pick one (or pass--account-idnon-interactively). - Nothing else, to get a live site:
spindle init --no-zoneskips the zone lookup entirely, and every site gets a free*.workers.devURL — that's the default first-run experience, not a fallback. - A domain using Cloudflare as its authoritative nameservers ("Full Setup")
— the upgrade path, needed only to unlock
--subdomain(a custom hostname) and--auth(private sign-in, which needs that hostname to protect). - Five minutes in Google Cloud Console to create an OAuth client — needed
only for Google-branded login via
--auth. This is the one step Spindle cannot automate (Google doesn't expose it via API);spindle initprints the exact fields and redirect URI to fill in, then reads the resulting client ID/secret from--google-client-id/--google-client-secretorSPINDLE_GOOGLE_CLIENT_ID/SPINDLE_GOOGLE_CLIENT_SECRET. Skip it andspindle initsays so plainly — Access then falls back to whatever identity providers already exist on your Zero Trust organization, which on a brand-new org is email one-time PIN, so sites are still gated, just not via Google until you come back and fill this in.
No published package exists yet — running from source (see
Running from source, below) is the only path that
works today; the walkthrough here picks up right after that. npx create-spindle is the intended entry point once Spindle publishes to npm
(mirroring npm create cloudflare@latest's convention) — it does not exist
yet.
$ spindle doctor
Spindle environment:
✓ Node 20.11 (>=20 required)
✗ CLOUDFLARE_API_TOKEN is not set
→ Create an API token at https://dash.cloudflare.com/profile/api-tokens with these scopes: Zone:DNS:Edit, Account:Workers Scripts:Edit, Account:D1:Edit, Account:R2:Edit, Account:Access:Edit. Then export it in this shell: export CLOUDFLARE_API_TOKEN=<token>
✓ gh version 2.63.0 (2025-08-01)
✓ GitHub CLI authenticated as you
✓ GitHub token has the `workflow` scope
✗ Cloudflare account not yet initialized
→ run `spindle init`
2 of 6 checks need attention (2 required, 0 optional).
✗ Not ready yet — clear the required items above, then re-run `spindle doctor`.
gh is the only optional check — it gates spindle connect-github
(push-to-deploy) alone and never flips the exit code by itself. The two
required items above are what's actually blocking.
$ export CLOUDFLARE_API_TOKEN=<the token you created>
$ spindle init --no-zone
Runs once per Cloudflare account: verifies the token against Cloudflare
(never creates one — the scope recipe above is what spindle init itself
prints if you don't have a token yet), resolves which account it belongs
to — prompting if the token can see more than one, or via --account-id
non-interactively — and, with --no-zone, skips the zone lookup, the DNS
mail-record preflight, and the Zero Trust org lookup entirely:
✓ Cloudflare account connected — no domain, sites deploy to *.workers.dev
Writes .spindle/state.json, gitignored by default. Add a domain later
with spindle init --zone yourdomain.com — it tops up the existing account
instead of starting over.
$ spindle create my-family-site --db --storage
$ spindle deploy my-family-site
create scaffolds the site and provisions D1 and R2 — the site isn't live
yet. deploy publishes the Worker and static assets and prints its live
URL: a free *.workers.dev hostname, no domain required.
--auth gates a site behind Cloudflare Access, and Access can only protect
a hostname the site actually has — so it needs a domain, via --subdomain
on this create (or an earlier one):
$ spindle init --zone yourdomain.com # skip if you already have a zone
$ spindle create my-family-site --subdomain family --auth "you@gmail.com,spouse@gmail.com"
$ spindle deploy my-family-site
That second create is a top-up on the same site from above — the D1/R2
already provisioned are left alone; only the subdomain and Access grant are
new. The site now serves at family.yourdomain.com, gated behind Google
sign-in if init registered it, or email one-time-PIN otherwise. Attaching
a domain or an Access grant also turns off the site's *.workers.dev URL
(workers_dev: false is forced the moment either exists) — the custom
domain becomes the only public entry point from then on.
If you are a coding agent working in this repo, or scaffolding a site with it on someone's behalf:
- Run
spindle doctorfirst, and act only on what it reports. Never prompt the user about a check that already reportsok— the point ofdoctoris that you don't have to ask. It is a separate, explicit command —init,create, andconnect-githubdo not run it for you, so call it yourself before any of them. Skip it and you find out about a missingghCLI or an uninitialized account from a raw thrown error instead of a clean report (connect-githubin particular checksgh auth statusitself and, on failure, throws and tells you to go runspindle doctor— it does not run it on your behalf). - Every consequential action is a yes/no confirmation, never a
copy-paste command dump and never silent. Installing a missing tool,
refreshing a
ghauth scope, creating a GitHub repo — each surfaces as "Do you want me to do X? [Y/n]" through theConfirmFncallback inpackages/core/src/types.ts. A decline falls back to printing the exact manual command; it never blocks the rest of the flow. spindle initis idempotent and silent on repeat. A.spindle/state.jsonthat already has anaccountblock means account setup is skipped automatically on every later command — don't re-run it "just in case" and don't ask the user to confirm settings that are already recorded.- Fully non-interactive path, start to finish:
export CLOUDFLARE_API_TOKEN=<token with the 5 scopes `spindle doctor` lists> spindle doctor spindle init --no-zone --yes spindle create <name> --db spindle deploy <name>--yes(-y) answers every confirmation prompt Spindle would otherwise ask — installing a missing tool, refreshing aghauth scope, creating a GitHub repo, confirming a destroy — so nothing blocks on a TTY that doesn't exist.SPINDLE_DEBUG=1prints the full stack trace on an unexpected failure instead of the one-line message Spindle shows by default. - Every scaffolded site gets its own
sites/<name>/AGENTS.md, written at creation time — it documents that specific site's bindings (env.DB,env.BUCKET,env.ASSETS, etc.), where its actual code lives, and whatspindle deploydoes for it. Read that file before extending a site you didn't scaffold yourself; don't re-derive Spindle's conventions from scratch.
| Command | Purpose | Key flags |
|---|---|---|
spindle doctor |
Report environment/account status; offer to fix what it can | — |
spindle init |
One-time-per-account setup: API token, account, zone (optional), DNS preflight, Google IdP (optional) | --token <token> --zone <domain> --no-zone --account-id <id> --google-client-id <id> --google-client-secret <secret> |
spindle create <name> |
Scaffold and provision a site (does not publish it — see deploy) |
--db --storage --auth <list> --realtime --search --ai --template <minimal|full> --subdomain <label> |
spindle add-database <name> |
Create a D1 database for an existing site and bind it | — |
spindle add-storage <name> |
Create an R2 bucket for an existing site and bind it | — |
spindle enable-auth <name> |
Gate an existing site behind a verified Cloudflare Access sign-in — Google if init registered it, else your Zero Trust org's providers (grants are additive) |
--auth <list> (required) |
spindle enable-realtime <name> |
Add a hibernating Durable Object for WebSocket realtime | — |
spindle enable-search <name> |
Add a Vectorize index plus Workers AI embeddings | — |
spindle deploy <name> |
Publish a site's Worker and static assets; attaches the custom domain (DNS + TLS) on first run | — |
spindle list |
List provisioned sites and their bindings | — |
spindle destroy <name> |
Remove a site's Worker and Access app; keeps its D1, R2, and Vectorize data | — |
spindle backup <name|all> |
Copy R2 objects and a D1 export to a target you control — manual, no scheduling | --target <path> |
spindle connect-github <name> |
Wire git push to a deploy via GitHub Actions |
--repo <owner/repo> (omitted → offers to create a private repo) |
--target is a local directory path — that's the only backup target the
CLI wires up in v0.1. BackupTarget in
packages/core/src/types.ts also declares an "s3-compatible" kind, but
core.backupSite throws immediately if it's ever passed one: it isn't
implemented yet. Sync a local backup onward yourself (rclone/
aws s3 sync) if you want a copy off this machine too.
spindle backup is manual by design in v0.1 — there is no --schedule
flag. The backup routine runs on your machine (local filesystem writes,
shelling out to wrangler), so it cannot run inside a Cloudflare Worker,
and no generated template exports a scheduled() handler for a Cron
Trigger to invoke regardless. Schedule it yourself: a cron entry
(0 3 * * * cd /path/to/project && spindle backup all) or, on macOS, a
launchd agent — cron entries don't run while the machine is asleep, launchd
agents do.
spindle destroy never deletes D1 data, R2 objects, or a Vectorize index,
on any flag — a deliberate safety decision from the risk review, not a
limitation: a mistyped CLI argument must not be able to irreversibly delete
a family's photos or records. It removes only the site's Worker and its
Cloudflare Access application. Removing data is a separate, deliberate
step: npx wrangler d1 delete <db> / npx wrangler r2 bucket delete <bucket> (the generated site's AGENTS.md prints the exact commands).
--auth also needs the site to have a domain — see
Add a custom domain and private login
above; the rule below is about what each value grants once the site has one.
Each --auth value is either a full email or a bare domain, matching
Cloudflare Access's own two policy-rule types directly:
- Contains
@(me@gmail.com) → grants that one person. - No
@(mycompany.com) → grants every account on that domain. - A bare consumer webmail domain (
gmail.com,yahoo.com,outlook.com,hotmail.com,icloud.com,aol.com,protonmail.com, and similar) is a hard validation error, with no override — granting "the whole domain" there means granting every person on Earth with a free email account.spindle create foo --auth gmail.comrefuses and suggestsme@gmail.cominstead. - The same check catches a subdomain of a blocked provider, not just
the bare domain —
mail.gmail.comis exactly as open a grant asgmail.comitself, so it's refused the same way. The match is dot-anchored, not a plain suffix check: an unrelated domain that merely shares a trailing substring, likenotgmail.com, is correctly still allowed. - Lists mix freely:
--auth "me@gmail.com,ourfamily.org"grants one person plus everyone on a real family or company domain.
git clone https://github.com/spindlehq/spindle.git
cd spindle
pnpm install
pnpm build
cd packages/cli && pnpm link --global
This is the only onboarding path today — see the status note at the top of
this file. It will go through the identical spindle doctor / spindle init flow that npx create-spindle uses once that package is published;
there is no separate "from source" onboarding. Contributing code to
Spindle itself (not just using it) follows the workflow in
AGENTS.md: issue → worktree → exit gate (pnpm typecheck && pnpm lint && pnpm build && pnpm test) → PR.
The numbers that matter at typical personal-project scale:
| Service | Free-tier limit |
|---|---|
| Workers requests | 100,000/day |
| D1 | 5 GB total storage, 5,000,000 rows read/day |
| R2 | 10 GB-month storage, zero egress fees |
| Access | 50 authenticated users (hard cap) |
| Durable Objects | 100,000 requests/day |
That's real and it's free indefinitely at this traffic level. It is not the
whole picture: the free plan carries no SLA and no uptime guarantee —
Cloudflare has had roughly three significant incidents a year since 2023,
including two in 2025 that took down Access logins and D1/Durable Objects
alongside the CDN — and Cloudflare's own Developer Platform terms disclaim
any obligation to retain your content after a suspension. Paying more money
fixes exactly one of the findings in that review (D1's point-in-time-recovery
window, 7 days free → 30 days paid). Read the full review, including the
incident history and the account-suspension analysis, before you point a
domain you care about at this: docs/spindle-risks.md.
Four mitigations for the above are not optional advice — they're built into Spindle's defaults:
spindle backupships as a core command from day one. It's manual by design — there is no--scheduleflag — so run it yourself, or add a cron/launchd entry on your own machine, so a suspension or outage never means data loss.- Use a dedicated Cloudflare account for this site (or this family of sites), never one that also holds unrelated projects — a suspension takes the whole account down at once, DNS included, regardless of cause.
- Register the domain at a third-party registrar, nameservers pointed at Cloudflare only — a Cloudflare-Registrar domain is ICANN-locked to Cloudflare for up to 60 days after registration/transfer, turning an account problem into a domain problem too.
spindle init's DNS preflight check runs before any nameserver cutover and refuses to proceed without explicit confirmation if it finds existing MX/SPF/DKIM records — these don't auto-migrate, and silent email loss is the most preventable high-consequence failure mode in the whole design.
spindle/
packages/
core/ @spindle/core — provisioning: wrangler CLI (child_process) + Cloudflare REST API
cli/ @spindle/cli — the `spindle` command
runtime/ @spindle/runtime — canonical source for the Worker-side
helpers; hand-vendored into
`templates/full/src/lib/`, not imported
by generated sites (see
docs/spindle-architecture.md)
templates/
minimal/ static-only starter
full/ + D1 + R2 + Access + realtime DO
docs/ architecture, free-tier verification, risk review, lock-in/exit review
Apache-2.0 — see LICENSE.