Skip to content

Commit e53627c

Browse files
authored
Publish the complete Spacefast docs with Blume (#1)
Build the public documentation at /docs with generated API, platform API, CLI, error, search, sitemap, redirect, and mounted-404 contracts.
1 parent afa5c08 commit e53627c

523 files changed

Lines changed: 303887 additions & 259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
.blume-verify/
33
dist/
44
node_modules/
5+
content/cli/
6+
content/errors/
7+
public/_redirects
58
.env
69
.env.*
710
!.env.example

‎AGENTS.md‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Assume every commit and every line of history will be public.
99
flags, routes, defaults, or timelines.
1010
- Keep the voice direct, no-BS, and a little playful. Prefer the best path over
1111
an encyclopedia of alternatives.
12-
- The initial site is intentionally small. Do not add navigation to a section
13-
until that section has a real page or generated source.
12+
- Do not add navigation to a section until that section has a real page or
13+
generated source.
1414
- Test behavior and built output. Do not read implementation source and assert
1515
that a string exists as a substitute for exercising the result.
1616

@@ -28,10 +28,14 @@ Assume every commit and every line of history will be public.
2828

2929
## Generated ownership
3030

31-
- `generated/openapi/**`, `generated/errors/**`, and `generated/packages/**` are
32-
reserved for public-source generators. Generator jobs own their snapshots;
33-
do not hand-edit or fill them with placeholder data.
31+
- `generated/openapi/**`, `generated/errors/**`, `generated/cli/**`, and
32+
`generated/redirects.json` are one producer-owned snapshot. The exporter owns
33+
every file there, including the manifest and ownership marker. Do not
34+
hand-edit them.
3435
- `.blume/**` and `dist/**` are generated by Blume. Never edit or commit them.
36+
- `content/cli/**`, `content/errors/**`, and `public/_redirects` are ignored
37+
build overlays materialized from the verified snapshot. Do not hand-edit
38+
them.
3539
- `public/sf.jsonc` is authored here and copied to `dist/sf.jsonc` by the static
3640
build so the published artifact carries its serving config.
3741

@@ -41,6 +45,7 @@ Use Bun 1.3.11 and Node.js 24 or newer, then run:
4145

4246
```bash
4347
bun install --frozen-lockfile
48+
bun run verify:generated
4449
bun run check
4550
bun run validate
4651
bun run build

‎README.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
The public documentation site for Spacefast, built with Blume 1.0.4.
44

5-
This bootstrap starts small on purpose: an overview, a focused quickstart, and
6-
scaffolding for the reference sections that follow. Missing sections are not
7-
placeholder pages. They land when their public source is ready.
5+
The authored guides live in `content/`. API specifications, the CLI reference,
6+
error pages, and compatibility redirects arrive as one verified snapshot in
7+
`generated/`.
88

99
## Local development
1010

@@ -21,6 +21,7 @@ The production checks are:
2121
bun run check
2222
bun run validate
2323
bun run build
24+
bun run verify:generated
2425
bun run verify:public-safety
2526
bun run verify:routes
2627
```
@@ -33,7 +34,8 @@ so the physical overview remains `dist/index.html` rather than
3334
## Publishing the static artifact
3435

3536
`public/sf.jsonc` is copied to the root of `dist/` during the build. Publish the
36-
already-built directory without running another build:
37+
already-built directory without running another build. The same artifact works
38+
as its own Spacefast space and behind the native `/docs` mount:
3739

3840
```bash
3941
sf publish dist --prebuilt

‎blume.config.ts‎

Lines changed: 101 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,106 @@ export default defineConfig({
66
content: {
77
root: "content",
88
},
9+
navigation: {
10+
featured: [
11+
{ label: "Spacefast", href: "https://spacefast.com", icon: "house" },
12+
{
13+
label: "Guides",
14+
href: "https://spacefast.com/guides",
15+
icon: "book-open",
16+
},
17+
],
18+
repo: false,
19+
sidebar: {
20+
display: "group",
21+
items: [
22+
{
23+
label: "Start",
24+
collapsed: false,
25+
items: [
26+
"/",
27+
"/quickstart",
28+
"/agents",
29+
"/cli",
30+
"/api",
31+
"/api/reference",
32+
"/errors",
33+
],
34+
},
35+
{
36+
label: "Spaces",
37+
items: [
38+
"/publishing",
39+
"/builds",
40+
"/anonymous-publish",
41+
"/configuration",
42+
"/pages",
43+
"/access",
44+
"/collab",
45+
],
46+
},
47+
{
48+
label: "Integrations",
49+
items: [
50+
"/integrations/vite",
51+
"/integrations/nextjs",
52+
"/image-acceleration",
53+
],
54+
},
55+
{
56+
label: "Routing",
57+
items: ["/redirects", "/headers", "/proxy-routes", "/domains"],
58+
},
59+
{
60+
label: "Operate",
61+
items: [
62+
"/rollback",
63+
"/webhooks",
64+
"/limits",
65+
"/troubleshooting",
66+
],
67+
},
68+
{
69+
label: "Migrate",
70+
items: [
71+
"/migrate-from",
72+
"/migrate-from/here-now",
73+
"/migrate-from/netlify",
74+
"/migrate-from/cloudflare-pages",
75+
"/migrate-from/github-pages",
76+
"/migrate-from/vercel",
77+
],
78+
},
79+
{
80+
label: "Platforms",
81+
items: ["/platforms", "/platforms/api/reference"],
82+
},
83+
],
84+
},
85+
tabs: [
86+
{ label: "API reference", path: "/api/reference", icon: "braces" },
87+
{
88+
label: "Platform API",
89+
path: "/platforms/api/reference",
90+
icon: "building",
91+
},
92+
],
93+
},
94+
openapi: {
95+
enabled: true,
96+
sources: [
97+
{
98+
label: "REST API",
99+
route: "/api/reference",
100+
spec: "./generated/openapi/api.json",
101+
},
102+
{
103+
label: "Platform API",
104+
route: "/platforms/api/reference",
105+
spec: "./generated/openapi/platform.json",
106+
},
107+
],
108+
},
9109
search: {
10110
provider: "pagefind",
11111
},
@@ -15,7 +115,7 @@ export default defineConfig({
15115
},
16116
llmsTxt: {
17117
enabled: true,
18-
openapi: false,
118+
openapi: true,
19119
},
20120
mcp: {
21121
enabled: false,
@@ -27,10 +127,6 @@ export default defineConfig({
27127
enabled: false,
28128
},
29129
robots: true,
30-
rss: {
31-
enabled: true,
32-
types: ["changelog"],
33-
},
34130
sitemap: true,
35131
structuredData: true,
36132
},

‎content/access.md‎

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
title: Passwords & access
3+
description: Gate a Spacefast space with a shared password, identity- and location-aware access rules, or path-scoped Basic Auth — and control exactly who sees what.
4+
---
5+
6+
Spacefast gives you three ways to control who can see a space, from simplest to most precise:
7+
8+
- **Space password** — one shared secret over everything.
9+
- **Access rules** — allow, block, or require sign-in by identity, IP range, country, or path.
10+
- **`_headers` Basic Auth** — path-scoped, file-based credentials that travel with your publish.
11+
12+
You can combine them. They resolve into a single policy you can inspect at any time with `sf access effective`.
13+
14+
## Space password
15+
16+
A space password protects the whole space, including permanent Version URLs. It works on any claimed space on any plan.
17+
18+
```bash
19+
sf password set
20+
printf '%s\n' "$PASSWORD" | sf password set --stdin
21+
sf password clear
22+
```
23+
24+
`sf password set` prompts interactively, or reads from stdin with `--stdin`. The API equivalent is the `password` field on the space `PATCH` route: a string enables or replaces the password, `null` clears it.
25+
26+
Passwords are stored hashed, never in plain text. A visitor who enters the password gets a cookie for the space; changing or clearing the password invalidates every previously issued cookie, so rotating it locks everyone out immediately.
27+
28+
## Access rules
29+
30+
Access rules go beyond a single password: each rule **allows**, **denies**, or **challenges** (requires sign-in) for visitors matching some condition. Rules are evaluated top to bottom, first match wins.
31+
32+
Manage them with `sf access`:
33+
34+
| Command | What it does |
35+
| -------------------------------------------- | ---------------------------------------------------------------------------- |
36+
| `sf access effective` (alias `sf access ls`) | Show the resolved policy — every rule with its source and order. Start here. |
37+
| `sf access show` | Show just the rules you've set on this space. |
38+
| `sf access grant <audience>` | Require visitors to sign in as that audience to enter. |
39+
| `sf access ban <audience>` | Prepend a deny to the cloud lane for that audience. |
40+
| `sf access set <file.json>` | Replace all of your rules from a JSON document (full control). |
41+
| `sf access rm <index>` | Remove one rule by the `[index]` shown in `sf access show`. |
42+
| `sf access clear` | Remove all of your rules. |
43+
44+
### Lock a space to an audience
45+
46+
An **audience** is an identity glob, matched against people who sign in to Spacefast. Grant one to require sign-in:
47+
48+
```bash
49+
sf access grant 'team:team_123:member' # anyone on your team
50+
sf access grant 'email:*@acme.com' # a signed-in user whose email matches
51+
```
52+
53+
Common audience prefixes: `team:<id>:member`, `user:<id>`, `email:` (supports `*` globs against the signed-in user's verified email), and service/external tokens (`svc:`, `ext:`). Visitors are prompted to sign in and are admitted only if their identity matches. Granting by team is the most reliable way to share with named people today.
54+
55+
### Block an audience, an IP range, or a country
56+
57+
`sf access ban` blocks an identity audience by prepending a deny to the cloud lane:
58+
59+
```bash
60+
sf access ban 'email:*@spammer.example'
61+
```
62+
63+
To block by **IP range** or **country**, or to mix conditions, write the rules directly with `sf access set`. A rule is `{ match, effect, auth? }`:
64+
65+
```json
66+
{
67+
"rules": [
68+
{ "match": { "country": "RU" }, "effect": "deny" },
69+
{ "match": { "ipCidrs": ["203.0.113.0/24"] }, "effect": "deny" },
70+
{
71+
"match": { "pathPattern": "/admin/*" },
72+
"effect": "challenge",
73+
"auth": { "token": { "requiredGrants": ["team:team_123:member"] } }
74+
}
75+
]
76+
}
77+
```
78+
79+
```bash
80+
sf access set rules.json
81+
```
82+
83+
`match` conditions (all optional, AND-combined): `pathPattern` (glob), `channel`, `ipCidrs`, `country` (ISO-3166 alpha-2), `host`, `agent`, and a single `header`. `effect` is `allow`, `deny`, or `challenge`. A `challenge` rule carries `auth` — either a `token` with `requiredGrants`, or a `password`.
84+
85+
The example above keeps the site public while blocking a country and an IP range, and requiring a team login only under `/admin`.
86+
87+
### Where rules can live
88+
89+
Rules resolve from three sources, in order — **first match wins**:
90+
91+
1. **Platform** — plan-level defaults you can't override (see the note below).
92+
2. **File** — rules you commit to `access.rules` in [`sf.jsonc`](/configuration), so they version and roll back with your site.
93+
3. **Cloud** — rules you set with `sf access`, applied live without a republish.
94+
95+
There is no separate ban pre-pass. `sf access ban` assigns the new deny the first
96+
order inside the cloud lane, so it wins over later cloud allows; platform and
97+
file rules still have earlier merged order values. Put a file-lane deny before
98+
file-lane allows when that deny must travel with the version, and confirm the
99+
actual merged order with `sf access effective`.
100+
101+
File rules use the exact same rule shape as `sf access set` and compile when you publish. An invalid rule fails the publish with a `config_invalid` diagnostic — it is never silently dropped.
102+
103+
```jsonc
104+
// sf.jsonc
105+
{
106+
"access": {
107+
"rules": [
108+
{ "match": { "ipCidrs": ["203.0.113.0/24"] }, "effect": "deny" },
109+
{
110+
"match": { "pathPattern": "/admin/**" },
111+
"effect": "challenge",
112+
"auth": { "token": { "requiredGrants": ["team:team_123:member"] } },
113+
},
114+
],
115+
},
116+
}
117+
```
118+
119+
Because the rules ship with the publish, `sf rollback` restores the previous version's rules along with its files. Use the cloud lane instead when a rule must change right now, without a republish.
120+
121+
`sf access effective` prints all three merged, each tagged with its `source` and `order`, so you always know which rule decided a request.
122+
123+
:::note
124+
On the Free plan, Version URLs become login-walled 7 days after they're published; on paid plans they stay open as long as you keep them. Paid plans also unlock `_headers` Basic Auth (below).
125+
:::
126+
127+
## `_headers` Basic Auth
128+
129+
:::note
130+
Not available on Free. Available on Personal and Work.
131+
:::
132+
133+
Use a `Basic-Auth` line in [`_headers`](/headers) to protect matching paths with named credentials. Credentials are one or more space-separated `username:password` pairs.
134+
135+
```text
136+
/preview/*
137+
Basic-Auth: editor:preview-password
138+
139+
/staging/*
140+
Basic-Auth: alice:one-password bob:another-password
141+
```
142+
143+
- Username cannot contain `:` or whitespace.
144+
- Password cannot contain whitespace and must be non-empty.
145+
- `Basic-Auth` is never sent in the response, and `! Basic-Auth` is invalid because Basic Auth must be configured with credentials.
146+
147+
Because `_headers` ships with each publish, Basic Auth credentials are versioned
148+
with your files and roll back with versions. Anyone who can read the repository
149+
or a retained version may recover historical credentials. Use unique,
150+
non-reused passwords and rotate them after exposure or access changes.
151+
Anonymous spaces cannot use it.
152+
153+
## Which one to use
154+
155+
- **Space password** for one shared secret over everything — client previews, unfinished launches, internal docs. Works on every plan, managed from the CLI or API without touching your files.
156+
- **Access rules** when _who_ or _where_ matters — restrict to a company's email domain or a team, block an abusive IP or country, or require sign-in on just `/admin`. Cloud rules apply live; file rules version with your site.
157+
- **Basic Auth** for specific paths with multiple named users where you want the credentials to live in your repo and roll back with each publish.
158+
159+
## What visitors see
160+
161+
A password-protected space shows the platform password page, themed to your space; entry is remembered until the password changes. A `challenge` access rule prompts the visitor to sign in and admits them only if their identity matches. A `deny` rule serves the platform access-denied page with a `403` (the `X-Spacefast-Reason` header names the rule's `reasonCode` when set). Basic Auth paths return a `401` challenge with nothing else.

0 commit comments

Comments
 (0)