diff --git a/.agents/skills/spacefast-product-naming/SKILL.md b/.agents/skills/spacefast-product-naming/SKILL.md new file mode 100644 index 00000000..32fc4143 --- /dev/null +++ b/.agents/skills/spacefast-product-naming/SKILL.md @@ -0,0 +1,62 @@ +--- +name: spacefast-product-naming +description: Enforce consistent Spacefast product names, exact capitalization, vocabulary boundaries, and single-source Glossary definitions whenever authoring or editing Spacefast documentation. +--- + +# Spacefast Product Naming and Consistency + +Use this skill whenever writing, reviewing, or updating Spacefast docs, pricing tables, migration guides, or agent prompts. + +## Single-source rule (do not duplicate) + +- **Canonical public definitions live in `content/(reference)/glossary.mdx` only.** +- Never copy full product definitions onto multiple pages. Introduce a feature in one crisp clause if needed, then link directly to its primary page or `/glossary#`. +- When a new product or feature ships, add it to `content/(reference)/glossary.mdx` and `scripts/pricing-next.mjs` (with a one-line `tip` and `href`), and verify `bun run verify:prose`. + +## Canonical product names + +| Product / feature | Exact spelling in prose | Never write | +| --- | --- | --- | +| Platform | **Spacefast** | SpaceFast, spacefast (in prose), "hosting platform" | +| Resource unit | **Space** / **Spaces** | site (except external WordPress/source sites), project (for the deployed Spacefast resource) | +| App framework | **SpacePress** | Spacepress, space press, TypedPress (legacy only) | +| Modern editor | **SpacePress Admin** | TypedPress Admin, Spacepress admin | +| CLI | **Spacefast CLI** or `` `sf` `` | SF CLI | +| Remote builds | **Spacefast Builds** | E2B, Pierre, build host | +| Managed DNS | **Spacefast DNS** | DNS hosting | +| Sharing & access | **Spacefast Share** | ShareFast | +| Browser analytics | **Spacefast Stats** (Private Beta) | Spacefast Analytics (distinguish from **edge traffic stats**) | +| Tag governance | **Spacefast Tag Manager** (short: **Tag Manager**) | GTM replacement | +| Multi-tenant | **Spacefast for Platforms** / **Partner API** | White-label API | +| Auth flow | **Sign in with Spacefast** | Login with Spacefast, Spacefast Login | +| Drag-and-drop | **Drop** (`drop.fast`) | Drop.fast (capitalized in URL) | +| Serverless runtime | **Functions** (runtime) / **Worker** (compiled handler) | Edge Functions (as the product name), Lambda | +| External tools | **Connectors** | Integrations hub | +| Edge rules | **Traffic Rules** | WAF rules (as the product name) | +| HTML overlays | **Page Enhancements** | Superpowers (code key `superpowers` stays backticked only) | +| Per-Space add-on | **Per-Space Boost** (short: **Boost**) | Space Boost | +| Early access | **Labs** | Beta Program | +| Team context | **Team Memories**, **Team Skills**, **Design System** | Agent Memories, Shared Skills | +| Agent protocol | **Poppy** (`Poppy 1.0`) | POPPY | +| Credentials | **API key** (`sfa_`), **deploy token** (`sfm_`), **Space key** (`sfc_`) | access token (except literal "OAuth access token") | +| Legacy runtime | **Zero** / **capsule** | Zero v2 as a recommended path | + +## Vocabulary boundaries (enforced by Vale & public-safety) + +1. **Never use "hosting" in prose.** Say publish, serve, live, infrastructure, runtime, or Spacefast DNS (`styles/Spacefast/Hosting.yml`). +2. **Say "publish" and "version", not "deploy" and "deployment"** in fresh prose, except when naming GitHub's Deployments API or compatibility API fields. +3. **Prefer "infra" over "WP Cloud".** Only name **WP Cloud** (exact spelling, never `WP.Cloud` or `wp-cloud`) when an external reference is genuinely necessary. +4. **Never leak internal infra or vendor names** (`NGINX`, `Web server`, `Batcache`, `PlanetScale`, `pgbouncer`, `Caddy`, `E2B`, `Pierre`, `code.storage`, `monorepo`, local filesystem paths). +5. **SpacePress is a managed application server.** No custom origin code runs outside SpacePress (never imply users can run arbitrary PHP, install third-party WordPress plugins, upload theme ZIPs, edit `.htaccess`/`.user.ini`, or SSH into a Space). +6. **Backtick all identifiers.** Commands (`sf publish`), file paths (`spacefast.config.ts`), HTTP headers (`Cache-Control`), enum values, and config keys go in code spans. +7. **Use direct technical headings.** Name the concrete concept or task (`Expiry and recovery window`, `Indexing delay and empty pages`, `Authorization header`) — never clever or vague headings (`The clock`, `The gotcha`, `Two things that surprise people`, `The shape`, `Claim it`). + +## Pre-handoff check + +Run before committing any copy change: + +```bash +bun run validate +bun run verify:public-safety +bun run verify:prose +``` diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 2d9f9642..50f024b4 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -111,6 +111,18 @@ safe. The credential-prefix table can stay below; the rotation condition cannot. "after this page" framing. The intermediate step, where the sentence was merely shorter but still templated, is history now; don't resurrect it.) +## Use direct technical headings + +Name the concrete technical concept, resource, or task in every `##` and `###` heading so readers and agents can scan the table of contents and link to stable anchors. Never use cute, cryptic, or essay-style headings. + +| Avoid | Use instead | +| --- | --- | +| `The clock` | `Expiry and recovery window` | +| `The gotcha` | `Routing validation (failOnRoutingError)` / `Static vs. SPA mode` | +| `Two things that surprise people` | `Indexing delay and empty pages` | +| `The shape` / `The loop` / `The header` | `Problem Details format` / `Paginate through all results` / `Authorization header` | +| `Claim it` / `Checking on it` / `Set it up` | `Claim an anonymous Space` / `Check Space and claim status` / `Create a CI credential` | + ## Don't template the opening sentence The example above still has a problem, caught in a later pass: "After this @@ -204,6 +216,7 @@ that is. ## Brand and vocabulary +- **Canonical product names live in the Glossary.** Every Spacefast product and feature name, its exact capitalization, and its one-line definition lives in [content/(reference)/glossary.mdx](content/(reference)/glossary.mdx). Define terms once there and link to `/glossary` instead of duplicating product definitions across guides. For agent-oriented naming checklists, see [.agents/skills/spacefast-product-naming/SKILL.md](.agents/skills/spacefast-product-naming/SKILL.md). - **GitHub, JavaScript, TypeScript, npm, Node.js, macOS, OpenAPI, email, website** — exact casing, every time (`Branding.yml`). - **Spacefast** is capitalized in prose. Identifiers stay lowercase and get diff --git a/blume.config.ts b/blume.config.ts index e7eb7e4c..730d21f5 100644 --- a/blume.config.ts +++ b/blume.config.ts @@ -8,7 +8,10 @@ import { pagefind } from "blume/search"; import { loadPricing, pricingVariables } from "./scripts/pricing.mjs"; import { redirects } from "./redirects.ts"; +import { interfaceExamplesMarkdown } from "./scripts/interface-examples.mjs"; import { planVariables, pricingTableMarkdown } from "./scripts/pricing-next.mjs"; +import { requestLifecycleMarkdown } from "./scripts/request-lifecycle.mjs"; +import { statusBadgeMarkdown } from "./scripts/status-badge.mjs"; const deploymentBase = "/docs"; // Agent guidance for llms.txt, kept as Markdown so Vale lints it with the pages. @@ -174,14 +177,17 @@ export default defineConfig({ }, agents: { llmsTxt: { details: llmsDetails }, - // The upstream reference footer, written out as Markdown for .md pages, llms-full.txt - // and MCP: without this the component ships as raw JSX. + // Custom MDX components written out as Markdown for .md pages, llms-full.txt + // and MCP: without this the components ship as raw JSX. markdownComponents: { + InterfaceExamples: ({ props }) => + interfaceExamplesMarkdown(String(props.id), deploymentBase), PricingTable: ({ props }) => pricingTableMarkdown(String(props.table), props.row ? String(props.row) : undefined), + RequestLifecycle: () => requestLifecycleMarkdown(), SpacefastStage: () => `\`\`\`ts\nimport { defineConfig } from "spacefast/config";\n\nexport default defineConfig({\n name: "quiet-harbor",\n app: {\n collections: { posts: { title: "Posts" } },\n actions: { subscribe: { access: "anyone" } },\n },\n crons: [{ path: "/api/digest", schedule: "daily" }],\n});\n\`\`\``, - WpCloudDocs: ({ props }) => - `Using the [Partner API](${deploymentBase}/platforms/partner-api)? See [${String(props.title)}](${String(props.href)}) in the upstream infrastructure reference.`, + StatusBadge: ({ props }) => + statusBadgeMarkdown(String(props.status), props.note ? String(props.note) : undefined), }, // The Website publishes Spacefast's agent skill at the site root; a second, // generated Docs skill would compete with it. diff --git a/bun.lock b/bun.lock index f21c9a21..1f711347 100644 --- a/bun.lock +++ b/bun.lock @@ -6,6 +6,7 @@ "name": "docs", "dependencies": { "blume": "2.2.6", + "motion": "14.14.0", "zod": "4.6.5", }, "devDependencies": { @@ -963,6 +964,8 @@ "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="], + "framer-motion": ["framer-motion@14.14.0", "", { "dependencies": { "motion-dom": "14.14.0", "motion-utils": "14.7.0", "tslib": "^2.4.0" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "remix": "^3.1.0" }, "optionalPeers": ["react", "react-dom", "remix"] }, "sha512-fidRX0VzkZdA9OovFiBSzJtt9/jLcJpna78Z+KCqQQZIWoIpN3tOhEXAhhAw/FObUUh+o3Y18yx1F4BP0mVJ8Q=="], + "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], @@ -1243,6 +1246,12 @@ "minizlib": ["minizlib@3.1.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw=="], + "motion": ["motion@14.14.0", "", { "dependencies": { "framer-motion": "14.14.0", "tslib": "^2.4.0" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "remix": "^3.1.0" }, "optionalPeers": ["react", "react-dom", "remix"] }, "sha512-a306U6sV5VKq1abtzKiinB+UQjiY88jrsvQzWORP3WPv/DFANyoYVlPbdnmJPMEbusyPXB4GyQJVANaq/pSIYQ=="], + + "motion-dom": ["motion-dom@14.14.0", "", { "dependencies": { "motion-utils": "14.7.0" } }, "sha512-IAxcKhYkuQA2W0Tlx1AvVgImfqEoF3/t3IovbPQJlYkefmGsmrXjn967lMII5VmFmLpQEab4+ZkHo/ijJ4Esig=="], + + "motion-utils": ["motion-utils@14.7.0", "", {}, "sha512-woO0/Nb7ys75f94fjvQi/6leiHGvZUYkeHUPEZ3vxsV+9OpEVhkxp01x8MlRwX0zt31EqgXsKDAoBoJLC148Tw=="], + "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], diff --git a/components.ts b/components.ts index fa55700d..c955cf58 100644 --- a/components.ts +++ b/components.ts @@ -2,14 +2,15 @@ import { defineComponents } from "blume"; import Breadcrumbs from "./components/Breadcrumbs.astro"; import Header from "./components/Header.astro"; +import InterfaceExamples from "./components/InterfaceExamples.astro"; import Logo from "./components/Logo.astro"; import Pagination from "./components/Pagination.astro"; import Sidebar from "./components/Sidebar.astro"; import PricingTable from "./components/PricingTable.astro"; import SpacefastStage from "./components/SpacefastStage.astro"; -import WpCloudDocs from "./components/WpCloudDocs.astro"; +import StatusBadge from "./components/StatusBadge.astro"; export default defineComponents({ layout: { Breadcrumbs, Header, Logo, Pagination, Sidebar }, - mdx: { PricingTable, SpacefastStage, WpCloudDocs }, + mdx: { InterfaceExamples, PricingTable, SpacefastStage, StatusBadge }, }); diff --git a/components/InterfaceExamples.astro b/components/InterfaceExamples.astro new file mode 100644 index 00000000..a7529457 --- /dev/null +++ b/components/InterfaceExamples.astro @@ -0,0 +1,158 @@ +--- +/* + * Centralized CLI / API / MCP / JS SDK switcher backed by + * scripts/interface-examples.mjs. Every reference link is resolved directly + * from generated/openapi/api.json and generated/cli/index.md so links stay + * pinned to shipped contracts. Uses Blume's synced so picking an + * interface switches every example across the page. + */ +import CodeBlock from "blume/components/content/CodeBlock.astro"; +import Tab from "blume/components/content/Tab.astro"; +import Tabs from "blume/components/content/Tabs.astro"; +import { contentHref } from "blume/components/content/base-href.ts"; + +import { resolveInterfaceExample } from "../scripts/interface-examples.mjs"; + +interface Props { + id: string; +} + +const { id } = Astro.props; +const example = resolveInterfaceExample(id); +--- + +
+ + {example.surfaces.map((surface) => ( + + + + + ))} + +
+ + diff --git a/components/PricingTable.astro b/components/PricingTable.astro index ed11c48c..f481117e 100644 --- a/components/PricingTable.astro +++ b/components/PricingTable.astro @@ -47,9 +47,16 @@ const span = columns.length + 1; {row.href ? {row.label} : {row.label}} {row.tag && {{ beta: "Beta", soon: "Soon", comp: "Complimentary" }[row.tag]}} {row.tip && ( - - - + + + {row.tip} )} @@ -117,7 +124,7 @@ const span = columns.length + 1; background: var(--blume-background); box-shadow: 1px 0 0 var(--blume-border); } - tbody th[scope="row"]:has(.sf-tip:hover, .sf-tip:focus) { + tbody th[scope="row"]:has(.sf-tip-wrap:hover, .sf-tip-wrap:focus-within, .sf-tip[aria-expanded="true"]) { z-index: 4; } thead th:first-child { @@ -203,30 +210,41 @@ const span = columns.length + 1; :global(:root[data-theme="dark"]) .sf-tag-comp { color: #4ade80; } - .sf-tip { + .sf-tip-wrap { position: relative; + display: inline-block; + margin-left: 0.35rem; + vertical-align: 1px; + } + .sf-tip { display: inline-grid; place-items: center; - width: 1rem; - height: 1rem; - margin-left: 0.35rem; + width: 1.125rem; + height: 1.125rem; + padding: 0; border: 1px solid var(--blume-border); border-radius: 999px; + background: transparent; color: var(--blume-muted-foreground); font-size: 0.625rem; line-height: 1; - cursor: help; - vertical-align: 1px; + cursor: pointer; + touch-action: manipulation; } .sf-tip-mark { font: italic 600 0.625rem/1 Georgia, serif; } .sf-tip:hover, - .sf-tip:focus-visible { + .sf-tip:focus-visible, + .sf-tip[aria-expanded="true"] { color: var(--blume-foreground); border-color: var(--blume-foreground); outline: none; } + .sf-tip:focus-visible { + outline: 2px solid var(--blume-foreground); + outline-offset: 2px; + } .sf-tip-body { display: none; position: absolute; @@ -234,7 +252,7 @@ const span = columns.length + 1; top: calc(100% + 0.4rem); z-index: 20; width: max-content; - max-width: min(18rem, 70vw); + max-width: min(19rem, 72vw); padding: 0.5rem 0.65rem; border: 1px solid var(--blume-border); border-radius: 0.375rem; @@ -249,8 +267,9 @@ const span = columns.length + 1; letter-spacing: 0; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); } - .sf-tip:hover .sf-tip-body, - .sf-tip:focus .sf-tip-body { + .sf-tip-wrap:hover .sf-tip-body, + .sf-tip-wrap:focus-within .sf-tip-body, + .sf-tip[aria-expanded="true"] + .sf-tip-body { display: block; } /* The table scrolls sideways, which also clips vertically, so the last rows open their tip upward. */ @@ -266,3 +285,27 @@ const span = columns.length + 1; clip: rect(0 0 0 0); } + + diff --git a/components/StatusBadge.astro b/components/StatusBadge.astro new file mode 100644 index 00000000..dde821db --- /dev/null +++ b/components/StatusBadge.astro @@ -0,0 +1,163 @@ +--- +import { resolveStatusBadge } from "../scripts/status-badge.mjs"; + +interface Props { + status: "labs" | "beta" | "private-beta" | "public-beta" | "go-plus" | "pro-plus" | "enterprise"; + note?: string; +} + +const { status, note } = Astro.props; +const badge = resolveStatusBadge(status, note); +--- + + + + {badge.note} + + + + + diff --git a/components/WpCloudDocs.astro b/components/WpCloudDocs.astro deleted file mode 100644 index 0e50858a..00000000 --- a/components/WpCloudDocs.astro +++ /dev/null @@ -1,16 +0,0 @@ ---- -import { contentHref } from "blume/components/content/base-href.ts"; - -interface Props { - title: string; - href: string; -} - -const { title, href } = Astro.props; ---- - - diff --git a/content/(account)/(labs)/design-system.mdx b/content/(account)/(labs)/design-system.mdx index 56b60c03..82ec7895 100644 --- a/content/(account)/(labs)/design-system.mdx +++ b/content/(account)/(labs)/design-system.mdx @@ -1,11 +1,9 @@ --- title: Design System description: Save a team's design rules once, then reuse and check them across projects -sidebar: - badge: Labs --- -Labs + Save your team's colors, type, layout, voice, and brand files in one Design System. A connected agent can reuse those standards in a new project, check a build against them, or bring a named Space up to date. You choose which Spaces change. Saving the system alone does not edit or publish a Space. @@ -62,3 +60,7 @@ All paths below start with `/v1/teams/{teamId}`. Use the current [OpenAPI specif An upload alone does not add an asset record or change the design revision. Reference the returned attachment ID in a changes request. Both the API and dashboard accept files up to 100 MB. Use the numeric revision from `GET /design-system` for writes, not the context fingerprint from `GET /agent-context`. A stale write revision returns `409`. Reuse the same `operationId` and identical input after an uncertain response. Saving standards does not change Space files. + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/(labs)/labs.mdx b/content/(account)/(labs)/labs.mdx index 3bec648d..40cc156f 100644 --- a/content/(account)/(labs)/labs.mdx +++ b/content/(account)/(labs)/labs.mdx @@ -3,13 +3,13 @@ title: Labs description: Join early features for your team in Settings, check status, or turn them off --- -Labs + Labs lets team owners and admins opt a team into early features before they open to everyone. Joining a feature turns it on for every member and connected agent on that team. ## Available Labs features -Three team-context features are available through Labs. They share one private storage home on your team, which you initialize the first time you open any of them: +Three team-context features share one private storage home on your team, which you initialize the first time you open any of them: @@ -23,11 +23,18 @@ Three team-context features are available through Labs. They share one private s -| Feature | How to join | -| --- | --- | -| [Team Memories](/team-memories) | Join the waitlist | -| [Team Skills](/team-skills) | Apply with a short note | -| [Design System](/design-system) | Join the waitlist | +Every feature currently available through [**Team settings → Labs**](https://my.spacefast.com/?to=/:team/settings/labs): + +| Feature | Stage | How to join | Notes | +| --- | --- | --- | --- | +| [Team Memories](/team-memories) | Private Beta | Join the waitlist | Shared team facts read automatically by connected agents | +| [Team Skills](/team-skills) | Private Beta | Apply with a short note | Reusable team practices for connected agents | +| [Design System](/design-system) | Private Beta | Join the waitlist | Brand colors, typography, voice, and assets | +| [Spacefast Stats](/stats) | Private Beta | Join the waitlist | Live visitor insights (**Now** and **Trends**) and the on-Space Stats drawer | +| [SpacePress](/build) | Private Beta | Join the waitlist | Managed full-stack TypeScript app runtime | +| Commerce | Private Beta | Join the waitlist | Sell digital downloads and physical products through Stripe Connect (no standalone docs yet) | +| Desktop Apps | Private Beta | Join the waitlist | Package Spaces as macOS, Windows, and Linux apps (requires SpacePress; no standalone docs yet) | +| Mobile Apps | Private Beta | Join the waitlist | Package Spaces for iPhone and Android via Expo Go (requires SpacePress; no standalone docs yet) | ## How joining works @@ -62,13 +69,7 @@ All paths below start with `/v1/teams/{teamId}`. See the [API reference](/api/re | `POST /labs/{featureKey}` | [`enrollTeamLabs`](/api/reference/teams/enrollteamlabs) | Join a feature or submit a request; send `{"note":"..."}` for features that require a note | | `DELETE /labs/{featureKey}` | [`leaveTeamLabs`](/api/reference/teams/leaveteamlabs) | Leave an active feature or withdraw a pending request | -Use these keys in the API: - -| Feature | API key | -| --- | --- | -| Team Memories | `agents.memories` | -| Team Skills | `agents.skills` | -| Design System | `agents.design_system` | +Use the API keys listed in the [Available Labs features](#available-labs-features) table above as `{featureKey}`. ## Shared team context setup diff --git a/content/(account)/(labs)/team-memories.mdx b/content/(account)/(labs)/team-memories.mdx index a4df35a6..72575e9f 100644 --- a/content/(account)/(labs)/team-memories.mdx +++ b/content/(account)/(labs)/team-memories.mdx @@ -1,11 +1,9 @@ --- title: Team Memories description: Save lasting team and Space facts that connected agents read before they work -sidebar: - badge: Labs --- -Labs + Team Memories stores durable facts, decisions, conventions, and preferences so every connected agent on your team reads them before creating or editing a Space. Memories is a [Labs](/labs) feature you join from team settings. @@ -62,3 +60,7 @@ All paths below start with `/v1/teams/{teamId}`. See the [OpenAPI specification] | `DELETE /memories/{memoryId}` | [`deleteTeamMemory`](/api/reference/teams/deleteteammemory) | Permanently delete a memory (owners and admins with `teams:write`; refused for agent grants) | Memory reads require `spaces:read`. Creating, updating, and archiving memories require `spaces:write`. Agents archive stale memories (`archived: true`) instead of deleting them; permanent deletion requires `teams:write` and returns `authorization_level_not_allowed` for agent grants. + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/(labs)/team-skills.mdx b/content/(account)/(labs)/team-skills.mdx index 16adc1be..9f2a5e66 100644 --- a/content/(account)/(labs)/team-skills.mdx +++ b/content/(account)/(labs)/team-skills.mdx @@ -1,11 +1,9 @@ --- title: Team Skills description: Turn on preset practices like SEO, accessibility, and spam protection for every agent on your team -sidebar: - badge: Labs --- -Labs + Team Skills are preset, read-only practice briefs that team owners and admins turn on so every connected agent follows the same engineering and publishing standards. Team Skills is a [Labs](/labs) feature and is distinct from the Spacefast CLI and plugin skills documented in [Agent skills](/agents/skills). @@ -60,3 +58,7 @@ All paths below start with `/v1/teams/{teamId}`. See the [OpenAPI specification] | `PATCH /skills/{skillKey}` | [`updateTeamSkill`](/api/reference/teams/updateteamskill) | Send `{"enabled": true}` or `{"enabled": false}` to toggle a skill for the whole team | Reading skills requires `spaces:read`. Toggling a skill changes standing instructions for every agent on the team, so `PATCH /skills/{skillKey}` requires `teams:write` (team owners and admins) and returns `authorization_level_not_allowed` for agent grants. + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/api-keys.mdx b/content/(account)/api-keys.mdx index 3a47196e..126a735a 100644 --- a/content/(account)/api-keys.mdx +++ b/content/(account)/api-keys.mdx @@ -122,6 +122,14 @@ sf deploy-tokens create --name docs-feed --view-only --path '/docs/**' --show-se Pass the returned `sfm_` token in `SPACEFAST_TOKEN` or `Authorization: Bearer sfm_...`. Manage tokens without recreating them using [`sf deploy-tokens list`](/cli/reference/deploy-tokens#sf-deploy-tokens-list), [`sf deploy-tokens update`](/cli/reference/deploy-tokens#sf-deploy-tokens-update-id), [`sf deploy-tokens rotate`](/cli/reference/deploy-tokens#sf-deploy-tokens-rotate-id), and [`sf deploy-tokens revoke`](/cli/reference/deploy-tokens#sf-deploy-tokens-revoke-id). See [Publish from CI](/ci) for GitHub Actions and GitLab CI examples. +## Machine OAuth clients (`client_credentials`) + +For server-to-server automation that authenticates with OAuth 2.0 `client_credentials` instead of static `sfa_` API keys, register a team OAuth client with `profile: "machine"` via [`createTeamOAuthClient`](/api/reference/teams/createteamoauthclient) (`POST /v1/teams/{teamId}/oauth-clients`). + +- List clients with [`listTeamOAuthClients`](/api/reference/teams/listteamoauthclients) (`?profile=machine` or `connect_app`), inspect with [`getTeamOAuthClient`](/api/reference/teams/getteamoauthclient), update with [`updateTeamOAuthClient`](/api/reference/teams/updateteamoauthclient), rotate secrets with [`rotateTeamOAuthClientSecret`](/api/reference/teams/rotateteamoauthclientsecret), and delete with [`deleteTeamOAuthClient`](/api/reference/teams/deleteteamoauthclient). +- Exchange the client ID and secret at `POST https://api.spacefast.com/v1/auth/oauth2/token` (`grant_type=client_credentials`) for a short-lived OAuth access token. +- Machine OAuth clients cannot hold Enterprise `activity:read` or perform person-only actions (billing, member removals, or approval decisions). For Sign in with Spacefast user apps (`connect_app`), see [Sign in with Spacefast](/share#offer-sign-in-with-spacefast-in-your-app). + ## Every credential, by prefix Spacefast puts a prefix on each credential so you always know what you are holding. @@ -150,3 +158,7 @@ Share links, passwords, and machine credentials are the Space access model. They :::warning[Treat every one of these as a password] They go in a secret manager or an environment variable, never in a repository, a screenshot, or a chat message. A key pasted anywhere public should be revoked, not rotated later. ::: + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/approvals.mdx b/content/(account)/approvals.mdx new file mode 100644 index 00000000..7f7e32ef --- /dev/null +++ b/content/(account)/approvals.mdx @@ -0,0 +1,52 @@ +--- +title: Approvals and Emergency Pause +description: Govern personal agent approvals, Team Reviews, standing rules, Space Work Mode, and Emergency Pause across teams and Spaces +--- + +Spacefast routes personal agent prompts, **Team Reviews** (grant approvals, tag revisions, connector serving requests, and parked connector calls), approval policies, and **Emergency Pause** through **Approvals** (`/approvals`). + +For what an agent can never do without a person, handoff links, and how device login consents work, see [What agents are allowed to do](/agents/permissions). + +## Approval inbox and Team Reviews + +When an agent requests a risky mutation, or when a team action requires review, it stops and creates an approval item on `/approvals` and in the dashboard notification bell: + +- **Personal approvals:** Standing-access requests or one-time suspended calls for risky actions such as publishing over a live Space, rolling back, buying a domain, or changing DNS. +- **Team Reviews:** Team owners and admins review team-scoped actions in the same inbox, including Space access grant approvals, [Tag Manager](/tag-manager) revision approvals, connector serving requests, and parked [Connectors](/connectors) runs. + +Only a signed-in person can approve or deny a request. Agents can read status with [`getApproval`](/api/reference/agent/getapproval), while humans decide requests via [`decideApproval`](/api/reference/agent/decideapproval) (`PATCH /v1/approvals/{approvalId}`), [`approveApproval`](/api/reference/agent/approveapproval), or [`denyApproval`](/api/reference/agent/denyapproval). Decisions stay valid for about 10 minutes, and denying is final. + +## Approval policies, rules, and simulation + +Policies layer from organization and team down to individual Spaces and agent grants. Inspect your effective policy or dry-run an action before running it: + +| Scope | Operations | Routes | +| --- | --- | --- | +| Effective policy & dry run | [`getApprovalPolicy`](/api/reference/agent/getapprovalpolicy), [`simulateApprovalPolicy`](/api/reference/agent/simulateapprovalpolicy) | `GET /v1/approvals/policy`, `POST /v1/approvals/policy/simulate` | +| Personal standing rules | [`listApprovalRules`](/api/reference/agent/listapprovalrules), [`createApprovalRule`](/api/reference/agent/createapprovalrule), [`revokeApprovalRule`](/api/reference/agent/revokeapprovalrule) | `GET / POST /v1/approvals/rules`, `DELETE /v1/approvals/rules/{ruleId}` | +| Per-agent grant override | [`getGrantApprovalPolicy`](/api/reference/account/getgrantapprovalpolicy), [`setGrantApprovalPolicy`](/api/reference/account/setgrantapprovalpolicy) | `GET / PUT /v1/me/grants/{grantId}/approvals/policy` | +| Per-Space policy & rules | [`getSpaceApprovalPolicy`](/api/reference/spaces/getspaceapprovalpolicy), [`setSpaceApprovalPolicy`](/api/reference/spaces/setspaceapprovalpolicy), [`listSpaceApprovalRules`](/api/reference/spaces/listspaceapprovalrules), [`createSpaceApprovalRule`](/api/reference/spaces/createspaceapprovalrule), [`deleteSpaceApprovalRule`](/api/reference/spaces/deletespaceapprovalrule) | `GET / PUT /v1/spaces/{spaceId}/approvals/policy`, `/v1/spaces/{spaceId}/approvals/rules` | +| Per-team policy & rules | [`getTeamApprovalPolicy`](/api/reference/teams/getteamapprovalpolicy), [`setTeamApprovalPolicy`](/api/reference/teams/setteamapprovalpolicy), [`listTeamApprovalRules`](/api/reference/teams/listteamapprovalrules), [`createTeamApprovalRule`](/api/reference/teams/createteamapprovalrule), [`deleteTeamApprovalRule`](/api/reference/teams/deleteteamapprovalrule) | `GET / PUT /v1/teams/{teamId}/approvals/policy`, `/v1/teams/{teamId}/approvals/rules` | +| Enterprise effective policy | [`getEnterpriseEffectivePolicy`](/api/reference/teams/getenterpriseeffectivepolicy) | `GET /v1/teams/{teamId}/approvals/enterprise-policy` | + +When an action is blocked by a rule or pause, Spacefast returns [`approval_policy_blocked`](/errors/approval_policy_blocked). Call `POST /v1/approvals/policy/simulate` to inspect which policy or pause matched. + +## Emergency Pause + +Emergency Pause halts agent mutations (such as Space writes and join-link creation) at the Space or team level without revoking credentials, interrupting human dashboard edits, or blocking read-only calls: + +- **Space Emergency Pause:** [`setSpaceEmergencyPause`](/api/reference/spaces/setspaceemergencypause) (`PATCH /v1/spaces/{spaceId}/approvals/policy`). +- **Team Emergency Pause:** [`setTeamEmergencyPause`](/api/reference/teams/setteamemergencypause) (`PATCH /v1/teams/{teamId}/approvals/policy`). + +Saving other approval categories preserves an active Emergency Pause so routine policy edits cannot accidentally lift the pause on a Space or team. + +For a full account-wide stop that revokes every credential acting as you (and cancels unredeemed handoff links) while leaving team-owned automation intact, use **Account settings → Connected apps → Stop All Agent Access**. + +## Work Mode and session approval rules + +- **Space Work Mode:** Read or update your code-review work mode for a Space with [`getSpaceWorkMode`](/api/reference/spaces/getspaceworkmode) and [`setSpaceWorkMode`](/api/reference/spaces/setspaceworkmode) (`GET / PUT /v1/spaces/{spaceId}/work-mode`). Writes accept an optional `If-Match` header with `ETag` concurrency checks and return HTTP `412` ([`approval_policy_changed`](/errors/approval_policy_changed)) if settings changed after you read them. +- **Session approval rules:** Hosted MCP can remember approved safe calls for the current session so you do not re-approve identical actions. Sibling sessions sharing one OAuth grant keep separate rules, and ineligible actions fall back to a one-time approval. + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/authentication.mdx b/content/(account)/authentication.mdx index 6048403c..8e0a2a10 100644 --- a/content/(account)/authentication.mdx +++ b/content/(account)/authentication.mdx @@ -65,7 +65,7 @@ After that, signing in asks for a **Code** on a second screen. One field accepts There is no side door. Turn two-factor off, then set it up again for a fresh set. Turning it off needs a confirmation check first. ::: -## Confirm it's you +## Re-authentication for sensitive actions Sensitive changes ask you to prove it's you again before they go through: setting or changing a password, connecting or disconnecting a provider, turning two-factor on or off, and adding, removing, or repointing account email addresses. @@ -151,6 +151,9 @@ Your primary address gets account mail, drives the Gravatar avatar, and is the a | List sign-in methods | [`GET /v1/auth/methods`](/api/reference/account/listauthmethods) | | Set or change password | [`POST /v1/auth/password`](/api/reference/account/setaccountpassword) | | List account emails | [`GET /v1/auth/emails`](/api/reference/account/listaccountemails) | +| Add, verify, remove, or set primary email | [`POST /v1/auth/emails`](/api/reference/account/addaccountemail), [`/verify`](/api/reference/account/verifyaccountemail), [`/{emailId}/primary`](/api/reference/account/setprimaryaccountemail), [`DELETE /{emailId}`](/api/reference/account/deleteaccountemail) | +| Read or update email notification preferences | [`GET /v1/me/email-preferences`](/api/reference/account/getemailpreferences), [`PUT /v1/me/email-preferences`](/api/reference/account/updateemailpreferences) | +| Update privacy settings | [`PATCH /v1/me/privacy`](/api/reference/account/updateprivacysettings) | | Start device login | [`POST /v1/auth/device`](/api/reference/account/startdeviceauthorization) | | Poll device login | [`POST /v1/auth/device/poll`](/api/reference/account/polldeviceauthorization) | | List active credentials | [`GET /v1/me/credentials`](/api/reference/account/listcredentials) | diff --git a/content/(account)/auto-enroll.mdx b/content/(account)/auto-enroll.mdx index e0e7bfb1..95fb02ee 100644 --- a/content/(account)/auto-enroll.mdx +++ b/content/(account)/auto-enroll.mdx @@ -74,3 +74,7 @@ A member you remove cannot rejoin through the domain. To bring them back, send a | `not_found` | 404 | The entry does not exist or belongs to another team | | `forbidden` | 403 | Your role cannot manage members, or the credential has no person behind it | | `team_member_quota_exceeded` | 409 | A person pressed **Join** while the team was at its member limit | + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/billing.mdx b/content/(account)/billing.mdx index d7c93a9b..437997b4 100644 --- a/content/(account)/billing.mdx +++ b/content/(account)/billing.mdx @@ -15,7 +15,13 @@ Upgrades apply immediately and are prorated. Downgrades apply at renewal. Cancel [`GET /v1/teams/{teamId}/entitlements`](/api/reference/teams/getteamentitlements) and [`GET /v1/teams/{teamId}/plan-policy`](/api/reference/teams/getteamplanpolicy) return the resolved `planCode` and active limits. Public plan codes are stable: `free` (Personal), `go` (Go), `plus` (Pro), and `enterprise` (Enterprise). -Use the returned entitlements for feature checks. Read subscription and payment status with [`GET /v1/teams/{teamId}/billing`](/api/reference/teams/getteambilling). +Use the returned entitlements for feature checks. Read subscription and payment status with [`GET /v1/teams/{teamId}/billing`](/api/reference/teams/getteambilling), or inspect the team's saved payment card from the terminal with [`sf billing card`](/cli/reference/billing#sf-billing-card). + +## Credits, plan codes, and held purchases + +- **Team credits:** List credits granted to a team with [`listTeamCredits`](/api/reference/teams/listteamcredits) (`GET /v1/teams/{teamId}/billing/credits`) and redeem one for a plan duration or billing-period usage credit with [`redeemTeamCredit`](/api/reference/teams/redeemteamcredit) (`POST /v1/teams/{teamId}/billing/credits/{creditId}/redeem`). +- **Plan codes:** Inspect a redeem code (granted plan, seat count, duration, and eligibility) with [`getPlanCode`](/api/reference/teams/getplancode) (`GET /v1/plan-codes/{code}`), and apply it to a team with [`redeemPlanCode`](/api/reference/teams/redeemplancode) (`POST /v1/plan-codes/{code}/redeem`). Each person redeems a code once, and each team receives it once. +- **Held purchases:** Inspect, confirm, or cancel a held team purchase (such as a domain checkout awaiting confirmation) with [`sf purchases inspect`](/cli/reference/purchases#sf-purchases-inspect-id), [`sf purchases confirm`](/cli/reference/purchases#sf-purchases-confirm-id), and [`sf purchases cancel`](/cli/reference/purchases#sf-purchases-cancel-id) (or `/v1/teams/{teamId}/purchases/{purchaseId}`). ## When a payment fails @@ -28,6 +34,11 @@ Your Spaces keep serving through a grace period, but you cannot change anything. Settle the payment in the billing portal to restore access. API reads remain available in either state. + +## CLI, API, MCP, and SDK + + + ## Billing is dashboard-only Plans, checkout, and cancellation live in the dashboard. There is no `sf` command and no API endpoint for changing a plan. API keys and agent credentials cannot make those changes. diff --git a/content/(account)/identity-connections.mdx b/content/(account)/identity-connections.mdx index 3157f78e..655df882 100644 --- a/content/(account)/identity-connections.mdx +++ b/content/(account)/identity-connections.mdx @@ -182,3 +182,7 @@ OIDC sign-in failures show to the visitor during the round trip: | `oidc_issuer_mismatch` | 422 | The ID token `iss` does not match the connection | | `oidc_audience_mismatch` | 422 | The ID token `aud` does not include the client ID | | `oidc_state_expired` | 422 | The sign-in took longer than 10 minutes. Start again | + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/meta.ts b/content/(account)/meta.ts index 646e3809..96d4811b 100644 --- a/content/(account)/meta.ts +++ b/content/(account)/meta.ts @@ -6,10 +6,12 @@ export default defineMeta({ pages: [ "teams", "subteams", - "auto-enroll", "authentication", - "api-keys", + "sso", + "auto-enroll", "identity-connections", + "api-keys", + "approvals", "billing", "pricing", "usage", diff --git a/content/(account)/pricing.mdx b/content/(account)/pricing.mdx index 8315b516..fa1b6b99 100644 --- a/content/(account)/pricing.mdx +++ b/content/(account)/pricing.mdx @@ -1,10 +1,10 @@ --- -title: Pricing and limits -description: Every plan's price, allowances, usage budgets, per-Space Boost, and limits per team and per Space +title: Pricing and plans +description: Every plan's price, allowances, usage budgets, per-Space Boost, and feature links per team and per Space mode: wide --- -Every plan allows commercial use. Hover the i on any row for what it counts. Tables scroll sideways for every plan. +Every plan allows commercial use. Hover or tap the i on any row for a one-line description, or follow the feature name to its documentation page. Tables scroll sideways for every plan. ## Plans at a glance @@ -41,14 +41,14 @@ The first two are real usage from the last 30 days. -## At the limit +## Behavior at plan limits | When | Pauses | Keeps working | | --- | --- | --- | | Personal uses its $1 | New [builds](/ci) and [Workers](/functions) | Deployed Spaces: serving, compute, email | | You reach a budget you set | New builds and Workers. Nothing above the budget is charged | Deployed Spaces | | Usage reaches twice that budget (default serving-pause threshold) | Serving too. Visitors see "This space is paused" | Your content and settings. Raise the budget or wait for the month to reset, and serving returns | -| A Space hits one of its limits | That request gets a 429 ([rate limiting](/infrastructure/rate-limiting)), or that publish gets an [error](/errors) naming the limit | The rest of the Space | +| A Space hits one of its limits | That request gets a 429 ([rate limiting](/traffic-rules#edge-rate-limiting-429-vs-capacity-599-and-challenges-403)), or that publish gets an [error](/errors) naming the limit | The rest of the Space | ## Domains @@ -58,7 +58,7 @@ The first two are real usage from the last 30 days. | Registered through WordPress.com, or on Spacefast DNS | Free to connect | No | | Any other domain | Free to connect | Yes | -Managed HTTPS is included. See [Custom domains](/domains) and [TLS certificates](/infrastructure/tls-certificates). +Managed HTTPS is included. See [Custom domains](/domains) and [TLS certificates](/domains/tls-certificates). ## Billing questions @@ -84,7 +84,7 @@ Owners and admins get email and dashboard alerts at 50%, 80%, and 100% by defaul Yes. Contact sales. -## Fine print +## Billing terms | Term | Meaning | | --- | --- | diff --git a/content/(operate)/sso.mdx b/content/(account)/sso.mdx similarity index 98% rename from content/(operate)/sso.mdx rename to content/(account)/sso.mdx index 8924c89d..fe7d1839 100644 --- a/content/(operate)/sso.mdx +++ b/content/(account)/sso.mdx @@ -120,3 +120,7 @@ The exchange steps between your portal and Spacefast are not yet part of the pub ## Team member SSO External identity connections above control visitor access to individual Spaces. Enterprise plans also support member sign-in through your company's SSO provider for signing in to Spacefast itself. See [Teams](/teams) and [Authentication](/authentication). + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/subteams.mdx b/content/(account)/subteams.mdx index ad0d5355..0bcf1532 100644 --- a/content/(account)/subteams.mdx +++ b/content/(account)/subteams.mdx @@ -3,7 +3,7 @@ title: Subteams description: Split an Enterprise team into subteams, each with its own members and Spaces, on the parent's plan and seats --- -Enterprise + A subteam is a team inside your team. It has its own name, URL, members, and Spaces. It uses the parent team's plan, seats, and billing. @@ -97,3 +97,7 @@ A parent team cannot be deleted while it has subteams. Delete every subteam firs | `team_has_subteams` | 409 | The parent team still has subteams | | `not_found` | 404 | The subteam does not exist, or the user is not a member of the parent team | | `forbidden` | 403 | Your role cannot manage members, or you are not in the subteam whose members you asked for | + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/teams.mdx b/content/(account)/teams.mdx index 46faa4b2..b9a6c302 100644 --- a/content/(account)/teams.mdx +++ b/content/(account)/teams.mdx @@ -164,3 +164,7 @@ Only owners and admins can transfer a Space. Two consequences to plan for: the o | Read or reset the team join link | [`GET /v1/teams/{teamId}/join-link`](/api/reference/teams/getteamjoinlink), [`POST /v1/teams/{teamId}/join-link/reset`](/api/reference/teams/resetteamjoinlink), [`GET /v1/join-links/{token}`](/api/reference/teams/getjoinlink) | | Manage team labels | [`GET /v1/teams/{teamId}/labels`](/api/reference/teams/listteamlabels), [`POST /v1/teams/{teamId}/labels`](/api/reference/teams/createteamlabel), [`PATCH /v1/teams/{teamId}/labels/{labelId}`](/api/reference/teams/updateteamlabel), [`DELETE /v1/teams/{teamId}/labels/{labelId}`](/api/reference/teams/deleteteamlabel) | | Create, accept, or cancel Space transfers | [`POST /v1/space-transfers`](/api/reference/spaces/createspacetransfer), [`POST /v1/space-transfers/{transferId}/accept`](/api/reference/spaces/acceptspacetransfer), [`DELETE /v1/space-transfers/{transferId}`](/api/reference/spaces/cancelspacetransfer) | + +## CLI, API, MCP, and SDK + + diff --git a/content/(account)/usage.mdx b/content/(account)/usage.mdx index f8b71a19..f36b1715 100644 --- a/content/(account)/usage.mdx +++ b/content/(account)/usage.mdx @@ -61,3 +61,7 @@ Nothing is deduplicated. A file present in two Spaces sits on two disks and coun The newest measurement period is always dropped, because partial ingestion underreports it. When the measuring infrastructure is unreachable, usage comes back as `null` rather than a zero or a cached guess. A blank meter means unmeasured, not empty. Function invocation counts are pushed after each request finishes, so they can arrive late. + +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/actions.mdx b/content/(build)/actions.mdx index b1d92369..c020347e 100644 --- a/content/(build)/actions.mdx +++ b/content/(build)/actions.mdx @@ -1,13 +1,11 @@ --- title: Actions, queries, and jobs description: Write typed SpacePress queries, server mutations, zero-JS forms, background jobs, transactional hooks, and custom HTTP routes on your Space -sidebar: - badge: Labs --- -Labs + -SpacePress runs typed server queries, validated mutations, progressive zero-JS forms, transactional hooks, Action Scheduler background jobs, and custom HTTP routes directly on your Space. Export them in TypeScript under `sp/` or declare actions under `app.actions` in `spacefast.config.ts`. +SpacePress runs typed server queries, validated mutations, progressive zero-JS forms, transactional hooks, background jobs, and custom HTTP routes directly on your Space. Export them in TypeScript under `sp/` or declare actions under `app.actions` in `spacefast.config.ts`. ## Write typed queries and mutations @@ -141,7 +139,7 @@ export default function Contact() { ## Background jobs and transactional hooks -Move slow outbound calls, retries, and scheduled work into Action Scheduler background jobs with `job()`, and tie side effects to writes with `.on()`: +Move slow outbound calls, retries, and scheduled work into background jobs with `job()`, and tie side effects to writes with `.on()`: ```ts sp/jobs.ts import { boolean, job, table, text } from "spacepress"; @@ -215,3 +213,7 @@ curl -X POST https://api.spacefast.com/v1/actions/resume \ | `expired` | The continuation window elapsed before a decision | Only the signed-in owner of the requesting grant can approve ([`approveApproval`](/api/reference/agent/approveapproval)) or deny ([`denyApproval`](/api/reference/agent/denyapproval)) an approval request. See [Agent permissions](/agents/permissions) for the full approval lifecycle. + +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/build.mdx b/content/(build)/build.mdx index 7582aea6..c8e6fb4f 100644 --- a/content/(build)/build.mdx +++ b/content/(build)/build.mdx @@ -7,9 +7,9 @@ Every Space starts with your files and grows into a full-stack app in one projec ## Build with SpacePress -Labs + -SpacePress is Spacefast's full-stack TypeScript layer. Your team needs SpacePress enabled to publish a SpacePress app. Write your schema, queries, actions, jobs, and TSX pages in TypeScript under `sp/`. On publish, Spacefast compiles them to native WordPress and PHP with no Node.js server to manage. +SpacePress is Spacefast's full-stack TypeScript layer. Your team needs SpacePress enabled to publish a SpacePress app. Write your schema, queries, actions, jobs, and TSX pages in TypeScript under `sp/`. On publish, Spacefast compiles them onto Spacefast's managed application server with no Node.js server to manage. Configure your Space in `spacefast.config.ts` with `defineConfig` from `spacefast/config`. You can declare app settings inline under `app` in `spacefast.config.ts` or in a standalone `spacepress.config.ts` beside it, but not both in the same project. `sf.jsonc` remains permanently supported as the JSON fallback; see [Configuration](/config-file). @@ -36,14 +36,34 @@ export default defineConfig({ Every capability publishes and rolls back with your Space's versions. Preview channels run against an isolated SQLite database per version so preview edits never touch live MySQL data. +## SpacePress is managed on Spacefast + +Spacefast uses WordPress and SpacePress as a managed application server, not a general-purpose WordPress server: **no custom server code runs on the origin outside SpacePress.** You cannot upload arbitrary PHP files, install third-party WordPress plugins, or upload custom WordPress themes. Every origin route, collection, table, action, and job compiles from your TypeScript under `sp/`, while Node-compatible JavaScript and TypeScript runs in [Workers](/functions). Spacefast provisions the runtime, configures pretty permalinks (`/%postname%/`), strips frontend bloat (no WordPress admin bar on public pages, no emoji scripts), locks schema definitions to your TypeScript code, and rolls out platform updates centrally. + +| What you might expect on self-managed WordPress | How it works on Spacefast | +| --- | --- | +| Third-party WordPress plugins (`wp plugin install`, ZIP uploads) | **Not supported.** Spacefast manages the built-in capabilities SpacePress needs (block editor, custom fields, background jobs, redirects, and WooCommerce when you declare `store()`). Installing, uploading, updating, or deleting plugins is disabled in `wp-admin`, over REST, and in `sf app wp`. | +| Arbitrary third-party WordPress themes or file editors | **Not supported.** Theme installs, uploads, the Customizer, and the built-in PHP file editors are disabled. Style pages with TSX + CSS imports (`import "./app.css"`), a root `theme.json`, or edit headers and footers in the Site Editor using the managed block theme (`template = "theme"`). | +| Arbitrary uploaded PHP, `.htaccess`, `.user.ini`, `php.ini`, or SSH/SFTP | **Not supported.** Spacefast rejects `.htaccess` and `.user.ini` on publish and never executes arbitrary uploaded PHP. All PHP comes from compiling TypeScript under `sp/`. Use `sf app wp` for allowlisted WordPress maintenance commands. | +| Node.js or npm server packages inside `sp/` | **Use Workers instead.** Code under `sp/` compiles to PHP without a Node.js runtime. Put Node-compatible server logic, streaming AI routes, or npm libraries in [Workers](/functions) (`functions/` or `"use worker";` routes in `sp/app/`), and connect external SaaS APIs through [Connectors](/connectors). | +| Manual `spacepress login`, `spacepress push`, or WordPress passwords | **Not needed.** Validate offline with `sf check`, deploy with `sf publish` or Git, sign visitors in with `/__spacefast/sign-in` ([App users and sign-in](/users)), and open the editor with one-use admin links. | + +Built-in hardening defaults stay on automatically for every SpacePress app: + +- **Closed author enumeration:** Unauthenticated `/wp/v2/users`, `/author//` archives, `?author=N`, user sitemaps, and oEmbed author fields stay hidden unless you set `publicAuthors: true` or grant public reads on your users kind. +- **Non-enumerating sign-in errors:** Failed sign-in and password-reset responses never reveal whether an account exists. +- **Comments closed by default:** Comments stay off on every post type unless a collection opts in with `comments: true` or `comments: { moderation, threaded }`. +- **Optional legacy protocols:** Turn off XML-RPC (`xmlrpc: false`) or pingbacks and trackbacks (`pings: false`) in `defineConfig()`. + ## Capabilities | Capability | What it does | | --- | --- | -| [Collections and CMS](/collections) | SpacePress storage kinds (`collection()`, `table()`, `global()`, `taxonomy()`, `wp.posts.extend()`), typed fields, TSX pages, `"use client"` islands, Markdown sync, and WooCommerce stores | -| [Actions, queries, and jobs](/actions) | Typed `query()` and `mutation()` server functions, zero-JS forms, transactional hooks, Action Scheduler background `job()`s, custom HTTP routes, and human approval continuation | -| [Database and ORM](/database) | Dedicated MySQL per Space, visitor-scoped `spacepress/server/db` queries, Drizzle-inspired `db` ORM, declarative access rules, forward-only SQL migrations, `env.DB`, `sf db`, and a single-use SQL console | -| [WordPress and Content API](/wordpress) | SpacePress Admin (`/wp-admin/new/`), one-use admin links, proxied and direct WordPress REST APIs, WordPress Abilities, three-way content sync, generated typed clients, `sf app wp`, and `sf apply` | +| [Collections and CMS](/collections) | SpacePress storage kinds (`collection()`, `table()`, `global()`, `taxonomy()`, `wp.posts.extend()`), drafts and scheduled publishing, native revisions, staged versions, soft deletes, RSS and Atom feeds, XML sitemaps, Markdown twins and `/llms.txt`, media sizes, comments, TSX pages, `"use client"` islands, Markdown sync, and WooCommerce stores | +| [Actions, queries, and jobs](/actions) | Typed `query()` and `mutation()` server functions, zero-JS forms, transactional hooks, background `job()`s, custom HTTP routes, and human approval continuation | +| [Database and ORM](/database) | Dedicated MySQL per Space, visitor-scoped `spacepress/server/db` queries, typed `db` ORM, declarative access rules, forward-only SQL migrations, `env.DB`, `sf db`, and a single-use SQL console | +| [App users and sign-in](/users) | Built-in Sign in with Spacefast (`/__spacefast/sign-in`), visitor roles, `ctx.user`, and `sf add auth` | +| [WordPress and Content API](/wordpress) | SpacePress Admin (`/wp-admin/new/`), real-time co-editing, declarative `adminScreen()` views, one-use admin links, proxied and direct WordPress REST APIs, WordPress Abilities, three-way content sync, generated typed clients, allowlisted `sf app wp`, and `sf apply` | | [Workers](/functions) | Server-side JavaScript and TypeScript via `functions/`, a root `handler.ts`, `"use worker";` SpacePress routes, or OpenNext, with `env.SPACE`, `env.DB`, `env.STORAGE`, and `env.CONNECTORS` bindings | | [Transactional email](/email) | Outbound mail signed with your primary custom domain, React Email templates (`emails/*.tsx`), `mail.render()`, and transactional `mail.send()` | | [Object storage](/object-storage) | Runtime file uploads separate from published version files, with private and public access plus SpacePress `files()` buckets | @@ -60,6 +80,7 @@ sf init my-space cd my-space sf add form sf check +sf publish ``` Follow [Build your first full-stack Space](/guides#build-your-first-full-stack-space) to set the recipient, publish the form, and check a submission. @@ -67,5 +88,9 @@ Follow [Build your first full-stack Space](/guides#build-your-first-full-stack-s - [`sf init`](/cli/reference/init#sf-init-name) scaffolds a SpacePress `app` project by default (`spacefast.config.ts`, a `notes` collection, `sp/actions.ts`, and `sp/app/page.tsx`), or pass `--template static`, `next`, or `astro`. See [Starters and templates](/guides/starters). - [`sf add`](/cli/reference/add#sf-add-recipe-directory) writes plain source files you own and edit directly: `form` (contact table, mutation, and form), `shop` (native WooCommerce store, checkout block, and synced products), `auth` (Sign in with Spacefast and `/account`), or `ai-route` (streaming `functions/api/chat.ts` route). - [`sf check`](/cli/reference/check#sf-check-dir) validates `spacefast.config.ts` (or `sf.jsonc`), SpacePress schemas and handlers, routing rules, Worker routes, and scans publishable files for secrets in one offline pass. -- [`sf dev`](/cli/reference/dev#sf-dev) starts your framework dev server and runs `functions/` Workers locally. For a full local WordPress + SQLite server with live rebuilds on `sp/` edits, run `npx spacepress dev` or publish to a Spacefast preview channel. -- Moving an older Zero 0.8 or `zero.config.ts` Space? See [Migrating from Zero 0.8](/zero-migration). +- [`sf dev`](/cli/reference/dev#sf-dev) starts your frontend framework dev server and runs `functions/` Workers locally. To test full SpacePress rendering and database writes without touching live MySQL data, publish to a [preview channel](/channels) (each preview version gets its own isolated SQLite database). +- Moving an older Zero 0.8 or `zero.config.ts` Space? See [Migrating from Zero 0.8](/guides/zero-migration). + +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/collections.mdx b/content/(build)/collections.mdx index e2f6638d..3ab9a469 100644 --- a/content/(build)/collections.mdx +++ b/content/(build)/collections.mdx @@ -1,17 +1,15 @@ --- title: Collections and CMS description: Define SpacePress collections, SQL tables, globals, typed fields, TSX pages, interactive islands, Markdown sync, and WooCommerce stores in TypeScript -sidebar: - badge: Labs --- -Labs + SpacePress gives every Space a typed CMS, custom SQL tables, server-rendered TSX pages, and native WooCommerce stores. Declare your models in TypeScript under `sp/` (with `spacepress.config.ts`) or inline under `app` in `spacefast.config.ts`. Spacefast backs them with your Space's database on publish. ## Choose a storage kind -SpacePress runs a dual storage engine on WordPress and MySQL. Pick the builder that matches how you edit and query the data: +SpacePress stores editorial content in WordPress and relational app data in MySQL. Pick the builder that matches how you edit and query the data: | Builder | Backed by | Best for | | --- | --- | --- | @@ -19,7 +17,7 @@ SpacePress runs a dual storage engine on WordPress and MySQL. Pick the builder t | `table()` | Dedicated SQL table | Relational app data, high-volume records, compound `.index()` definitions, and forward-only SQL migrations | | `global()` | WordPress options singleton | Site-wide settings, navigation links, and feature flags | | `wp.posts.extend()` | Built-in WordPress `post` | Native blog posts extended with typed fields, custom URL patterns, comments, and Markdown sync | -| `userProjection()` | `wp_users` and `wp_usermeta` | Typed user profiles without duplicating WordPress accounts | +| `userProjection()` | WordPress accounts | Typed user profiles without duplicating WordPress accounts | | `taxonomy()` | WordPress term tables | Flat or hierarchical vocabularies attached with `on: [...]` or `terms()` | | `store()`, `product()`, `order()` | Native WooCommerce | Online stores with currencies, shipping zones, checkout blocks, and optimistic cart hooks | @@ -83,13 +81,141 @@ SpacePress validates every field across REST requests, `db` calls, CLI writes, a Chain modifiers directly onto any supported column: - **Validation and defaults:** `.optional()`, `.min(n)`, `.max(n)`, `.pattern(/.../)`, `.unique()`, `.default(v)`, `.defaultNow()`, `.$default(fn)`, `.$onUpdate(fn)`, `.validate((value, ctx) => ...)` -- **Search and localization:** `.searchable()` (or `.searchable(false)` to exclude title, content, or specific text fields from search) and `.localized()` for per-locale fields +- **Search:** `.searchable()` (or `.searchable(false)` to exclude title, content, or specific text fields from search) - **Access and editor UI:** `.access({ read, create, update })` for per-field masks, `.ui({ label, help, placeholder, width })`, and `.showIf({ ... })` for conditional editor visibility - **Safe renames without data loss:** `.column("old_name")` keeps an existing physical SQL column, `storageName: "old_table"` keeps a table name, and `.alias("oldName")` keeps older API and filter names working during a rename +## Built-in content features + +Every SpacePress Space ships with editorial publishing features out of the box, with no third-party WordPress plugins to install or configure. + +### Built-in WordPress kinds + +Even before you declare custom schemas, SpacePress exposes WordPress's built-in kinds (`posts`, `pages`, `media`, `categories`, `tags`, `comments`, `menus`, and `users`) with flat typed fields and standard REST routes. Extend native blog posts with `wp.posts.extend()` when you want WordPress's default blog, categories, tags, and feeds plus custom typed fields. + +### Drafts and scheduled publishing + +Every `collection()` and `wp.posts.extend()` automatically includes system columns `id`, `author`, `createdAt`, `updatedAt`, `status` (`"draft" | "published" | "scheduled"`), and `publishedAt`. Custom `table()` kinds can opt into the same lifecycle with `{ drafts: true }`. + +- **Automatic visibility:** Anonymous visitors and public queries only receive `"published"` records. Authors and editors see drafts and scheduled items according to their read rules. +- **Scheduled publishing:** Set `status: "scheduled"` with a future `publishedAt` ISO timestamp. WordPress schedules automatic publication on its `publish_future_post` cron event. +- **Publish hook:** Attach `.on({ afterPublish(row) { ... } })` to run side effects whenever an item goes live, whether created published, transitioned from a draft, or published automatically at its scheduled time. + +### Native revisions and optimistic concurrency + +Revisions are **on by default** for both `collection()` and `table()` (opt out with `{ revisions: false }`). Every `create`, `update`, `delete`, `restore`, and `purge` writes a JSON snapshot with a monotonic `version`, operation type, timestamp, actor `userId`, applied schema migration ID, linked `ref().many()` IDs, and the list of changed fields. + +Use the `revisions` API on any kind (in server code, over REST at `//revisions`, through generated clients, or via WordPress Abilities): + +```ts sp/revisions.ts +import { posts } from "spacepress/server/db"; + +const history = await posts.revisions.list(postId); +const snapshot = await posts.revisions.get(postId, 2); +const changes = await posts.revisions.diff(postId, 1, 2); +const restored = await posts.revisions.restore(postId, 1); +``` + +- **Optimistic concurrency (`_rev`):** Item reads include an opaque `_rev` token. Passing `_rev` on an update, delete, or staged write rejects stale edits with `409 stale_revision`, listing which fields changed and returning the current token. Omitting `_rev` performs an unconditional write. +- **Editor locks:** On post collections, SpacePress honors WordPress's `_edit_lock`. While another person has the document open in the editor, API and ability writes return `409 locked` naming the holder unless the caller sends `takeover: true`. + +### Staged versions (preview edits beside live content) + +Staged versions are **on by default** for `collection()` and `wp.posts.extend()` (opt out with `{ staged: false }`). Editors and agents can stage edits beside a published item while visitors, RSS feeds, sitemaps, search, REST, and Markdown twins keep serving the live version: + +| Operation | REST endpoint | What it does | +| --- | --- | --- | +| Stage changes | `POST ///staged` | Validates and saves patched fields into the item's staged revision without running hooks or changing live output | +| Read staged version | `GET ///staged` | Returns the merged row as it will look once promoted, plus which fields are staged and who staged last | +| Compare with live | `GET ///staged/compare` | Lists every staged field that differs from live through the caller's field masks | +| Mint preview link | `POST ///staged/preview` | Returns a signed, expiring preview URL (`sp_preview` query token, 1 hour default, up to 24 hours) readable without signing in under anonymous field masks | +| Promote or schedule | `POST ///staged/promote` | Applies the staged fields as a normal update (running hooks, validation, revisions, webhooks, and cache purges), or schedules a future promotion with `{ at: "" }` (`{ at: null }` cancels) | +| Discard | `DELETE ///staged` | Ends the staged version without touching live content, keeping the discarded snapshot in revision history | + +Only callers covered by the item's `update` rule can view or modify staged versions. Everyone else receives `404` so staged edits never leak existence. + +### Soft deletes and retention policy + +Soft deletes are **on by default** for both `collection()` (moves posts to WordPress Trash) and `table()` (sets `deletedAt`, `deletedBy`, and `deletedGroup` while excluding deleted rows from active unique constraints so slugs and emails can be reused). Opt out with `{ softDelete: false }`. + +- `kind.delete(id)` soft-deletes the item and tags `onDelete: "cascade"` children with the same `deletedGroup`. +- `kind.restore(id)` restores the item and any children sharing its `deletedGroup`. +- `kind.purge(id)` permanently removes a record (defaults to `"system"` access and fires `beforePurge` and `afterPurge` hooks). +- `kind.list({ deleted: "exclude" | "include" | "only" })` defaults to `"exclude"`; `"include"` and `"only"` require `restore` or `delete` access. +- **Default retention is `"forever"`:** SpacePress unhooks WordPress's 30-day automatic Trash purge (`wp_scheduled_delete`), so soft-deleted items and revisions are never deleted automatically. Opt into scheduled Action Scheduler pruning globally in `defineConfig()` or per kind: + +```ts spacepress.config.ts +export default defineConfig({ + name: "my-space", + retention: { + deleted: "90d", + revisions: { keepLast: 50, maxAge: "365d" }, + }, +}); +``` + +### RSS and Atom feeds + +Built-in WordPress feeds work automatically on every SpacePress Space without installing a feed plugin: + +| Feed | Path | +| --- | --- | +| Site posts (RSS 2.0) | `/feed/` | +| Site posts (Atom) | `/feed/atom/` | +| Site comments | `/comments/feed/` | +| Post comments (when comments are enabled) | `/feed/` | +| Category, tag, or taxonomy term | `/category//feed/`, `/tag//feed/` | + +SpacePress applies your collection `url` patterns to feed permalinks and purges affected feeds automatically whenever a post or comment changes. Drafts, private records, staged edits, and private authors (`publicAuthors: false`) never appear in feeds. + +Custom `collection()` kinds set `has_archive: false` by default. To publish an RSS, Atom, or JSON Feed for a custom collection or SQL table, export a `GET` handler in `sp/app/feed.xml/route.ts` (or `sp/app/feed.json/route.ts`): + +```ts sp/app/feed.json/route.ts +import { docs } from "spacepress/server/db"; + +export async function GET() { + const items = await docs.list({ orderBy: { publishedAt: "desc" }, limit: 25 }); + return Response.json( + { + version: "https://jsonfeed.org/version/1.1", + title: "Latest docs", + items: items.map((doc) => ({ + id: String(doc.id), + url: `/docs/${doc.slug}`, + title: doc.title, + date_published: doc.publishedAt, + })), + }, + { headers: { "Content-Type": "application/feed+json; charset=utf-8" } }, + ); +} +``` + +### XML sitemaps, `robots.txt`, and SEO metadata + +- **Automatic XML sitemaps (`/wp-sitemap.xml`):** SpacePress extends WordPress's built-in sitemap index with a sub-sitemap for each public `collection()` that declares a `url` (`/wp-sitemap-spacepress--1.xml`) and one for static `sp/app/` pages (`/wp-sitemap-spacepress-app-pages-1.xml`), alongside core posts, pages, and taxonomies. + - **Access-safe by default:** Every entry is evaluated as an anonymous visitor. Drafts, guarded routes, password-protected posts, private authors, and pages with `metadata.robots = { index: false }` are automatically left out. + - **Automatic purging:** Writing or publishing an item purges the sitemap index and affected sub-sitemaps. Setting `frontend: false` turns sitemaps off completely. +- **Head and social metadata (`export const metadata`):** Layouts merge down into pages field-by-field for `title` (including `{ default, template: "%s | My Site" }`), `description`, `canonical`, `robots`, `openGraph`, `twitter`, `links`, and `scripts`. Dynamic pages can export a function to compute metadata from the loaded item. +- **`robots.txt`:** Served automatically with the sitemap link and `Content-Signal` directive (`search=yes, ai-input=yes, ai-train=no`). + +### Markdown twins (`*.md`) and `/llms.txt` + +Every public SpacePress page and published post automatically serves a clean Markdown twin for AI tools and scripts: + +- Append `.md` to any public URL (`/blog/hello` → `/blog/hello.md`, `/` → `/index.md`), send `Accept: text/markdown` on an HTML URL, or pass `?format=md` on a core REST item route (`/wp-json/wp/v2/posts/?format=md`). +- HTML pages advertise their twin in both a `Link: <...>; rel="alternate"; type="text/markdown"` HTTP header and a `` tag, plus `Content-Signal: search=yes, ai-input=yes, ai-train=no`. +- `/llms.txt` is generated automatically from public collections, static `sp/app/` pages, and non-empty taxonomies (up to 100 entries per kind), honoring read rules, route guards, and password protection. Drafts, private items, and staged edits never appear in Markdown twins or `/llms.txt`. +- Committed writes automatically purge affected `.md` twins and `/llms.txt`. + +### Media library, focal-point image sizes, and comments + +- **Media library and focal crops:** `media({ accept })` fields bind to the built-in WordPress Media Library (with `alt`, `filename`, and `mime`). Declare named image sizes in `defineConfig({ media: { sizes: { card: { width: 800, height: 450, fit: "cover" } } } })` to generate `sp_` renditions that honor each image's focal point. For private access-controlled files that never expose public attachment URLs, use `files()` and `file(bucket)` instead (see [Actions, queries, and jobs](/actions#custom-http-routes-and-private-file-buckets)). +- **Comments:** Comments are closed on every post type by default. Opt in per collection with `comments: true` or `comments: { moderation: "first-time", threaded: 2 }`, then render `` in TSX. The form works without JavaScript, holds first-time commenters for review, and editors moderate threads under **Comments** in `/wp-admin/`. + ## Inline `app` config in `spacefast.config.ts` -For smaller schemas or when you want every Space setting in one file, declare `app` directly inside `spacefast.config.ts` with `defineConfig` from `spacefast/config`. Publish only one app definition per project — either inline under `app` or in a standalone `spacepress.config.ts`, never both. See [Configuration](/config-file#coexistence-with-spacepressconfigts). +For smaller schemas or when you want every Space setting in one file, declare `app` directly inside `spacefast.config.ts` with `defineConfig` from `spacefast/config`. Publish only one app definition per project, either inline under `app` or in a standalone `spacepress.config.ts`, never both. See [Configuration](/config-file#coexistence-with-spacepressconfigts). ```ts spacefast.config.ts import { defineConfig } from "spacefast/config"; @@ -105,7 +231,6 @@ export default defineConfig({ }, admin: { enabled: true, title: "Editorial" }, auth: { enabled: true }, - locales: { default: "en", supported: ["en", "es"] }, }, }); ``` @@ -122,19 +247,20 @@ The inline `app` block accepts these keys: | `routes` | object or array of objects | Custom application routes | | `admin` | boolean or `{ enabled, path, title }` | Admin interface toggle, path, and title | | `auth` | `{ enabled, providers, roles, twoFactor }` | App authentication settings and role definitions | -| `locales` | `string[]` or `{ default, supported }` | Supported locales and default locale | -| `plugins` | array or object | App plugin entries | + +Spacefast manages WordPress plugins for you (third-party WordPress plugins cannot be installed on Spacefast), and `locales` is currently disabled in the SpacePress compiler. ## Pages, layouts, and `"use client"` islands Place TSX pages and layouts under `sp/app/`. SpacePress compiles them to server-rendered PHP on publish, with zero React shipped to the browser: -- **Routing files:** `sp/app/layout.tsx` (shared shell, `metadata`, `template = "theme" | "blank" | ""`), `page.tsx`, `[slug]/page.tsx`, `[...path]/page.tsx`, `(group)/`, `not-found.tsx`, and `login.tsx`. Dynamic route `params` is a plain synchronous object (such as `{ slug: string }`), not a Promise — read `params.slug` directly instead of `await params`. -- **Automatic document shell and assets:** SpacePress renders ``, ``, and `` automatically. Never render ``, ``, ``, or `` inside TSX components — set head tags with `export const metadata = { title: "..." }`, import stylesheets directly from TSX (`import "./app.css"`), and place static files or images under `public/` (served from `/`). +- **Routing files:** `sp/app/layout.tsx` (shared shell, `metadata`, `template = "theme" | "blank" | ""`), `page.tsx`, `[slug]/page.tsx`, `[...path]/page.tsx`, `(group)/`, `not-found.tsx`, and `login.tsx`. Dynamic route `params` is a plain synchronous object (such as `{ slug: string }`), not a Promise. Read `params.slug` directly instead of `await params`. +- **Automatic document shell and assets:** SpacePress renders ``, ``, and `` automatically. Never render ``, ``, ``, or `` inside TSX components. Set head tags with `export const metadata = { title: "..." }`, import stylesheets directly from TSX (`import "./app.css"`), and place static files or images under `public/` (served from `/`). - **Page Enhancements and `inject` snippets:** Rendered SpacePress HTML pages receive Spacefast Page Enhancements ([Tag Manager](/tag-manager), browser stats, Remix pill, and Space bar / [Comments](/comments)) plus `inject` snippets from `spacefast.config.ts`. `/wp-json/*`, `/wp-admin/*`, `/__spacefast/auth/*`, and `*.md` Markdown twins are excluded. - **Typed search params and guards:** Export `search = { page: integer().default(1) }` for typed query parameters and `guard = "authenticated"` (or any role or access function) for route-level protection. - **Built-in server components (`spacepress/app`):** `` (Interactivity Router navigation), `` (block content), `` (sanitized HTML), ``, ``, ``, ``, ``, ``, ``, and `useFormState(action)`. - **Interactive islands (`"use client"`):** Start a component file with `"use client";`, import `useState`, `useEffect`, or `useRef` from `"react"`, SpacePress client hooks (`useLive`, `useMutation`, `useMount`, `useEvent`, `sharedState`, `uploadFile`) from `"spacepress/react"`, and typed client references from `sp/_generated/api`. SpacePress renders the initial HTML on the server and compiles client interactivity to the WordPress Interactivity API. +- **Page caching and prerendering:** SpacePress classifies every route (`immutable`, `anonymous-public`, `request-private`, or `unknown`), records read dependencies per shareable URL, and purges affected pages, feeds, sitemaps, and `.md` twins automatically when data changes. Eligible literal pages prerender automatically (set `export const prerender = true` or `false` to override). ```tsx sp/app/page.tsx import { posts } from "spacepress/server/db"; @@ -201,7 +327,7 @@ Spacefast stores live collections, custom tables, and WordPress data in your Spa ## Read collections from Workers and `"use worker"` routes -When a Space runs both a SpacePress app and a [Worker](/functions) — from `functions/` or a SpacePress `route.ts` starting with `"use worker";` — Spacefast injects `env.SPACE` into the Worker handler (typed by generated `worker.d.ts`; `env.SPACEPRESS` and `env.APP` remain aliases). Use `env.SPACE.collection(name)` to read and write records while forwarding the visitor's session cookie: +When a Space runs both a SpacePress app and a [Worker](/functions) (from `functions/` or a SpacePress `route.ts` starting with `"use worker";`), Spacefast injects `env.SPACE` into the Worker handler (typed by generated `worker.d.ts`; `env.SPACEPRESS` and `env.APP` remain aliases). Use `env.SPACE.collection(name)` to read and write records while forwarding the visitor's session cookie: ```ts functions/api/posts.ts export async function GET(request: Request, { env }: { env: any }) { @@ -227,3 +353,18 @@ export async function GET(request: Request, { env }: { env: any }) { - **Admin editor, WordPress REST API, Content sync, Abilities, and WP-CLI:** See [WordPress and Content API](/wordpress) for `POST /v1/spaces/{spaceId}/content/*`, direct WordPress REST tokens, and `sf app wp`. - **Validate offline:** Run [`sf check`](/cli/reference/check#sf-check-dir) to validate `spacefast.config.ts`, SpacePress schemas, routing rules, Worker routes, and secret scanning in one pass (exits `2` on failure). - **System and error pages:** [`sf pages`](/cli/reference/pages#sf-pages) manages Spacefast system and error page templates (`_pages/*.html`), not CMS collections. See [Customization and error pages](/customization). +## SpacePress rules on Spacefast + +Follow these rules when building or editing a SpacePress app on Spacefast: + +- **Use `spacepress` names only:** Keep config in `spacepress.config.ts` (or inline under `app` in `spacefast.config.ts`), put app code under `sp/`, and import from `"spacepress"`, `"spacepress/server"`, `"spacepress/server/db"`, `"spacepress/app"`, and `"spacepress/client"`. Never edit `sp/_generated/`. +- **Validate with `sf check`, deploy with `sf publish`:** Run `sf check` after edits (`sf dev` does not run SpacePress yet) and deploy with `sf publish` or a connected Git build. Never run `spacepress login`, `spacepress push`, or `spacepress dev`, and never create WordPress users, passwords, or application passwords manually. +- **Require a signed-in team:** Anonymous unclaimed Spaces cannot run SpacePress. If publish or build returns `feature_unavailable`, a team owner or admin must join SpacePress under [**Settings → Labs**](https://my.spacefast.com/?to=/:team/settings/labs). +- **Enforce access on the server:** Read visitor-scoped records from `"spacepress/server/db"` so every `access` rule applies as the current visitor. Use trusted `db` from `"spacepress/server"` or `.system` only inside mutations or jobs after verifying `ctx.user`. Never trust a user ID sent by the browser. +- **Built-in sign-in:** Link visitors to `/__spacefast/sign-in?return=/path/` (or scaffold pages with `sf add auth`). Signed-in visitors arrive as `ctx.user`. +- **Managed WordPress runtime:** Spacefast manages WordPress core, themes, and platform plugins for you. Third-party WordPress plugins, uploaded theme ZIPs, `.htaccess`, `.user.ini`, and arbitrary PHP files are not supported. Put Node/npm server code in [Workers](/functions) and external APIs in [Connectors](/connectors). +- **Safe schema evolution:** Add `.optional()` or `.default()` on new fields for kinds with existing rows, and keep physical SQL names intact with `.column("old_name")`, `storageName: "old_table"`, and `.alias("oldName")` (forward-only migrations never rename columns in place). Never drop a kind or field holding live data without confirmation. + +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/connectors.mdx b/content/(build)/connectors.mdx index 411a0b5d..f650c70c 100644 --- a/content/(build)/connectors.mdx +++ b/content/(build)/connectors.mdx @@ -1,11 +1,10 @@ --- title: Connectors description: Connect an external service once and call its tools from Space pages, Workers, local AI agents, and scripts while credentials stay sealed in Spacefast -sidebar: - badge: Public Beta --- -Public Beta + + Connectors let your team connect an external service once (an OpenAPI spec, a GraphQL endpoint, or a remote MCP server) and call its tools from Space pages, [Workers](/functions), local AI agents, and scripts. Credentials stay sealed in Spacefast and never enter prompts, source code, or browsers. @@ -435,6 +434,11 @@ sf connectors delete linear --yes Deleting a connector disconnects every account on it, then deletes the connector and its tools. Built-in connectors cannot be removed. + +## CLI, API, MCP, and SDK + + + ## Reference - [`sf connectors`](/cli/reference/connectors#sf-connectors) — every CLI command, flag, and exit code diff --git a/content/(build)/crons.mdx b/content/(build)/crons.mdx index dd189a8d..2af48d97 100644 --- a/content/(build)/crons.mdx +++ b/content/(build)/crons.mdx @@ -142,3 +142,6 @@ Only the newest failures are kept, with no history behind them. A real failure a | `reason` | `over_plan_limit` past the allowance, `unsupported_schedule` for a schedule that cannot run; `null` when scheduled | The response's `allowance` carries the Space's `simple` and `advanced` counts and `upgrade`, the step that unlocks more: `upgrade_plan`, `upgrade_or_boost`, `boost`, or `null` when there is none. See [`sf crons`](/cli/reference/crons#sf-crons) in the CLI reference for full flags. +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/database.mdx b/content/(build)/database.mdx index 8f897f6f..b86ab5d8 100644 --- a/content/(build)/database.mdx +++ b/content/(build)/database.mdx @@ -47,9 +47,9 @@ export default async function Blog() { When trusted server code needs to bypass visitor filters explicitly, call `.system` on the kind (for example, `posts.system.list({ limit: 100 })` or `posts.system.get(id)`). -### Trusted Drizzle-inspired ORM (`db`) +### Trusted typed ORM (`db`) -Inside server actions, hooks, and background jobs, you can also use the Drizzle-inspired `db` API to run typed queries and mutations directly: +Inside server actions, hooks, and background jobs, you can also use the typed `db` API to run typed queries and mutations directly: ```ts sp/app/page.tsx import { db } from "spacepress"; @@ -99,7 +99,7 @@ SpacePress evaluates access rules on an ordered role ladder: `guest < subscriber - **Migrations:** Commit each generated migration folder under `sp/_generated/migrations/`. SpacePress folds `ops.json` files in order and writes a new numbered migration folder whenever a `table()` schema changes. Removing a column or table retires it while preserving stored data. - **Safe renames:** Keep physical SQL names intact with `.column("old_name")` and `storageName: "old_table"`, and accept old API field names with `.alias("oldName")`. -- **Soft deletes and revisions:** Configure `retention` (`"forever"` by default, or durations like `"30d"` and `keepLast`) and query soft-deleted rows with `deleted: "exclude" | "include" | "only"`. +- **Soft deletes and revisions:** Both `collection()` and `table()` turn on soft deletes and native revisions by default, with `"forever"` retention unless you opt into `retention` (such as `deleted: "90d"` or `revisions: { keepLast: 50, maxAge: "365d" }`). Query soft-deleted rows with `deleted: "exclude" | "include" | "only"`, and inspect or restore history with `kind.revisions.{list,get,diff,restore}`. See [Collections and CMS](/collections#native-revisions-and-optimistic-concurrency). ## Inspect tables and rows @@ -138,7 +138,7 @@ sf db console --show-secret Spacefast takes automatic MySQL backups for every Space. Personal runs daily backups with a 7-day self-service restore window; Go runs hourly backups with 7-day restore; Pro and Enterprise run hourly backups with 30-day restore. See [Backups, archives, and exports](/exports) for full Space exports and restore details. -For Spaces running an existing [Zero 0.8](/zero-migration) capsule, `sf db export` walks every declared table in stable 500-row keyset pages through `GET /v1/spaces/{spaceId}/db/export` and writes one atomic JSON backup (`mode 0600`): +For Spaces running an existing [Zero 0.8](/guides/zero-migration) capsule, `sf db export` walks every declared table in paginated 500-row batches through `GET /v1/spaces/{spaceId}/db/export` and writes one atomic JSON backup (`mode 0600`): ```bash sf db export @@ -149,7 +149,7 @@ Without `--output`, Spacefast writes `spacefast-backup--.json` ## Legacy Zero 0.8 schema commands -The declared-schema commands (`sf db`, `sf db dump`, `sf db migrate`, and `sf db export`) apply only to existing [Zero 0.8](/zero-migration) capsules that declare a capsule schema. Running them against a Worker returns [`runtime_kind_mismatch`](/errors/runtime_kind_mismatch), and running them against a static Space returns [`db_not_available`](/errors/db_not_available). Use `sf db tables`, `sf db rows`, and `sf db console` instead for Workers and SpacePress apps. +The declared-schema commands (`sf db`, `sf db dump`, `sf db migrate`, and `sf db export`) apply only to existing [Zero 0.8](/guides/zero-migration) capsules that declare a capsule schema. Running them against a Worker returns [`runtime_kind_mismatch`](/errors/runtime_kind_mismatch), and running them against a static Space returns [`db_not_available`](/errors/db_not_available). Use `sf db tables`, `sf db rows`, and `sf db console` instead for Workers and SpacePress apps. ```bash sf db @@ -188,3 +188,6 @@ sf db migrate | [`migrateSpaceDatabase`](/api/reference/database/migratespacedatabase) | `POST /v1/spaces/{spaceId}/db/migrate` | See [`sf db`](/cli/reference/db#sf-db-target) in the CLI reference for every subcommand and flag. +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/email.mdx b/content/(build)/email.mdx index a3594fdc..a862c4ad 100644 --- a/content/(build)/email.mdx +++ b/content/(build)/email.mdx @@ -120,7 +120,7 @@ Workers do not expose a direct `env.EMAIL` binding. To send transactional email - **Call an app action through `env.SPACE`:** Define a `mail.send()` action in your Space's app and invoke it from your Worker with `await env.SPACE.action("notify", payload)` (`env.APP` remains available as an alias). - **Call an external email API:** On a claimed Space, a Worker can send directly through any third-party email API using outbound `fetch()`. -Existing [Zero 0.8](/zero-migration) apps continue calling `ctx.email.send()`; in local `sf dev`, calling `ctx.email` without a configured local email service returns [`zero_email_unavailable`](/errors/zero_email_unavailable). +Existing [Zero 0.8](/guides/zero-migration) apps continue calling `ctx.email.send()`; in local `sf dev`, calling `ctx.email` without a configured local email service returns [`zero_email_unavailable`](/errors/zero_email_unavailable). ## Limits diff --git a/content/(build)/environment-variables.mdx b/content/(build)/environment-variables.mdx index a0c8ae4c..cd693588 100644 --- a/content/(build)/environment-variables.mdx +++ b/content/(build)/environment-variables.mdx @@ -105,7 +105,7 @@ export async function POST( } ``` -For Spaces running an app, run `sf app env` ([`sf app env`](/cli/reference/app#sf-app-env)) to inspect scoped app environment variables (secrets masked by default; pass `--reveal` for plaintext). Existing [Zero 0.8](/zero-migration) apps read the same values from `ctx.env`, and also accept `.env.lakebed.server` (which acts as the full Space-scope list and deletes omitted Space variables on publish). +For Spaces running an app, run `sf app env` ([`sf app env`](/cli/reference/app#sf-app-env)) to inspect scoped app environment variables (secrets masked by default; pass `--reveal` for plaintext). Existing [Zero 0.8](/guides/zero-migration) apps read the same values from `ctx.env`. An anonymous first publish, before you have an account, syncs nothing and reports `skipped: "anonymous"`. @@ -166,4 +166,7 @@ Team variables live at [**Variables**](https://my.spacefast.com/?to=/:team/varia | [`setTeamVariable`](/api/reference/variables/setteamvariable) | `PUT /v1/teams/{teamId}/variables/{name}` | | [`deleteTeamVariable`](/api/reference/variables/deleteteamvariable) | `DELETE /v1/teams/{teamId}/variables/{name}` | -Each mutation returns a nullable `operation` handle for the debounced re-finalize it coalesced into. See [`sf env`](/cli/reference/env#sf-env) in the CLI reference for full command options. +Each mutation returns a nullable `operation` handle for the batched update operation. See [`sf env`](/cli/reference/env#sf-env) in the CLI reference for full command options. +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/functions.mdx b/content/(build)/functions.mdx index e691e03e..274cfa7d 100644 --- a/content/(build)/functions.mdx +++ b/content/(build)/functions.mdx @@ -177,3 +177,6 @@ sf logs runtime --handler checkout ``` Everything your Worker logs appears in the runtime log stream with the handler name and request ID on each line. See [Logs](/logs) for filters, retention, and paging, and [`sf functions`](/cli/reference/functions#sf-functions) in the CLI reference. +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/meta.ts b/content/(build)/meta.ts index bbba2574..7532d362 100644 --- a/content/(build)/meta.ts +++ b/content/(build)/meta.ts @@ -8,6 +8,7 @@ export default defineMeta({ "collections", "actions", "database", + "users", "wordpress", "functions", "email", @@ -15,6 +16,5 @@ export default defineMeta({ "crons", "environment-variables", "connectors", - "zero-migration", ], }); diff --git a/content/(build)/object-storage.mdx b/content/(build)/object-storage.mdx index 950e1727..b45198fd 100644 --- a/content/(build)/object-storage.mdx +++ b/content/(build)/object-storage.mdx @@ -119,3 +119,6 @@ A Space whose runtime is not reachable answers `503` with [`runtime_management_u | [`deleteSpaceStorageObject`](/api/reference/spaces/deletespacestorageobject) | `DELETE /v1/spaces/{spaceId}/storage/{objectId}` | Listing requires the `versions:read` scope. As the Space owner, you can download or delete any object, including private ones a visitor uploaded. See [`sf storage`](/cli/reference/storage#sf-storage-target) in the CLI reference for every flag. +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/users.mdx b/content/(build)/users.mdx new file mode 100644 index 00000000..66a7492e --- /dev/null +++ b/content/(build)/users.mdx @@ -0,0 +1,77 @@ +--- +title: App users +description: Add Google, Gravatar, or Spacefast sign-in to a Space app, protect per-user data, and manage app accounts and sessions +--- + +Use **Users** to add end-user accounts to your Space app and manage the people who sign in. Each Space holds its own accounts, verified email addresses, connected identities, and sessions. + +**Users** manages accounts inside your application. [Share and access](/share) controls who can open or administer the Space itself. Creating an app account never adds someone to your team or grants a Space permission. + +## Enable app sign-in + +Open your Space in the dashboard, choose **Users**, turn on **Enable app sign-in**, and save. You can save this setup before the first publish; it takes effect through normal publishes and settings updates, and the account directory stays readable even when sign-in is off. + +Choose the providers your app offers: + +| Method | Behavior | +| --- | --- | +| **Google (Managed by Spacefast)** | Uses Spacefast's Google connection with no Google app credentials in your project. The dashboard notes when managed Google is unavailable. | +| **Google (Use my Google app)** | Uses the Google client ID and client secret you configure for this Space. | +| **Gravatar** | Uses the Gravatar sign-in flow when enabled for your environment. | +| **Spacefast** | Uses Sign in with Spacefast. An app login never creates a Space access grant. | + +### Use your own Google app + +Choose **Use my Google app**, copy the **Google redirect URI** from the dashboard into your Google app's authorized redirect URIs, and enter its client ID and secret. If visitors sign in on another connected custom domain, register that domain's matching callback URL with Google too. + +The client secret is write-only. Leaving the field blank keeps the saved value, and **Remove saved Google secret** clears it. Keep this secret out of source files and environment variables. + +## Sign in from SpacePress apps + +In a [SpacePress](/build) app, Sign in with Spacefast is built in. Link visitors to `/__spacefast/sign-in?return=/path/` and Spacefast returns them signed in, available as `ctx.user` inside `(input, ctx)` queries, mutations, and access rules. Run `sf add auth` to scaffold sign-in pages into your project. + +Protect data on the server, never only in the browser: + +- Read visitor-scoped records through `"spacepress/server/db"`, which enforces every collection and table `access` rule as the signed-in visitor. +- Limit rows to their owner with a filter such as `read: ({ user }) => (user ? { ownerId: user.id } : false)` and hide private fields with `.access({ read: "admin" })`. +- Use trusted `db` from `"spacepress/server"` or `.system` only inside a mutation or job after checking `ctx.user`. Never trust a user ID sent from the browser or treat an email address as an account key. + +Hosted account management lives at `/identity/account`. Keep `/identity` and its child paths free for sign-in flows, callbacks, and account settings. + +An account belongs to one Space. Changing the Space's hostname does not create a new account, and the same email address on another Space is a separate account. Linking another provider requires the account's own linking flow; a matching email alone never merges accounts. + +## Manage accounts and sessions + +The **Accounts** list supports search and shows each account's status. Open an account to inspect its verified emails, connected identities, and active sessions: + +- **Suspend account** stops the account from signing in or calling authenticated routes. **Reactivate** restores a suspended account. +- **Sign out** revokes a single session. **Sign out everywhere** revokes every session for that account on this Space. +- **Deletion requested** indicates the person asked for erasure. **Complete requested deletion** removes personal data and credentials while keeping anonymous content authorship. Accounts pending deletion cannot be reactivated, and completed deletions leave the directory. + +Visitors manage their own emails and sign-in methods at **Account settings**. Space managers can inspect verified addresses, but cannot mark an unverified address as verified through the Users API. + +## Manage Users through the CLI or API + +Select the Space explicitly or run inside a linked project directory: + +```bash +sf api GET /v1/spaces/spc_4a7f9c2e8b1d0a6f5c3e9d2b7a1f8e4c/users +sf api GET /v1/spaces/spc_4a7f9c2e8b1d0a6f5c3e9d2b7a1f8e4c/users/settings +``` + +Read `GET /v1/spaces/{spaceId}/users/settings` ([`getSpaceUsersSettings`](/api/reference/spaces/getspaceuserssettings)) before updating settings with [`updateSpaceUsersSettings`](/api/reference/spaces/updatespaceuserssettings), and pass the returned `settingsDigest` as `baseSettingsDigest` so concurrent edits cannot overwrite each other silently. + +| Action | Operation | Route | +| --- | --- | --- | +| List accounts | [`listSpaceUsers`](/api/reference/spaces/listspaceusers) | `GET /v1/spaces/{spaceId}/users` | +| Inspect one account | [`getSpaceUser`](/api/reference/spaces/getspaceuser) | `GET /v1/spaces/{spaceId}/users/{userId}` | +| Suspend or reactivate | [`setSpaceUserSuspended`](/api/reference/spaces/setspaceusersuspended) | `PATCH /v1/spaces/{spaceId}/users/{userId}` | +| List account sessions | [`listSpaceUserSessions`](/api/reference/spaces/listspaceusersessions) | `GET /v1/spaces/{spaceId}/users/{userId}/sessions` | +| Revoke account sessions | [`revokeSpaceUserSessions`](/api/reference/spaces/revokespaceusersessions) | `POST /v1/spaces/{spaceId}/users/{userId}/sessions/revoke` | +| Complete requested deletion | [`completeSpaceUserDeletion`](/api/reference/spaces/completespaceuserdeletion) | `POST /v1/spaces/{spaceId}/users/{userId}/deletion` | + +These are Space management operations and require a manager session or a scoped [API key](/api-keys). An end-user app session cannot administer the Users directory. + +## CLI, API, MCP, and SDK + + diff --git a/content/(build)/wordpress.mdx b/content/(build)/wordpress.mdx index 6c43377a..395a615d 100644 --- a/content/(build)/wordpress.mdx +++ b/content/(build)/wordpress.mdx @@ -1,17 +1,20 @@ --- title: WordPress and Content API description: Open SpacePress Admin, call your Space's WordPress REST API and Abilities, run three-way content sync, use generated typed clients, and run allowlisted WP-CLI commands -sidebar: - badge: Labs --- -Labs + -Every SpacePress Space runs native WordPress alongside your TypeScript code, with no servers or plugins to maintain by hand. Open SpacePress Admin at `/wp-admin/new/`, call your Space's WordPress REST API and Abilities, reconcile Markdown files with live posts, or run allowlisted WP-CLI commands with `sf app wp`. +Spacefast uses WordPress and SpacePress as a managed application server, not a general-purpose WordPress server: no custom origin code runs outside SpacePress. Spacefast maintains WordPress core and the built-in capabilities SpacePress needs (block editor, custom fields, background jobs, redirects, and WooCommerce when enabled). You cannot run arbitrary PHP, install or upload third-party WordPress plugins or theme ZIPs, edit files in `wp-admin`, or connect over SSH; see [Managed SpacePress boundaries](/build#spacepress-is-managed-on-spacefast). + +Open SpacePress Admin at `/wp-admin/new/`, call your Space's WordPress REST API and Abilities, reconcile Markdown files with live posts, or run allowlisted WP-CLI commands with `sf app wp`. ## Open SpacePress Admin and one-use sign-in links -SpacePress Admin (`/wp-admin/new/`) uses the WordPress block editor, typed REST fields, and the access rules from your schema. Classic `/wp-admin/` stays available when you need core WordPress screens or WooCommerce settings. +SpacePress Admin (`/wp-admin/new/`) uses the WordPress block editor, typed REST fields, and the access rules from your schema. Classic `/wp-admin/` stays available for core WordPress screens, **Comments** moderation, Media Library, Site Editor, and WooCommerce settings (plugin/theme install screens, the Customizer, and file editors stay disabled). + +- **Real-time collaborative editing:** Spacefast enables managed Gutenberg real-time collaboration on eligible documents so editors with edit access share one live draft and see each other's cursors and edits. While people have a context document open in the editor, agent writes via `POST /wp/v2/pages/{id}` return `409 content_context_live_editing`; retry after they finish. +- **Custom admin screens (`adminScreen()`):** Export `adminScreen()` definitions from `sp/` to add typed `DataViews` tables, grids, or lists and `DataForm` forms directly inside SpacePress Admin, wired to your queries and actions. Two API endpoints mint one-use sign-in URLs for the editor: @@ -110,12 +113,43 @@ sf apply - **[`sf app env`](/cli/reference/app#sf-app-env):** Prints scoped Space, SpacePress, and WordPress environment variables with secrets masked by default. Pass `--reveal` to print plaintext values or `--format dotenv` for dotenv output. - **[`sf app wp`](/cli/reference/app#sf-app-wp) and [`runSpaceWpCliCommand`](/api/reference/spaces/runspacewpclicommand) (`POST /v1/spaces/{spaceId}/wp-cli`):** Runs allowlisted WP-CLI commands against your Space's WordPress (or a local WordPress install with `--local` / `--path`), writing every remote run to the Space's [activity log](/activity). - - **Allowed:** Safe read/inspect commands, bounded maintenance (`cache`, `rewrite`, `transient`, `cron event`), and `spacepress *`. - - **Refused (`wp_cli_command_not_allowed`):** Arbitrary execution (`eval`, `shell`), direct database or config edits (`db`, `config`), and plugin, theme, or user writes (`plugin install`). - - **Recovery mode:** Pass `--mode limited` remotely to skip the site's themes and plugins when a broken theme or plugin blocks a normal run. + - **Allowed:** `core version`, `option get`/`list`, `post`/`term`/`user` `get`/`list`, `plugin`/`theme` `list`/`status`, `rewrite list`/`flush`, `cache flush`, `transient get`/`delete`, `cron event list`/`run`, `site list`, and `spacepress *`. + - **Refused (`wp_cli_command_not_allowed`):** Arbitrary execution (`eval`, `eval-file`, `shell`), direct database or config access (`db`, `config`), plugin, theme, or user writes (`plugin install`, `theme install`, `user create`), and unsafe global flags (`--exec`, `--require`, `--ssh`, `--http`, `--extra-php`, `--config`, `--path`). + - **Recovery mode:** Pass `--mode limited` remotely to skip the site's themes and plugins when a broken app build blocks a normal run. - **Remote output:** Remote runs return `output: null` because the runtime exposes no stdout channel. - **[`sf apply`](/cli/reference/apply#sf-apply):** Pushes saved Space and runtime changes onto the live runtime (`POST /v1/spaces/{spaceId}/apply`) and checks live apply state (`GET /v1/spaces/{spaceId}/apply-state` — `pending`, `applying`, `live`, or `failed`). Pass `--no-wait` to return immediately with the operation handle. ## Themes and `theme.json` SpacePress pages rendered with `template = "theme"` mount inside your block theme's **Page content** block (``), so editors can adjust headers and footers in the WordPress Site Editor. Spacefast also reads a WordPress-compatible `theme.json` up to 64 KiB at your project root to infer palette colors and font families for system pages. See [Customization and error pages](/customization). + +## Build from an external WordPress site + +You can also point a Space's repository build at any public WordPress site as a read-only data source. Nothing is copied into the Space and nothing is written back; Spacefast injects `WORDPRESS_URL` and `SPACEFAST_DATA_SOURCES` into repository builds so your frontend fetches over `/wp-json/` and publishes static output. Data sources apply only to repository builds (see [Publish from Git](/git)) and live in Space settings rather than `spacefast.config.ts` or `sf.jsonc`. + +Configure up to 32 named HTTPS sources in the dashboard under **Settings → Data sources**, or write `config.dataSources` and `config.defaultDataSource` with [`updateSpace`](/api/reference/spaces/updatespace) and read them back with [`listSpaceDataSources`](/api/reference/spaces/listspacedatasources). Defining your own `SPACEFAST_DATA_SOURCES` build variable suppresses the generated map; defining `WORDPRESS_URL` alone overrides only the default URL. + +Read configured sources directly with `fetch()` against `${process.env.WORDPRESS_URL}/wp-json/wp/v2/posts`, or use `@spacefast/wordpress`: + +```ts +import { createWordPressClient } from "@spacefast/wordpress"; + +const wp = createWordPressClient(); +const { data: posts } = await wp.posts.list({ perPage: 100 }); +const about = await wp.pages.bySlug("about"); +``` + +`createWordPressClient()` reads `WORDPRESS_URL` and falls back to the default entry in `SPACEFAST_DATA_SOURCES` (pass `{ source: "docs_site" }` for another named source). The external site must serve `/wp-json/` with pretty permalinks enabled. + +### Rebuild when content changes + +To rebuild the connected repository automatically when editors publish or update content on the external WordPress site: + +1. Download [`spacefast-wordpress.zip`](https://github.com/spacefast/wordpress/releases/latest/download/spacefast-wordpress.zip) (requires WordPress 6.5 and PHP 8.1 or newer), install it, and activate it. +2. Open **Settings → Spacefast**, expand **Use WordPress as a CMS for a repository site**, sign in to Spacefast, authorize a team, and pick the target Space. + +Picking a Space saves the site as the default `wordpress` source (replacing any existing source named `wordpress`), copies site title, description, and search visibility, and queues a production build. Subsequent published post, page, media, term, menu, or user changes wait through a 60-second quiet window before starting one production build on the Space's saved production branch. Drafts and revisions do not trigger builds, and **Build now** skips the wait. Delivery runs through WP-Cron (configure a scheduled hit to `wp-cron.php` if `DISABLE_WP_CRON` is set; check **Tools → Site Health** for stuck deliveries). + +## CLI, API, MCP, and SDK + + diff --git a/content/(deploy)/channels.mdx b/content/(deploy)/channels.mdx index 35570a89..9ed093cf 100644 --- a/content/(deploy)/channels.mdx +++ b/content/(deploy)/channels.mdx @@ -85,10 +85,7 @@ Channel history reads from the Space's promotion activity events, so your team's ## Visual reviews and screenshots -When you or an agent want to inspect a built version visually before promoting it, the API provides temporary visual reviews and captured screenshots: - -- **Temporary visual reviews**: Call [`createSpaceVersionVisualReview`](/api/reference/versions/createspaceversionvisualreview) (`POST /v1/spaces/{spaceId}/versions/{versionId}/visual-reviews`) to open a version-bound review session that expires after one hour. Its browser URL is a secret review capability and stays separate from persistent [Comments](/comments). Read the pinned preview target with [`getSpaceVisualPreview`](/api/reference/spaces/getspacevisualpreview), fetch an initial page screenshot with [`getSpaceVersionVisualScreenshot`](/api/reference/versions/getspaceversionvisualscreenshot), submit a one-shot feedback batch with [`submitVisualReview`](/api/reference/spaces/submitvisualreview), and read submitted notes with [`getVisualReview`](/api/reference/spaces/getvisualreview). -- **Space thumbnails and social cards**: Read a live Space's captured thumbnail with [`getSpaceThumbnail`](/api/reference/spaces/getspacethumbnail) (`GET /v1/spaces/{spaceId}/thumbnail`, public for public Spaces and credential-gated for private ones), or fetch a `1200x630` public page social card (`og:image`) with [`getPageScreenshot`](/api/reference/spaces/getpagescreenshot) (`GET /v1/screenshots/page`; returns `503` with `Retry-After` while rendering). +Open a temporary one-hour visual review on any ready version to capture annotated notes and PNG screenshots before promoting it to `live`, or fetch Space thumbnails and `1200x630` social cards. See [Visual reviews](/visual-reviews) for every endpoint and error code. ## Error codes @@ -98,3 +95,7 @@ When you or an agent want to inspect a built version visually before promoting i | [`channel_pointer_moved`](/errors/channel_pointer_moved) | Another promotion moved the channel pointer while yours was in flight | Re-read the channel pointer and retry | | [`channel_name_reserved`](/errors/channel_name_reserved) | The channel name collides with a reserved `v` or `ver-` hostname suffix | Choose a different channel name | | [`promotion_runtime_publish_incomplete`](/errors/promotion_runtime_publish_incomplete) | The promotion was accepted, but its runtime publish did not finish; `live` is unchanged | Retry the promotion | + +## CLI, API, MCP, and SDK + + diff --git a/content/(deploy)/ci.mdx b/content/(deploy)/ci.mdx index 0c600dd6..9f6834ca 100644 --- a/content/(deploy)/ci.mdx +++ b/content/(deploy)/ci.mdx @@ -5,7 +5,7 @@ description: Run sf publish from GitHub Actions or GitLab CI with a deploy token A CI pipeline can publish pushes to your production branch. Use `--target preview` for pull requests to leave the `live` channel unchanged; an ordinary publish can move it. -## Set it up +## Create a CI credential @@ -54,7 +54,7 @@ A CI pipeline can publish pushes to your production branch. Use `--target previe Manage existing deploy tokens with [`sf deploy-tokens list`](/cli/reference/deploy-tokens#sf-deploy-tokens-list), [`sf deploy-tokens update`](/cli/reference/deploy-tokens#sf-deploy-tokens-update-id) (change target, paths, or expiry without changing the secret), [`sf deploy-tokens rotate`](/cli/reference/deploy-tokens#sf-deploy-tokens-rotate-id), and [`sf deploy-tokens revoke`](/cli/reference/deploy-tokens#sf-deploy-tokens-revoke-id). Pass `--show-secret` when scripting creation or rotation with `--json`. -## The workflow +## Workflow examples @@ -158,8 +158,12 @@ The fields a script usually checks: | `data.next.action` | `done` when there is nothing left to do | | `data.diagnostics` | Dropped paths, warnings, and `noop_publish` | -A publish whose files reproduce the live version byte for byte creates no version and reports the `noop_publish` diagnostic. That is a success, not a failure. The whole receipt is documented on [Publishing](/publish). +A publish whose files reproduce the live version byte for byte creates no version and reports the `noop_publish` diagnostic. That is a success, not a failure. The whole receipt is documented on [Publishing](/publish). To notify downstream systems automatically when a build or publish completes, configure [Webhooks](/api/webhooks). ## Rate limits Publishing is capped per hour, both per person or API key and per account, with the numbers set by your plan. A pipeline that publishes on every push to a busy repository can reach them. A `429` carries `Retry-After` in seconds. See [Rate limits](/api/rate-limits). + +## CLI, API, MCP, and SDK + + diff --git a/content/(deploy)/git.mdx b/content/(deploy)/git.mdx index f7549e0b..ec051804 100644 --- a/content/(deploy)/git.mdx +++ b/content/(deploy)/git.mdx @@ -134,7 +134,7 @@ sf git build --space docs --ref main --target production --wait The platform builds your repository and publishes the output. It detects the framework and fills in the commands, so an unconfigured repository usually works. -Detected presets include Astro, Next, Nuxt, SvelteKit, Remix, TanStack Start, Vite, Solid Start, Qwik, Angular, Ember, Gatsby, Docusaurus, Eleventy, VitePress, Nextra, Hugo, Jekyll, Zola, MkDocs, and Sphinx. See [Frameworks and builds](/guides/frameworks). +Detected presets include Astro, Next, Nuxt, SvelteKit, Remix, TanStack Start, Vite, Solid Start, Qwik, Angular, Ember, Gatsby, Docusaurus, VitePress, Nextra, Hugo, Jekyll, Zola, MkDocs, and Sphinx. See [Frameworks and builds](/guides/frameworks). Repository builds read `spacefast.config.ts` in the isolated build environment. Override build settings there or on the connection. `sf.jsonc` remains supported; TypeScript takes precedence when both files exist. See [Project configuration](/config-file) for imports, migration, and file precedence. @@ -194,7 +194,22 @@ sf git github repos --space docs `sf git update` takes `--clear-credential` to remove a stored token, and passing it together with `--credential` is a validation error. `sf git disconnect` confirms first. Disconnecting stops pushes from building the Space. What is already published stays live and your domains do not move. The repository itself is untouched. -## Two connection-type vocabularies +## Source workspaces and GitHub export + +When an agent or tool needs to edit a Space's hosted Git repository without cloning it locally, use **Source Workspaces** over the API (no external Git repository required): + +| Operation | Route | What it does | +| --- | --- | --- | +| [`createSpaceSourceWorkspace`](/api/reference/git/createspacesourceworkspace) | `POST /v1/spaces/{spaceId}/source/workspaces` | Open a durable server-side workspace (pass a unique `operationId` to make retries safe) | +| [`listSpaceSourceWorkspaces`](/api/reference/git/listspacesourceworkspaces) / [`getSpaceSourceWorkspaceStatus`](/api/reference/git/getspacesourceworkspacestatus) | `GET /v1/spaces/{spaceId}/source/workspaces` (`/{workspaceId}`) | List open workspaces or inspect changed, staged, and conflicted paths | +| [`editSpaceSourceWorkspaceFiles`](/api/reference/git/editspacesourceworkspacefiles) / [`restoreSpaceSourceWorkspaceFiles`](/api/reference/git/restorespacesourceworkspacefiles) | `POST .../workspaces/{workspaceId}/files` (`/restore`) | Write, delete, or restore files inside the workspace | +| [`stageSpaceSourceWorkspaceChanges`](/api/reference/git/stagespacesourceworkspacechanges) / [`unstageSpaceSourceWorkspaceChanges`](/api/reference/git/unstagespacesourceworkspacechanges) | `POST .../workspaces/{workspaceId}/stage` (`/unstage`) | Stage or unstage paths for the next commit | +| [`getSpaceSourceWorkspaceDiff`](/api/reference/git/getspacesourceworkspacediff) / [`getSpaceSourceWorkspaceConflicts`](/api/reference/git/getspacesourceworkspaceconflicts) / [`resolveSpaceSourceWorkspaceConflicts`](/api/reference/git/resolvespacesourceworkspaceconflicts) | `GET .../diff`, `GET .../conflicts`, `POST .../resolve-conflicts` | Inspect diffs and resolve merge conflicts before committing | +| [`commitSpaceSourceWorkspaceChanges`](/api/reference/git/commitspacesourceworkspacechanges) / [`syncSpaceSourceWorkspace`](/api/reference/git/syncspacesourceworkspace) / [`prepareSpaceSourceWorkspaceUndo`](/api/reference/git/preparespacesourceworkspaceundo) / [`closeSpaceSourceWorkspace`](/api/reference/git/closespacesourceworkspace) | `POST .../commit`, `/sync`, `/undo`, `/close` | Commit changes, sync with upstream, prepare an undo, or close the workspace | + +To move a Space that started on Spacefast's hosted Git remote into GitHub later, call [`createSpaceGithubExport`](/api/reference/git/createspacegithubexport) (`POST /v1/spaces/{spaceId}/source/github-export`). It copies the hosted Git history into an empty GitHub repository and connects that repository as the Space's source while retaining the original hosted history. + +## Connection types for git vs. source commands The exact values each command family uses: @@ -204,3 +219,6 @@ The exact values each command family uses: | [`sf source list`](/cli/reference/source#sf-source-list), [`sf source cat`](/cli/reference/source#sf-source-cat-path), [`sf source diff`](/cli/reference/source#sf-source-diff), [`sf source branch`](/cli/reference/source#sf-source-branch), [`sf source merge`](/cli/reference/source#sf-source-merge-source-target), [`sf source tags list`](/cli/reference/source#sf-source-tags-list), [`sf source commits list`](/cli/reference/source#sf-source-commits-list) | `remote`, `push`, `import` | `remote` is the same thing as `connected`, `push` the same as `hosted`, and `import` is a one-off import remote | `--connection-type` defaults to `connected` on the `git` commands and to `remote` on most `source` commands. See the full flag lists under [`sf git`](/cli/reference/git#sf-git) and [`sf source list`](/cli/reference/source#sf-source-list). +## CLI, API, MCP, and SDK + + diff --git a/content/(deploy)/meta.ts b/content/(deploy)/meta.ts index 8cd9b40a..18573c50 100644 --- a/content/(deploy)/meta.ts +++ b/content/(deploy)/meta.ts @@ -1,3 +1,7 @@ import { defineMeta } from "blume"; -export default defineMeta({ title: "Deploy", collapsed: false, pages: ["publish", "channels", "versions", "git", "ci"] }); +export default defineMeta({ + title: "Deploy", + collapsed: false, + pages: ["publish", "channels", "visual-reviews", "versions", "git", "ci"], +}); diff --git a/content/(deploy)/publish.mdx b/content/(deploy)/publish.mdx index 1cb932cc..c0404f1f 100644 --- a/content/(deploy)/publish.mdx +++ b/content/(deploy)/publish.mdx @@ -7,7 +7,7 @@ A folder can be published from the CLI, dashboard, or API, and the receipt it re Only have a public website URL? [Copy the website](/guides/migrate) to Spacefast instead. -## The mental model +## How publishing works One publish is four steps. @@ -58,7 +58,7 @@ curl -X POST https://api.spacefast.com/v1/publish \ **Drop** takes a folder, a `.zip`, or a single `index.html`. Drag it onto [drop.fast](https://drop.fast), or select **Choose a folder** or **Choose files**. -- **Signed out:** Use **Anonymous drop**. Save the [claim link](/agents/anonymous-and-claim#claim-it) to keep the Space. +- **Signed out:** Use **Anonymous drop**. Save the [claim link](/agents/anonymous-and-claim#claim-an-anonymous-space) to keep the Space. - **Signed in:** Pick a **Team** and a **Destination**. For an **Existing space**, choose **Add & update** or **Replace all**. Progress runs **Prepare → Upload → Build → Go live**. @@ -67,7 +67,7 @@ Progress runs **Prepare → Upload → Build → Go live**. Publishing walks the directory and builds a manifest. Three things can happen to a path. -### Dropped without complaint +### Ignored files Some paths are dropped and counted instead of failing the publish. Exact names at any depth: @@ -116,7 +116,7 @@ The file count is a platform ceiling, and every claimed plan gets the same 100,0 Every plan publishes every file type. A PDF, a video, or a zip lands in the version like an HTML page does; only the size and count table above applies. -## Only changed bytes travel +## Incremental uploads Every declared file carries a `sha256`. The server compares your declaration against the version you are replacing, keeps the bytes it already has, and asks for the rest. The upload instructions come with a `summary` counting exactly that: @@ -133,7 +133,7 @@ Deleting a file means leaving it out of the declaration. There is no delete list `sf publish` defaults to `snapshot`. `POST /v1/publish` defaults to `additive`. Set it with `--publish-mode` or the `publishMode` field, and in the dashboard Drop it is the **Add & update** and **Replace all** choice. -## Nothing changed +## No-op publishes If your declaration reproduces the live version byte for byte, no version is created. The response comes back with a null version ID and one info diagnostic: @@ -145,7 +145,7 @@ That diagnostic is the only signal. There is no separate boolean. A file declared without a `sha256` can't be shown to be unchanged, so a manifest missing any hash always creates a new version. -## Waiting, or not +## Synchronous vs. asynchronous publishes A publish holds one HTTP request open while the work runs, up to a 240-second ceiling. Past that the receipt degrades to `next.action` of `poll` and the work carries on in the background. You did not lose the publish. @@ -217,6 +217,11 @@ An archive that needs a build returns a receipt with a `build` object and `next. Every code, and whether to retry it, is on [Error codes](/api/errors). + +## CLI, API, MCP, and SDK + + + ## Next steps For a standalone file, start with the [plain HTML recipe](/guides/recipes/html), or inspect every flag on [`sf publish`](/cli/reference/publish#sf-publish-dir). diff --git a/content/(deploy)/versions.mdx b/content/(deploy)/versions.mdx index 3a1a87c9..52a67d8e 100644 --- a/content/(deploy)/versions.mdx +++ b/content/(deploy)/versions.mdx @@ -5,7 +5,7 @@ description: Immutable versions, the live channel, promotion policies, and rollb A rollback points `live` back at a retained, ready version and doesn't rebuild it. By default it applies your current rewrites, which makes a new version from that version's files. Deleted or expired versions cannot be rollback targets. -## A version is a snapshot +## Immutable version snapshots A publish that changes files creates a version, an immutable snapshot of those files and the config they finalized with. Nothing modifies a version after it is ready. A publish with no changes can return `noop_publish` without creating a version. @@ -152,7 +152,7 @@ To browse rather than diff, [`listSpaceVersionFiles`](/api/reference/versions/li To compare two completed versions directly, call [`compareSpaceDeploymentVersions`](/api/reference/versions/comparespacedeploymentversions) (`GET /v1/spaces/{spaceId}/versions/compare`; reading file contents requires `versions:download`). To inspect the compiled `_redirects` and `_headers` artifacts a version serves, use [`listSpaceVersionConventionArtifacts`](/api/reference/versions/listspaceversionconventionartifacts) and [`getSpaceVersionConventionArtifactContent`](/api/reference/versions/getspaceversionconventionartifactcontent). -## Where each thing lives +## Storage by version vs. Space | Task | CLI | Dashboard | | --- | --- | --- | @@ -162,3 +162,8 @@ To compare two completed versions directly, call [`compareSpaceDeploymentVersion | Go back | [`sf rollback v12`](/cli/reference/rollback#sf-rollback-version) | **Roll back to** on [**Overview**](https://my.spacefast.com/?to=/:team/:space) | | Delete one | [`sf versions delete v12`](/cli/reference/versions#sf-versions-delete-version) | Version detail page | | Change promotion policy | [`sf channels set live --promotion manual`](/cli/reference/channels#sf-channels-set-name) | **Publishing** on **Versions**: **Automatic** or **Manual** | +## CLI, API, MCP, and SDK + + + + diff --git a/content/(deploy)/visual-reviews.mdx b/content/(deploy)/visual-reviews.mdx new file mode 100644 index 00000000..ac4030b8 --- /dev/null +++ b/content/(deploy)/visual-reviews.mdx @@ -0,0 +1,38 @@ +--- +title: Visual reviews +description: Open temporary one-hour review sessions on deployed Space versions, capture annotated PNG screenshots, and hand structured feedback back to an agent +--- + +Visual reviews open a temporary, version-bound browser session so you can inspect a deployed preview, annotate page elements with notes and PNG screenshots, and hand a single structured feedback batch back to an AI agent or teammate before promoting that version to `live`. + +Temporary visual reviews stay separate from persistent [Comments](/comments): each review expires after **one hour**, uses a private one-hour review link pinned to one Space version, and accepts one submitted feedback batch. + +## How a visual review works + +1. **Start a temporary visual review** for a ready version with [`createSpaceVersionVisualReview`](/api/reference/versions/createspaceversionvisualreview) (`POST /v1/spaces/{spaceId}/versions/{versionId}/visual-reviews`). Spacefast returns the `reviewId` and a secret one-hour browser review URL. +2. **Inspect the pinned deployment** via [`getSpaceVisualPreview`](/api/reference/spaces/getspacevisualpreview) (`GET /v1/spaces/{spaceId}/visual-preview`) or read an initial page screenshot with [`getSpaceVersionVisualScreenshot`](/api/reference/versions/getspaceversionvisualscreenshot) (`GET /v1/spaces/{spaceId}/versions/{versionId}/visual-screenshot`). +3. **Submit one annotated feedback batch** in the browser (or via [`submitVisualReview`](/api/reference/spaces/submitvisualreview), `POST /v1/visual-reviews/{reviewId}/submission`) with unique note IDs, selected page element context, and optional PNG screenshots (`captureStatus: "ready"` only when an image is attached). +4. **Read the feedback back** in your agent or workflow with [`getVisualReview`](/api/reference/spaces/getvisualreview) (`GET /v1/visual-reviews/{reviewId}`). Submitted notes stay readable after the one-hour review session expires; open a new review session for another round of annotations. + +## Space thumbnails and social cards + +Two read endpoints capture public or authorized visual snapshots outside a review session: + +| Endpoint | Operation | What it returns | +| --- | --- | --- | +| `GET /v1/spaces/{spaceId}/thumbnail` | [`getSpaceThumbnail`](/api/reference/spaces/getspacethumbnail) | Captured thumbnail of a live Space (public for public Spaces, credential-gated for private Spaces) | +| `GET /v1/screenshots/page` | [`getPageScreenshot`](/api/reference/spaces/getpagescreenshot) | `1200x630` social card (`og:image`) of a public page; returns `503` with `Retry-After` while rendering | + +## Error codes + +| Code | Cause | Recovery | +| --- | --- | --- | +| [`visual_review_expired`](/errors/visual_review_expired) | The one-hour temporary review session expired | Open a new review session for the version; already submitted feedback stays readable | +| [`visual_review_forbidden`](/errors/visual_review_forbidden) | The caller cannot access the review or its version | Use the account that started the review and confirm Space access | +| [`visual_review_submitted`](/errors/visual_review_submitted) | The review already received a different feedback batch | Read the existing submission or start a new visual review for follow-up notes | +| [`visual_review_invalid_note`](/errors/visual_review_invalid_note) | Duplicate note ID or `captureStatus: "ready"` without an attached image | Use unique note IDs and match `captureStatus` to whether an image is present | +| [`visual_review_invalid_image`](/errors/visual_review_invalid_image) | Attached screenshot is not a valid PNG payload | Re-capture as PNG or submit the note without an image | +| [`visual_review_context_too_large`](/errors/visual_review_context_too_large) | Selected DOM context exceeds the per-note limit | Select a smaller element and submit again | +| [`visual_review_too_large`](/errors/visual_review_too_large) | Total feedback batch exceeds the screenshot delivery limit | Remove one or more screenshots and submit again | + +See [Channels and previews](/channels) and the Space's [**Versions**](https://my.spacefast.com/?to=/:team/:space/versions) page to publish preview versions (`sf publish --target preview`) and promote verified builds to `live`. diff --git a/content/(get-started)/quickstart.mdx b/content/(get-started)/quickstart.mdx index d745708e..4e95b357 100644 --- a/content/(get-started)/quickstart.mdx +++ b/content/(get-started)/quickstart.mdx @@ -97,7 +97,7 @@ For interactive terminal setup, run [`npx -y spacefast setup`](/cli/reference/se ## Next -Add redirects, response headers, cache rules, or Workers in [`spacefast.config.ts`](/config-file). Working with other people? If your Space is still anonymous, [claim it first](/agents/anonymous-and-claim#claim-it). Signed-in publishes already belong to a team. Personal and Go allow only the owner; adding another member needs [Pro](/pricing). Then [invite members](/teams#invite-someone) to publish and roll back together. Owners and admins can manage domains and invitations. Choose whether new Spaces start private to the team or public in [team access settings](/teams#default-access-for-new-spaces). +Add redirects, response headers, cache rules, or Workers in [`spacefast.config.ts`](/config-file). Working with other people? If your Space is still anonymous, [claim it first](/agents/anonymous-and-claim#claim-an-anonymous-space). Signed-in publishes already belong to a team. Personal and Go allow only the owner; adding another member needs [Pro](/pricing). Then [invite members](/teams#invite-someone) to publish and roll back together. Owners and admins can manage domains and invitations. Choose whether new Spaces start private to the team or public in [team access settings](/teams#default-access-for-new-spaces). @@ -116,3 +116,7 @@ Add redirects, response headers, cache rules, or Workers in [`spacefast.config.t Publish from GitHub Actions or GitLab CI with an API key. + +## CLI, API, MCP, and SDK + + diff --git a/content/(get-started)/request-lifecycle.mdx b/content/(get-started)/request-lifecycle.mdx index 022e8183..68ec7fa4 100644 --- a/content/(get-started)/request-lifecycle.mdx +++ b/content/(get-started)/request-lifecycle.mdx @@ -5,24 +5,7 @@ description: The order Spacefast evaluates DNS, edge traffic rules, cache, routi Spacefast evaluates DNS, edge traffic rules, edge cache, routing rules, static files, and dynamic handlers in a fixed order. Response headers apply on the way out. Knowing this order tells you which rule wins when two features match the same URL. -```mermaid -flowchart TD - A["DNS and hostname resolution"] --> B["Traffic rules (firewall and cache bypass)"] - B -- "Firewall block or challenge" --> X["Return block or challenge"] - B -- "Allowed" --> C{"Edge cache (public GET/HEAD, not bypassed)"} - C -- "Hit" --> Z["Return cached response"] - C -- "Miss or bypassed" --> D["Redirects, rewrites, and proxies"] - D -- "Redirect (301/302/303/307/308)" --> H["Apply response headers"] - D -- "Proxy (200 to external URL)" --> P["Fetch upstream origin"] --> H - D -- "Rewrite or no match" --> E{"Access control (protected Spaces)"} - E -- "Denied" --> Y["Return sign-in or 403"] - E -- "Public or admitted" --> F{"Static file match"} - F -- "Matched GET/HEAD" --> H - F -- "Miss or worker-first route" --> G{"Worker or app handler"} - G -- "Handled" --> H - G -- "No route match" --> M["405, SPA fallback, or 404"] --> H - H --> R["Return response"] -``` + ## DNS and hostname resolution @@ -30,7 +13,7 @@ DNS routes your custom domain or `space.fast` hostname to Spacefast's edge, whic ## Traffic rules -Firewall rules evaluate first at the edge and can `block` or `challenge` a request before it reaches your Space. Edge traffic protection can also return HTTP `429` for excessive visitor traffic; see [Rate limiting](/infrastructure/rate-limiting) (management API calls follow a separate budget returning [`rate_limited`](/errors/rate_limited)). Cache-bypass rules decide whether a request skips the edge cache and goes straight to the Space. When you enable edge placement (`placement.edge`), eligible redirects and headers also run at the edge. See [Redirects and rewrites](/redirects). +Firewall rules evaluate first at the edge and can `block` or `challenge` a request before it reaches your Space. Edge traffic protection can also return HTTP `429` for excessive visitor traffic; see [Rate limiting](/traffic-rules#edge-rate-limiting-429-vs-capacity-599-and-challenges-403) (management API calls follow a separate budget returning [`rate_limited`](/errors/rate_limited)). Cache-bypass rules decide whether a request skips the edge cache and goes straight to the Space. When you enable edge placement (`placement.edge`), eligible redirects and headers also run at the edge. See [Traffic Rules and firewall](/traffic-rules). ## Edge cache diff --git a/content/(get-started)/spaces.mdx b/content/(get-started)/spaces.mdx index 98543111..b6923d0e 100644 --- a/content/(get-started)/spaces.mdx +++ b/content/(get-started)/spaces.mdx @@ -172,6 +172,11 @@ The one reversible case is a Space you deleted with its space key. [`restoreSpac A Space created by an anonymous publish expires {{anonymous-ttlSeconds}} after the latest publish that changes files and uses a single `sfc_` key. Claiming it moves it into a team and keeps its hostname. That whole path is on [Publish without an account](/agents/anonymous-and-claim). + +## CLI, API, MCP, and SDK + + + ## Next steps Use [`sf spaces`](/cli/reference/spaces#sf-spaces) in the CLI reference to find and manage Spaces from your terminal. diff --git a/content/(operate)/activity.mdx b/content/(operate)/activity.mdx index d0c8fbe6..48a53f9d 100644 --- a/content/(operate)/activity.mdx +++ b/content/(operate)/activity.mdx @@ -99,6 +99,8 @@ Personal alerts (such as comment replies, mentions, and access requests) appear - [`getNotificationUnreadCount`](/api/reference/account/getnotificationunreadcount) (`GET /v1/notifications/unread-count`): read the unread badge count. - [`markNotificationsRead`](/api/reference/account/marknotificationsread) (`POST /v1/notifications/read`): mark selected notifications, or all notifications, as read. +To push Spacefast events (publishes, builds, domains, access changes) directly to your own HTTP endpoint in real time, configure [Webhooks](/api/webhooks). + ## API operations | Operation | Route | @@ -109,3 +111,7 @@ Personal alerts (such as comment replies, mentions, and access requests) appear | [`createTeamActivityExport`](/api/reference/activity/createteamactivityexport) | `POST /v1/teams/{teamId}/activity/exports` | | [`getTeamActivityExport`](/api/reference/activity/getteamactivityexport) | `GET /v1/teams/{teamId}/activity/exports/{exportId}` | | [`downloadTeamActivityExport`](/api/reference/activity/downloadteamactivityexport) | `GET /v1/teams/{teamId}/activity/exports/{exportId}/download` | + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/comments.mdx b/content/(operate)/comments.mdx index 9713b87f..90d88e53 100644 --- a/content/(operate)/comments.mdx +++ b/content/(operate)/comments.mdx @@ -230,3 +230,7 @@ Allowing a website lets its visitors comment in this Space without an account. ` | Embed tickets | 30 per minute per IP address, 120 per minute per origin, 600 per minute per Space | A request over an embed rate limit fails with `rate_limited`. + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/exports.mdx b/content/(operate)/exports.mdx index d258d308..c475c9ed 100644 --- a/content/(operate)/exports.mdx +++ b/content/(operate)/exports.mdx @@ -27,7 +27,7 @@ sf db export my-space --output ./my-space-backup.json sf db export --port 4173 ``` -The CLI reads rows in stable keyset pages and replaces the destination file only after the export completes. Without `--output`, the CLI writes `spacefast-backup--.json`. +The CLI reads rows in paginated batches and replaces the destination file only after the export completes. Without `--output`, the CLI writes `spacefast-backup--.json`. Over HTTP, list exportable tables and read the schema fence with [`getSpaceDatabaseExport`](/api/reference/database/getspacedatabaseexport) (`GET /v1/spaces/{spaceId}/db/export`), then page through each table with [`getSpaceDatabaseExportPage`](/api/reference/database/getspacedatabaseexportpage) (`GET /v1/spaces/{spaceId}/db/export/{table}?schemaHash=...`). The `schemaHash` and opaque cursor prevent pages from being mixed across exports. @@ -114,3 +114,7 @@ sf spaces list --team acme --inactive-for 90 - Archived Spaces do not appear. Over HTTP, call [`listTeamInactiveSpaces`](/api/reference/teams/listteaminactivespaces) (`GET /v1/teams/{teamId}/inactive-spaces?days=90`). `days` defaults to 90. + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/feedback.mdx b/content/(operate)/feedback.mdx index 3e4dfe1a..68ec3f32 100644 --- a/content/(operate)/feedback.mdx +++ b/content/(operate)/feedback.mdx @@ -1,5 +1,5 @@ --- -title: Status, support, and feedback +title: Support and product feedback description: Reach Spacefast support and send bug reports or product feedback from the CLI, API, an agent, or the docs with error codes and request IDs attached --- @@ -145,3 +145,7 @@ Each docs page ends with **Was this page helpful?** and the buttons **Yes** and | `unauthorized` | 10 | `sf feedback list` or `inspect` with no credential | | `forbidden` | 11 | `sf feedback list` or `inspect` with a Space key, team API key, OAuth client key, or partner key | | `not_found` | 20 | The reference does not exist, or another person sent it | + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/infrastructure/automated-failover.mdx b/content/(operate)/infrastructure/automated-failover.mdx index b8bd1416..6171b429 100644 --- a/content/(operate)/infrastructure/automated-failover.mdx +++ b/content/(operate)/infrastructure/automated-failover.mdx @@ -1,26 +1,30 @@ --- title: Automated failover -description: How regional replicas keep Spaces available when an origin fails. +description: How real-time regional replication and graceful cache failover keep Spaces available when an origin fails. --- -Spaces run on infra with primary and secondary origin servers in different geographic data centers. Spacefast continuously replicates Space data between them and can move traffic when the primary server or its data center becomes unavailable. +Every Space runs on infra with primary and secondary origin servers in different geographic data centers. Real-time replication keeps the two servers synchronized so Spacefast can shift traffic automatically if the primary server or its data center becomes unavailable. -## What happens during failover +## Real-time replication -Spacefast monitors origin health and performance. When a failure requires a switch, it redirects traffic to the secondary origin. Once the primary is restored, traffic returns to it automatically. +The primary and secondary origin servers mirror each other, running the same software with synchronized data for every Space on the pool. Spacefast continuously replicates Space data from primary to secondary in real time. -You do not need to republish your Space or change its DNS records. The public address reaches the [edge network](/infrastructure/origin-edge-servers), which routes requests to the active origin. +Keeping the two copies in separate geographic data centers protects Spaces from localized hardware failures or data-center outages. -The active origin location and outbound IP address can change during a switch. Do not use either as a permanent identifier for your Space. See [IP ranges](/infrastructure/ip-ranges) before connecting an external service that requires an IP allowlist. +## Monitoring and traffic failover -## Cached responses during an origin error +Spacefast continuously monitors primary origin health and performance. When a failure or severe degradation requires a switch, traffic moves immediately to the secondary server in the paired data center. Once the primary is restored, traffic returns to it automatically. -Graceful failover is a separate protection. If an origin returns an HTTP 5xx error, the edge may serve an eligible cached response instead. It can keep an already cached page available while the origin has a problem. +You do not need to republish your Space or change its DNS records. The public address reaches the [edge network](/infrastructure/origin-edge-servers), which routes requests to whichever origin is active. -This does not repair application errors or create cached copies of responses that were never stored. Personalized pages, API calls that bypass the cache, and writes still depend on a working origin. See [Caching](/caching) for what Spacefast caches. +Because a failover changes the active origin location and outbound IP address, do not treat either value as a permanent identifier for your Space. See [IP ranges](/infrastructure/ip-ranges) before integrating with an external service that requires an IP allowlist. -## Data location +## Graceful failover for cached pages + +Graceful failover is separate from origin and data-center failover. If a code or runtime error causes an origin to return an HTTP `5xx` error, Edge Cache may serve an already cached version of the page instead. -The redundant copy lives in another region. An origin preference is not a guarantee that all Space data stays in one geographic location. Spacefast can store Space data in both the United States and the European Union. +Graceful failover keeps eligible cached pages available during an origin error, but it does not repair the underlying error or generate cached copies for responses that were never eligible and stored. Personalized pages, bypassed API calls, and writes still require a healthy origin. See [Caching](/caching) for what Spacefast caches. + +## Data location - +Because the redundant copy used for automated failover lives in a different region, an origin preference cannot restrict all Space data to one geography. Spacefast can store Space data in both the United States and the European Union. diff --git a/content/(operate)/infrastructure/ddos-protection.mdx b/content/(operate)/infrastructure/ddos-protection.mdx deleted file mode 100644 index 8d26f14e..00000000 --- a/content/(operate)/infrastructure/ddos-protection.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: DDoS protection -description: How edge routing, caching, and traffic classification protect your Space. ---- - -Spaces have platform-level protection against denial-of-service and distributed denial-of-service attacks. It operates without a setup step or a plugin in your Space. - -## Before traffic reaches your application - -Anycast routing distributes inbound requests across the edge network. The edge can serve eligible cached responses, classify suspicious traffic, and apply [rate limits](/infrastructure/rate-limiting) before requests consume origin resources. - -Spacefast monitors the network and adjusts protections as traffic changes. Caching and filtering can absorb repeated or unwanted requests, but they do not guarantee that every application remains available under every attack. - -## Browser challenges - -[Defensive Mode](/infrastructure/defensive-mode) adds browser challenges during suspected bot or DDoS activity. Certain suspicious traffic can also receive a challenge independently of Defensive Mode. - -A challenge normally returns HTTP `403`. A rate limit normally returns `429`. Inspect [edge request logs](/infrastructure/edge-request-logs) to distinguish them before changing your application. - -For a known unwanted pattern, Spacefast also supports traffic rules through `sf rules`. A firewall rule can block a request or ask for a browser challenge. The [CLI reference](/cli/reference/rules#sf-rules) lists the supported matches and actions. - -## During an incident - -Check whether legitimate visitors or integrations are failing, then preserve request samples. Include the affected hostname, UTC timestamp, URL, source IP address, complete `User-Agent`, and the response status when contacting Spacefast support. - -Send traffic directly to Spacefast's supplied DNS addresses where possible. An extra proxy can hide classification signals and change how visitors reach the edge. If you use one, include that detail in the incident report. - - diff --git a/content/(operate)/infrastructure/defensive-mode.mdx b/content/(operate)/infrastructure/defensive-mode.mdx deleted file mode 100644 index 96f61784..00000000 --- a/content/(operate)/infrastructure/defensive-mode.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Defensive Mode -description: Understand browser challenges and their effect on visitors and automated clients. ---- - -Defensive Mode challenges browsers before they reach a Space, reducing unwanted automated traffic. It is part of Spacefast's edge protection. - -A browser-check page does not, by itself, prove that Defensive Mode is active. Traffic classification and a Spacefast firewall rule can also trigger a challenge. - -## What visitors see - -Most challenges use an automated browser check. The visitor briefly sees a checking page, completes the check, and continues to the requested URL. The usual automated check can take up to five seconds. The platform can require a harder challenge with an action such as selecting a checkbox. - -Challenge responses use HTTP `403`. A client that cannot complete the challenge does not reach the requested page. HTTP `429` belongs to [rate limiting](/infrastructure/rate-limiting), a separate mechanism. - -API clients, webhooks, uptime monitors, and other automated services may be unable to solve a browser challenge. Test essential integrations when adding challenge rules. - -## What triggers a challenge - -| Trigger | Behavior | -| --- | --- | -| Manual Defensive Mode | Lasts from 30 minutes to seven days. Contact Spacefast support if site-wide protection is needed during an incident. | -| Automatic Defensive Mode | The infra can temporarily enable protection after a PHP resource-limit event. | -| Traffic classification | Suspicious or spoofed requests can be challenged even when Defensive Mode is off. | -| Spacefast firewall rule | A rule with the `challenge` action targets the request patterns you choose. | - -The platform challenge system cannot be fully disabled. Ending a manual mode or removing your own rule does not turn off classification challenges. - -For targeted rules, see [`sf rules`](/cli/reference/rules#sf-rules). These rules are separate from the site-wide Defensive Mode setting. - -## Help legitimate automation - -Send a specific, accurate `User-Agent`, such as `ExampleMonitor/1.0`. Do not impersonate a browser or a known crawler. Sending a Googlebot header from outside Google's network can itself trigger a spoofed-crawler challenge. - -An accurate header does not bypass protection. For a false positive, preserve the timestamp, source IP, full URL, and complete `User-Agent` from [edge request logs](/infrastructure/edge-request-logs), then contact Spacefast support. - - diff --git a/content/(operate)/infrastructure/domain-verification-records.mdx b/content/(operate)/infrastructure/domain-verification-records.mdx deleted file mode 100644 index dca04e15..00000000 --- a/content/(operate)/infrastructure/domain-verification-records.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Domain verification records -description: Publish the exact TXT records needed to prove control of a Space hostname. ---- - -Most hostnames need no verification record, because the address records are enough. A TXT record appears only when the hostname is already in use elsewhere. Copy the exact record names and values from your domain's setup instructions. - -## Get the records for your hostname - -```bash -sf domains add example.com --space my-site -sf domains diagnostics example.com --space my-site -``` - -The dashboard's domain setup also shows the required records. Add them wherever your DNS is managed. For the complete connection flow, see [Custom domains](/domains). - -There are two kinds, and they prove different claims. An `atomic-domain-…` record proves you control a hostname that another site on the same infra already uses. A `_spacefast-claim.` record moves a hostname away from another Space. Do not substitute one for the other or build a TXT value from an example. - -## When an `atomic-domain-` record is required - -A hostname already attached to a site elsewhere on the same infra, such as WordPress.com or Pressable, can require an extra TXT record before it can attach to Spacefast. Spacefast retrieves that proof and includes it in the DNS instructions. - -The upstream value starts with `atomic-domain-` and belongs at the exact hostname being verified. The apex `example.com` and `www.example.com` can require separate values. - -Publish only the currently required verification value at each hostname. Multiple distinct TXT values starting with `atomic-domain-` at the same hostname can prevent verification, even when one matches Spacefast's instructions. Remove a superseded `atomic-domain-` value when moving the hostname. Keep unrelated TXT records, including email authentication records. - -A CNAME cannot coexist with the required TXT record at the same hostname. Follow Spacefast's address-record instructions instead. - -## Check and retain the proof - -```bash -sf domains check example.com --space my-site -sf domains diagnostics example.com --space my-site -``` - -DNS propagation can delay a successful check. Inspect every hostname in diagnostics; a verified apex does not prove that `www` is ready. - -Keep required verification records after setup so future checks can still prove control. A domain's verification state, routing readiness, and [TLS certificate](/infrastructure/tls-certificates) state are separate. A TXT record alone does not make the hostname live. - - diff --git a/content/(operate)/infrastructure/edge-request-logs.mdx b/content/(operate)/infrastructure/edge-request-logs.mdx deleted file mode 100644 index d79b3b90..00000000 --- a/content/(operate)/infrastructure/edge-request-logs.mdx +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: Edge request logs -description: Inspect edge cache hits, rate limits, and browser challenges for a Space hostname. ---- - -Edge request logs show requests handled by the edge, including cached responses, rate limits, and browser challenges that may never reach your Space's origin. - -## Read edge requests - -```bash -sf logs edge --space my-site -sf logs edge --space my-site --hostname example.com --status 429 -sf logs edge --space my-site --status 403 --json -``` - -In the dashboard, open the Space's [**Logs**](https://my.spacefast.com/?to=/:team/:space/logs) and select the edge view. For application output and origin requests, use [Access and runtime logs](/logs). - -Each query covers one assigned hostname and defaults to the primary hostname. Use `--hostname` to inspect a different mapped domain. An apex and its `www` hostname are separate queries. - -## Filters and time windows - -| CLI flag | Selects | -| --- | --- | -| `--hostname` | One hostname assigned to the Space | -| `--remote-addr` | Client IPv4 or IPv6 address | -| `--ja3-hash` | JA3 TLS fingerprint, exactly 32 hexadecimal characters | -| `--method` | HTTP method, such as `GET` | -| `--status` | HTTP response status | -| `--user-agent` | Exact complete `User-Agent` value | -| `--asn` | Source network's autonomous system number | -| `--since`, `--until` | ISO 8601 timestamps for the query window | - -`--remote-addr`, `--ja3-hash`, `--method`, `--status`, `--user-agent`, and `--asn` can be repeated to include more values. `--hostname`, `--since`, and `--until` take one value each. Values within one field use OR; different fields use AND. - -The default window is the past hour. A query can span at most one hour within the past 24 hours, and your plan's retention can shorten that window. Results arrive newest first. Use smaller windows to investigate busy periods. - -## What a record contains - -Records include `timestamp`, `hostname`, `method`, `path`, `status`, client IP, user agent, country, timing, and `cacheStatus`. Rate-limit details appear in `rateLimited` and `rateLimitReason`. Browser-check details appear in `defensiveMode.cookieStatus`, `challengeReason`, and `challengeResult`. - -Some details can be `null`. Access credentials in request URLs are redacted. - -## Pagination and truncation - -Spacefast returns up to 100 entries per page through `GET /v1/spaces/{spaceId}/logs/edge`. Continue with `pagination.nextCursor`, or the CLI's `--cursor`. A cursor refers to a fixed snapshot and expires after five minutes; the original window and filters still apply. - -The underlying query can return at most 5,000 records. An `edge_logs_truncated` warning means the snapshot may omit matches. Paging cannot recover records absent from that snapshot. Narrow the time range or add filters. Reaching the end of a cursor does not prove you exported every matching request. - -For traffic trends, use [Stats](/stats). Edge logs are individual request records, not a complete analytics export or a live stream. - - diff --git a/content/(operate)/infrastructure/filesystem-permissions.mdx b/content/(operate)/infrastructure/filesystem-permissions.mdx index 5b91be1a..ff820f3d 100644 --- a/content/(operate)/infrastructure/filesystem-permissions.mdx +++ b/content/(operate)/infrastructure/filesystem-permissions.mdx @@ -1,32 +1,25 @@ --- title: Filesystem permissions -description: Understand PHP filesystem controls and how they differ from published versions and application data. +description: How immutable published versions differ from runtime storage and temporary read-only containment modes --- -A published Space version is an immutable snapshot. Changing files means publishing a new version. PHP filesystem permissions are a separate control over writes made by PHP web requests. +A published Space version is an immutable snapshot. Changing published files means publishing a new version. Runtime filesystem write controls are a separate platform-managed layer used for incident containment, not a config setting for everyday apps. -## What the infra control does +## Immutable versions vs. runtime data -Spacefast's infra has three PHP filesystem permission modes: +Keep published files and mutable application data separate: -| Value | Effect on PHP web requests | -| --- | --- | -| `rw` | PHP can read and write the Space's filesystem. This is the default. | -| `ro` | PHP can read files but cannot write them. Uploads, updates, and other file-writing operations can fail. | -| `loggedin` | Changes write behavior for some logged-in WordPress requests. The feature is evolving and requires testing against the Space's actual workflows. | +- **Published version files:** Immutable per version; update them with [Publishing](/publish) and roll back instantly with [Versions](/versions). +- **Structured records:** Store in [Database](/database). +- **User uploads and generated assets:** Store in [Object storage](/object-storage). -Spacefast sets the mode for every Space. There is no `sf.jsonc` field for it. Use [publish](/publish), [Database](/database), and [Storage](/object-storage) for the changes your application needs. +## Platform read-only containment -## Read-only files do not mean read-only data +During a security incident, Spacefast support can place a Space's runtime filesystem into temporary read-only mode so web requests can read files without writing to disk. -A PHP filesystem restriction does not make the database read-only or prevent WordPress administration from changing database content. It also does not change SSH or SFTP access controls. +Read-only containment does **not**: -For your Space, keep the two kinds of data separate. Published version files stay with their snapshot. Application records belong in [Database](/database), and mutable media belongs in [Storage](/object-storage). +- Make the database read-only or block database updates +- Remove existing malicious files or rotate compromised credentials -## Security incidents - -Read-only mode can help contain filesystem changes during an investigation. It does not remove malicious files or rotate compromised credentials. It can also break legitimate uploads, plugin updates, scheduled tasks, and integrations that write files. - -Contact Spacefast support before depending on an infra filesystem restriction. Check all affected application workflows after a policy change, including logged-out requests and background work. - - +Because read-only containment can interrupt runtime writes, scheduled tasks, and uploads, contact Spacefast support before relying on it and verify logged-out requests and background jobs after any change. diff --git a/content/(operate)/infrastructure/http-security-headers.mdx b/content/(operate)/infrastructure/http-security-headers.mdx deleted file mode 100644 index b902c8b0..00000000 --- a/content/(operate)/infrastructure/http-security-headers.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: HTTP and security headers -description: Set application security headers while leaving transport policy to the platform. ---- - -Set security headers for your published pages in `_headers` or the supported routing configuration. Spacefast manages transport headers, including HTTP Strict Transport Security, at the platform level. - -## Add a header policy - -Place `_headers` in the directory you publish. For example: - -```text _headers -/* - X-Content-Type-Options: nosniff - Referrer-Policy: strict-origin-when-cross-origin - X-Frame-Options: DENY -``` - -This example prevents MIME sniffing, limits referrer information, and blocks framing. If your page must appear inside another site, choose an appropriate framing policy before copying it. - -Publish the change with your Space. Rules apply to the URL the visitor requested, including when a rewrite serves another file. Matching header blocks accumulate. See [Headers](/headers) for ordering, removals, and validation. - -## Where each header is set - -| Header | What to know | -| --- | --- | -| `Content-Security-Policy` | Restricts scripts, frames, fonts, and other resources. Start with a report-only policy when practical and test required integrations. | -| `Access-Control-Allow-*` | Controls browser cross-origin access. Test the real requesting origin and any `OPTIONS` preflight. | -| `X-Frame-Options` | Controls framing. A restrictive policy can break embeds. | -| `X-Content-Type-Options` | Use `nosniff` to prevent MIME sniffing. | -| `Referrer-Policy` | Controls which referrer details accompany outgoing requests. | -| `Strict-Transport-Security` | Managed by the infra. Authored routing rules cannot replace it. | -| `Cache-Control` | Allowed for browser responses, with a platform-managed caching warning. Shared caching follows [Spacefast's caching rules](/caching). | - -Inspect the exact URL instead of assuming every response has the same headers. Application routes, published files, errors, and cached responses can take different paths. - -## Check the result - -```bash -curl -sS -D - -o /dev/null https://example.com/path/ -``` - -Test while logged out and repeat the request to inspect cached responses. A successful `curl` request does not prove that a browser permits a cross-origin response or that a Content Security Policy allows every required resource. Check the browser console and the application's real forms, scripts, embeds, and payment flows. - - diff --git a/content/(operate)/infrastructure/http-status-codes.mdx b/content/(operate)/infrastructure/http-status-codes.mdx index 58ece8fb..f3b2dc35 100644 --- a/content/(operate)/infrastructure/http-status-codes.mdx +++ b/content/(operate)/infrastructure/http-status-codes.mdx @@ -11,13 +11,13 @@ These behaviors apply to platform-generated responses and do not replace standar | Status | Spacefast platform behavior | | --- | --- | -| `403` | Blocked by an access or security control, a [Defensive Mode](/infrastructure/defensive-mode) browser challenge, or crawler verification. | +| `403` | Blocked by an access or security control, a [Defensive Mode](/traffic-rules#defensive-mode-and-browser-challenges) browser challenge, or crawler verification. | | `406` | Rejected by the edge web application firewall. | | `428` | Platform security or request-control response. | -| `429` | Rate limited at the edge or by Space admission limits. Because the edge intercepts `429` for platform rate limiting, it can replace a [Worker's](/functions) `429` JSON response and headers — including `Retry-After` — with a platform HTML page. | +| `429` | Rate limited at the edge or by Space admission limits. Because the edge intercepts `429` for platform rate limiting, it can replace a [Worker's](/functions) `429` JSON response and headers (including `Retry-After`) with a platform HTML page. | | `599` | Recorded internally in logs when a Space exhausts available origin compute capacity. Visitors typically receive HTTP `429`. | -Avoid assigning custom application meanings to `406`, `428`, or `599`, and do not rely on a custom JSON body or `Retry-After` header surviving a Worker-generated `429`. See [Rate limiting](/infrastructure/rate-limiting) for diagnosing `429` and `599` responses. +Avoid assigning custom application meanings to `406`, `428`, or `599`, and do not rely on a custom JSON body or `Retry-After` header surviving a Worker-generated `429`. See [Edge rate limiting](/traffic-rules#edge-rate-limiting-429-vs-capacity-599-and-challenges-403) for diagnosing `429` and `599` responses. ## Suspension, pause, and maintenance @@ -39,4 +39,4 @@ sf logs edge --space my-space --status 429 sf logs access --space my-space ``` -See [Edge request logs](/infrastructure/edge-request-logs), [Logs](/logs), and [`sf logs`](/cli/reference/logs#sf-logs-target-kind) for every flag. For Spacefast REST API error codes (`api.spacefast.com`), see the [Error reference](/errors). +See [Edge request logs](/logs#edge-request-logs), [Logs](/logs), and [`sf logs`](/cli/reference/logs#sf-logs-target-kind) for every flag. For Spacefast REST API error codes (`api.spacefast.com`), see the [Error reference](/errors). diff --git a/content/(operate)/infrastructure/index.mdx b/content/(operate)/infrastructure/index.mdx index 50e71d77..8c6c2755 100644 --- a/content/(operate)/infrastructure/index.mdx +++ b/content/(operate)/infrastructure/index.mdx @@ -1,70 +1,41 @@ --- title: Infrastructure -description: What the infra under every Space does for you, from failover and edge protection to certificates and server settings +description: Managed global edge network, automated failover, IP ranges, server specs, filesystem permissions, and platform HTTP status codes --- -Spacefast runs on the same infra as WordPress.com and Pressable. Most of it needs no setup from you. Certificates renew automatically, failover moves traffic without a republish, and edge protection works without a plugin. These pages explain what the platform handles and the few parts left to you. [Workers](/functions) run separately and have their own outbound network rules. +Spacefast runs on managed global infra. Most of it needs no setup from you: [TLS certificates](/domains/tls-certificates) renew automatically, failover moves traffic without a republish, and [Traffic Rules and edge protection](/traffic-rules) work with no plugin. These pages cover the underlying network, hardware, and runtime controls. [Workers](/functions) run separately and have their own outbound network rules. -## Availability +## Network and availability - - Primary and secondary origins sit in different data centers. When the primary fails, traffic moves to the secondary without a republish or a DNS change. - - The edge receives requests close to your visitors. The origin handles the requests the edge cannot answer from cache. - - - -## Edge and traffic - - - - Anycast routing, edge caching, and traffic classification work without a setup step or a plugin in your Space. + The edge receives requests close to your visitors; self-sufficient origin servers handle uncached requests. - - Browser challenges reduce unwanted automated traffic. A challenge answers with HTTP `403`. + + Primary and secondary origins sit in separate data centers. When the primary fails, traffic shifts automatically without a republish or DNS change. - - Tell an edge traffic limit apart from application capacity when a request gets HTTP `429`. + + Inbound Anycast edge addresses, shared outbound origin pools, and Workers outbound networking. Platform-controlled status codes for rate limits, security challenges, suspension, and maintenance. - - Cached responses, rate limits, and browser challenges, including requests that never reached your Space's origin. - -## Security +## Origin runtime - - Spacefast provisions and renews HTTPS certificates for your Space's hostnames automatically. - - - Set your own security headers in `spacefast.config.ts` or `_headers`. The platform manages transport headers, including HTTP Strict Transport Security. + + Managed origin specs, plan compute allowances, compression defaults, and configuration boundaries. - A published version is an immutable snapshot. PHP filesystem permissions are a separate control over writes from PHP web requests. + How immutable published versions differ from runtime storage and temporary read-only containment. -## Network and DNS +## Related guides - - - Use the DNS records Spacefast returns. Inbound addresses route visitors to the edge and do not identify the server running your Space. - - - Most hostnames need only address records. A TXT record appears only when the hostname is already in use elsewhere. - - - -## Server - - - - Spacefast manages the servers behind your Space. You publish files and configure application behavior; the infra handles hardware, replication, and the edge network. - - +- [TLS certificates](/domains/tls-certificates) and [Domain verification records](/domains/verification) under Domains +- [Traffic Rules and firewall](/traffic-rules): edge firewall, DDoS mitigation, Defensive Mode, and edge rate limiting +- [Response headers](/headers): security headers, CORS, and HSTS +- [Logs](/logs): edge request logs, origin access logs, runtime output, and build logs diff --git a/content/(operate)/infrastructure/ip-ranges.mdx b/content/(operate)/infrastructure/ip-ranges.mdx index 5c0d2107..3fe11a5d 100644 --- a/content/(operate)/infrastructure/ip-ranges.mdx +++ b/content/(operate)/infrastructure/ip-ranges.mdx @@ -1,33 +1,31 @@ --- title: IP ranges -description: Use the DNS addresses Spacefast returns and account for changing outbound addresses. +description: Understand Spacefast inbound Anycast addresses, shared outbound origin pools, and Workers outbound networking. --- -Copy the DNS records Spacefast gives you for your hostname. Inbound addresses route visitors to the edge; they do not identify the server running your Space. +Spacefast uses separate IP addresses for inbound visitor traffic and outbound connections from origin servers. When a domain uses [Spacefast DNS](/domains/dns), Spacefast configures inbound routing records automatically; on external DNS, copy the exact records Spacefast returns for your hostname. Inbound addresses route visitors to the edge and never identify the physical server running your Space. -## Inbound traffic +## Inbound addresses -Spacefast uses an Anycast network. The same published address can send visitors to different edge locations, usually near the requester, before a request reaches the origin. +Spacefast routes inbound traffic through an Anycast network, connecting visitors to a nearby edge location even when your Space's origin sits in another region. The DNS addresses returned for your domain are edge load-balancer addresses, not individual origin server addresses. -Connect a domain through the [custom domain flow](/domains). The CLI and dashboard return the required address and verification records. Use those exact values, including the hostname on each record. - -The default inbound load-balancer range is `192.0.79.128/26`, but the addresses for your hostname can differ. Do not select an address from that range yourself or copy one from another Space. Spacefast obtains the addresses for your setup. +Connect a custom domain through the [custom domain flow](/domains). The CLI and dashboard return the exact required address and verification records: ```bash sf domains add example.com --space my-site sf domains diagnostics example.com --space my-site ``` -## Outbound connections +The default inbound load-balancer CIDR range is `192.0.79.128/26`, but the approved addresses for your hostname can differ. Never pick an address from that range manually or copy one from another Space. Always use the addresses Spacefast supplies for your setup. -A request your Space's origin makes to an external service uses an origin pool's outbound address. That address can change after [automated failover](/infrastructure/automated-failover), relocation, or replacement of the underlying site. +## Outbound origin connections -Functions workers are different: they send from Cloudflare's shared network, so an allowlist built on the origin pool does not cover them. See [Functions outbound HTTP](/functions#outbound-http). +When your Space's origin makes an outbound connection to an external API or database, it uses the outbound address of its current origin server. That address is not permanent. It can change during [automated failover](/infrastructure/automated-failover), automatic server migration, or when a cloned or recreated Space lands on another server. -Outbound addresses can be shared with other sites. An IP allowlist covering a complete infra range does not authenticate your application, and a single observed address is not a stable integration contract. Use the external service's authentication mechanism. If it also requires an IP allowlist, contact Spacefast support to discuss the requirement before depending on a fixed address. +[Workers](/functions#outbound-http) run separately and make outbound requests from Cloudflare's shared network, so an allowlist built around origin server addresses never covers Workers. -## Keep DNS and location separate +Outbound origin ranges are shared with other sites on the same infra. Adding an entire infra range to an allowlist does not authenticate your Space, and pinning a single observed IP breaks as soon as failover or relocation occurs. Authenticate outbound requests with API keys, signed tokens, or mutual TLS instead. If an external provider strictly requires an IP allowlist, contact Spacefast support before relying on any fixed address. -A public DNS lookup tells you where to send inbound traffic. It does not reveal a permanent origin location or the address an outbound connection will use. Changing DNS is not how you select an origin region. +## Keep DNS and origin location separate - +A public DNS lookup shows where inbound traffic enters the edge network. It does not reveal a permanent origin location or the outbound IP address your Space uses, and changing DNS does not move an origin region. diff --git a/content/(operate)/infrastructure/meta.ts b/content/(operate)/infrastructure/meta.ts index c83640e5..9547928c 100644 --- a/content/(operate)/infrastructure/meta.ts +++ b/content/(operate)/infrastructure/meta.ts @@ -5,18 +5,11 @@ export default defineMeta({ collapsed: true, pages: [ "index", + "origin-edge-servers", "automated-failover", "ip-ranges", - "origin-edge-servers", "server-specs-settings", - "ddos-protection", - "defensive-mode", - "rate-limiting", - "http-status-codes", - "http-security-headers", "filesystem-permissions", - "edge-request-logs", - "domain-verification-records", - "tls-certificates", + "http-status-codes", ], }); diff --git a/content/(operate)/infrastructure/origin-edge-servers.mdx b/content/(operate)/infrastructure/origin-edge-servers.mdx index a037407a..d5e29a76 100644 --- a/content/(operate)/infrastructure/origin-edge-servers.mdx +++ b/content/(operate)/infrastructure/origin-edge-servers.mdx @@ -1,30 +1,41 @@ --- title: Origin and edge servers -description: How requests reach the edge, use the cache, and continue to the origin. +description: How requests reach the edge, use the cache, and continue to the origin across Spacefast's global network. --- -The edge receives requests close to your visitors. The origin stores Space data and handles requests the edge cannot answer from cache. +Edge servers receive visitor requests close to the requester and serve eligible cached responses. Origin servers hold your Space's current files, settings, and database, and produce uncached responses. A Space's origin location does not determine the DNS address or the edge location a visitor reaches. -## A request through Spacefast +## How a request flows -1. Your hostname resolves to an Anycast address. Network routing takes the visitor to an edge location. -2. The edge applies traffic protections and can return an eligible cached response. -3. A request that needs the origin continues there. Spacefast serves the published files or runs the application behavior the request needs. +1. Your hostname resolves to an Anycast address. Network routing takes the visitor to a nearby edge location, where a load balancer checks traffic protections and Edge Cache. +2. When Edge Cache holds an eligible response, the edge returns it immediately without contacting the origin. +3. Requests that miss or bypass Edge Cache continue to the Space's origin data center. Each origin server is self-sufficient: the application runtime, files, database, and object cache run together on the same server so uncached dynamic requests avoid extra remote hops. -Edge Cache and origin caching are separate layers. A cache hit at the edge avoids an origin request. An origin cache hit can avoid running WordPress again. See [Caching](/caching) for Spacefast's response and invalidation rules. +Origin Page Cache and Edge Cache are separate layers, but Page Cache lifetime and bypass rules influence which responses can be stored at the edge and for how long. An eligible origin response can be cached for subsequent visitors at both layers. See [Caching](/caching) for Spacefast's response and invalidation rules. -## Origin regions +## Origin regions and network locations -Spacefast's origin datacenters are in {{plan-datacenters}}, with edge locations across more regions. The public IP address does not identify the physical origin. +Spacefast's origin data centers sit in {{plan-datacenters}}, paired with edge locations worldwide. An origin data center can also serve as an edge location for Spaces whose origin lives in another region. -Spacefast manages Space placement. An origin preference is a provisioning choice, not a per-request routing rule or a Spacefast setting for moving an existing Space. Spacefast can relocate Spaces for platform health and performance, and [failover](/infrastructure/automated-failover) can temporarily change the active origin. +| City | Code | Role | +| --- | --- | --- | +| Amsterdam | `AMS` | Origin and edge | +| Ashburn | `DCA` | Origin and edge | +| Dallas | `DFW` | Origin and edge | +| Los Angeles | `BUR` | Origin and edge | +| Atlanta, Chicago, Denver, Miami, New Jersey, New York, San Jose, Seattle, Toronto | `ATL`, `MDW`, `DEN`, `MIA`, `EWR`, `JFK`, `SJC`, `SEA`, `YYZ` | Edge | +| Frankfurt, London, Madrid, Milan, Paris, Stockholm, Vienna | `HHN`, `LHR`, `MAD`, `MXP`, `CDG`, `ARN`, `VIE` | Edge | +| Hong Kong, Mumbai, Osaka, Singapore, Sydney, Tokyo | `HKG`, `BOM`, `KIX`, `SIN`, `SYD`, `NRT` | Edge | +| Johannesburg, Santiago, São Paulo | `JNB`, `SCL`, `GRU` | Edge | -Space replicas can span the United States and the European Union. Do not infer a data-residency guarantee from an origin location, a DNS answer, or the edge that served one request. +Network capacity and available locations can change over time. The public DNS address does not identify a Space's physical origin server. -## Where request logs appear +Spacefast manages Space placement. An origin preference is chosen at creation time, not changed in place on an existing Space, and is not a per-request routing rule. Spacefast can relocate Spaces between server pools for hardware replacement, capacity balance, or performance, and [automated failover](/infrastructure/automated-failover) can temporarily shift the active origin. + +Space replicas can span the United States and the European Union. Do not infer a single-region data-residency guarantee from an origin preference, a DNS answer, or the edge that served one request. -[Edge request logs](/infrastructure/edge-request-logs) include requests handled at the edge, including cache hits and security challenges that never reach the origin. [Access and runtime logs](/logs) cover origin requests and application output. +## Where request logs appear -Use [Stats](/stats) to inspect traffic trends. A missing origin log entry does not mean the edge never received the request. +[Edge request logs](/logs#edge-request-logs) record requests handled at the edge, including cache hits, rate limits, and security challenges that never reach the origin. [Access and runtime logs](/logs) record requests that reach the origin along with application output. - +Use [Stats](/stats) for aggregated traffic trends across both layers. A missing origin log entry does not mean the edge never received the request. diff --git a/content/(operate)/infrastructure/rate-limiting.mdx b/content/(operate)/infrastructure/rate-limiting.mdx deleted file mode 100644 index 77754b26..00000000 --- a/content/(operate)/infrastructure/rate-limiting.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Rate limiting -description: Diagnose visitor-facing 429 responses and distinguish edge limits from application capacity. ---- - -A request to your Space can receive HTTP `429` when traffic matches an infra rate limit or exceeds application capacity. Occasional limits on scanners and unwanted bots are expected. Investigate when legitimate visitors or integrations cannot continue. - -## Edge traffic limits - -The edge classifies requests using signals such as request rate, URL patterns, user agent, proxy characteristics, and connection behavior. Limits can apply to a pattern, a Space, or the wider platform. - -Thresholds can change as traffic changes. Do not build a client around an undocumented requests-per-second allowance. Send an accurate `User-Agent` and reduce repeated requests when a limit appears. - -## Resource limits are different - -A visitor-facing rate-limit page can also represent a PHP resource-limit event, recorded as HTTP `599`. That means a PHP connection was not available in time; it does not require CPU usage to reach a maximum. - -Spacefast also limits concurrent application work. When that admission limit is reached, it returns `429` with `Retry-After`. Respect that header and retry with backoff. Repeating the same work immediately adds pressure. - -A [Defensive Mode](/infrastructure/defensive-mode) challenge uses `403` instead. See [HTTP status codes](/infrastructure/http-status-codes) for every platform-controlled status code before treating every rejected request as the same problem. - -## Find the affected requests - -```bash -sf logs edge --space my-space --status 429 -sf logs access --space my-space -``` - -[Edge request logs](/infrastructure/edge-request-logs) show cache handling, rate-limit reasons, and challenge details. Origin [access and runtime logs](/logs) help explain requests that reached your application. Compare the same hostname and time window. - -For an authorized crawler or integration, reduce its request rate, check for loops and repeated missing URLs, and confirm its identity header. If a legitimate workflow remains blocked, contact Spacefast support with exact request samples. - -## Management API limits - -Limits on calls to `api.spacefast.com` are a separate contract. See [API rate limits](/api/rate-limits) for response headers, quotas, and retry behavior. - - diff --git a/content/(operate)/infrastructure/server-specs-settings.mdx b/content/(operate)/infrastructure/server-specs-settings.mdx index eb6f5b65..370f4f5b 100644 --- a/content/(operate)/infrastructure/server-specs-settings.mdx +++ b/content/(operate)/infrastructure/server-specs-settings.mdx @@ -1,29 +1,35 @@ --- title: Server specifications and settings -description: Managed hardware, PHP settings, and the configuration boundaries for a Space. +description: Managed origin specs, plan compute allowances, compression defaults, and configuration boundaries --- -Spacefast manages the servers behind your Space. You publish files and configure application behavior; the infra handles hardware, replication, and the shared edge network. +Spacefast manages the origin servers and edge network behind every Space. You publish files and declare application behavior; the infra handles hardware, real-time replication, caching, and upgrades over time. -## Hardware +## Infrastructure overview -Spacefast runs origin pools on AMD EPYC processors with NVMe storage and redundant 25 Gbit networking per server. Primary and secondary servers sit in different regions for [automated failover](/infrastructure/automated-failover). Hardware and software change as the platform upgrades pools. +| Component | Behavior | +| --- | --- | +| Network | Redundant 25 Gbit connectivity per server | +| Storage | NVMe solid-state drives | +| Redundancy | Primary and secondary servers in separate regions with [automated failover](/infrastructure/automated-failover) | +| Network footprint | 4 origin data centers and 27+ global edge locations ([Origin and edge servers](/infrastructure/origin-edge-servers)) | +| Caching | Edge Cache, origin Page Cache, and in-memory Object Cache | +| Compression | Brotli preferred, with gzip fallback | +| Default time zone | UTC | -Those are pool specifications, not dedicated resources reserved for each Space. Your product entitlements come from your [plan limits](/limits). +These describe shared origin infrastructure, not dedicated hardware reserved per Space. Intermediate image sizes generated by the edge image service do not count against your Space's filesystem disk quota. ## Compute, memory, and disk -Spacefast's compute workers, memory per request, and disk per Space depend on the plan: +Per-Space compute workers, bursting, per-request memory, and disk allowances depend on your plan: -See [Pricing & Limits](/pricing) for every other per-Space limit. +See [Pricing and plans](/pricing) for every other per-Space entitlement. Repeated memory exhaustion is usually better fixed in application code or database queries than by relying solely on a higher ceiling. ## Compression -Spacefast supports Brotli and gzip compression. A client that accepts Brotli can receive it; gzip is available as a fallback. Compression headers belong to the platform, so do not set `Content-Encoding` in your published header rules. - -The underlying PHP configuration is not a promise that arbitrary uploaded PHP files will execute. +Spacefast enables Brotli at the edge and origin, falling back to gzip when a client does not advertise Brotli support. Compression headers are platform-managed, so do not set `Content-Encoding` in your own header rules. ## Configuration boundaries @@ -32,8 +38,6 @@ The underlying PHP configuration is not a promise that arbitrary uploaded PHP fi | Redirects, rewrites, and response headers | Configure [redirects and rewrites](/redirects) or [headers](/headers) in `spacefast.config.ts`, `_redirects`, or `_headers`. | | Application environment variables | Use [Environment variables](/environment-variables). | | Runtime configuration | Use the [configuration file](/config-file). | -| Storage and resource entitlements | Check [Limits](/limits). | - -Spacefast rejects authored `.htaccess` and `.user.ini` files. You cannot replace the managed server configuration or `php.ini` through a publish. Use the supported configuration for the behavior you need. +| Storage and resource entitlements | Check [Platform limits](/limits). | - +Spacefast uses WordPress and SpacePress as a managed application server rather than exposing raw server configuration: no custom origin code runs outside SpacePress. Authored `.htaccess`, `.user.ini`, custom WordPress plugins or themes, and arbitrary PHP files are not supported. Write app logic in [SpacePress](/build) (`sp/`) or [Workers](/functions), and declare routing and headers in `spacefast.config.ts`. diff --git a/content/(operate)/infrastructure/tls-certificates.mdx b/content/(operate)/infrastructure/tls-certificates.mdx deleted file mode 100644 index f933536b..00000000 --- a/content/(operate)/infrastructure/tls-certificates.mdx +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: TLS certificates -description: Automatic HTTPS, per-hostname certificate checks, and recovery from blocked issuance. ---- - -Spacefast provisions and renews HTTPS certificates for your Space's hostnames automatically. For a custom domain, issuance depends on correct DNS and a reachable validation path. - -## Provisioning and renewal - -Spacefast issues certificates through Let's Encrypt and Google Trust Services. Issuance uses the ACME HTTP-01 challenge, so each hostname must resolve to the supplied infra addresses and allow validation over HTTP. - -The apex and `www` are validated independently. One can have a working certificate while the other is still pending. Check every hostname returned by your domain setup. - -Renewals happen automatically. Failed attempts are requeued with increasing delays, so correct the DNS or configuration problem before requesting another attempt. - -## Check a certificate - -```bash -sf domains diagnostics example.com --space my-site -``` - -The diagnostics report DNS, verification, and SSL state for each hostname. The UI and API use the familiar name SSL in some fields; the connection uses TLS. - -To inspect the certificate presented by a public hostname: - -```bash -openssl s_client -connect example.com:443 -servername example.com /dev/null | openssl x509 -noout -issuer -dates -``` - -Issuer names and chains can change. Do not pin an integration to a particular issuer common name. - -## When issuance is blocked - -Check that the hostname's address records match Spacefast's instructions. Remove old addresses that still send some requests elsewhere. If CAA records restrict certificate authorities, allow the authorities used for issuance. Check that an extra proxy or redirect does not block the HTTP validation request. - -After fixing the cause, use **Retry HTTPS** on the domain's page in the dashboard (it appears while a certificate is failing) or `POST /v1/domains/{domainId}/ssl/retry`. Retries are rate limited; repeated retries do not repair a DNS or CAA error. - -See [Custom domains](/domains#troubleshooting) for diagnostic codes such as `ssl_pending` and `ssl_renewal_blocked`. - -## Protocol support - -Spacefast disables TLS 1.0 and TLS 1.1. Modern clients negotiate TLS 1.2 or TLS 1.3. Some TLS 1.2 ciphers remain for older-client compatibility, so evaluate scanner findings against the protocol and cipher the affected client actually negotiates. - - diff --git a/content/(operate)/logs.mdx b/content/(operate)/logs.mdx index e8422127..fca65641 100644 --- a/content/(operate)/logs.mdx +++ b/content/(operate)/logs.mdx @@ -31,7 +31,7 @@ sf logs https://example.com access sf logs runtime --follow ``` -The first positional argument is a target: a Space ID, slug, live URL, or custom domain. The second is the kind (`access`, `edge`, or `runtime`, defaulting to `access`). The command shifts a bare kind out of the first slot, so `sf logs runtime` and `sf logs my-space runtime` both work. See [Edge request logs](/infrastructure/edge-request-logs) for edge-specific filters such as `--hostname`, `--status`, `--method`, `--remote-addr`, `--asn`, `--ja3-hash`, and `--user-agent`. +The first positional argument is a target: a Space ID, slug, live URL, or custom domain. The second is the kind (`access`, `edge`, or `runtime`, defaulting to `access`). The command shifts a bare kind out of the first slot, so `sf logs runtime` and `sf logs my-space runtime` both work. See [Edge request logs](#edge-request-logs) below for edge-specific filters. | Flag | Default | What it does | | --- | --- | --- | @@ -72,19 +72,44 @@ Runtime entries carry structured fields: In server runtime code, `ctx.log.info(message, data)`, `warn`, and `error` write to this stream, alongside output from Workers, background jobs, and connectors (filterable with `--source`). A static Space returns an empty runtime stream because it runs no code. -## Two things that surprise people +## Indexing delay and empty pages :::caution[A line you just triggered will not be in the next page] -A record is written on the origin, shipped off the box, and indexed before it can be read back. Runtime lines lag behind execution. If a line is missing right after a request, wait and page again. +A record is written on the origin, shipped off the origin, and indexed before it can be read back. Runtime lines lag behind execution. If a line is missing right after a request, wait and page again. ::: **An empty page does not mean the end of the log.** A response can carry `hasMore: true` with no entries, which means the scan stopped early rather than that nothing is left. Keep following the cursor. The CLI prints `More: --cursor ` even for an empty page for this reason. -## Filters +## Edge request logs + +Edge request logs return individual requests handled by Spacefast's edge network, including cache hits, rate limits, and browser challenges that never reach your Space's origin. Each query covers one assigned hostname (defaulting to the primary hostname; an apex and its `www` twin are queried separately). + +```bash +sf logs edge --space my-site +sf logs edge --space my-site --hostname example.com --status 429 +sf logs edge --space my-site --status 403 --json +``` + +| CLI flag | Selects | +| --- | --- | +| `--hostname` | One hostname assigned to the Space | +| `--remote-addr` | Client IPv4 or IPv6 source address | +| `--ja3-hash` | JA3 TLS fingerprint (exact 32 hexadecimal characters; matched lowercase) | +| `--method` | HTTP method such as `GET` or `POST` (matched uppercase) | +| `--status` | HTTP response status such as `403` or `429` | +| `--user-agent` | Exact complete `User-Agent` header value | +| `--asn` | Autonomous system number (ASN) of the source IP | +| `--since`, `--until` | ISO 8601 timestamps (`--since` inclusive, `--until` exclusive) | + +Repeat `--remote-addr`, `--ja3-hash`, `--method`, `--status`, `--user-agent`, or `--asn` to match multiple values (OR within one field, AND across fields). `--hostname`, `--since`, and `--until` accept one value each. + +- **Window and retention:** Edge logs retain the past **24 hours** (plan retention can shorten that window). Each query defaults to the past hour and can span **at most one hour**; reuse the previous `--until` as the next `--since` to walk contiguous windows without gaps. +- **Record fields:** Entries carry `timestamp`, `hostname`, `method`, `path`, `status`, client IP, user agent, country, timing, `cacheStatus`, `rateLimited`, `rateLimitReason`, and `defensiveMode` (`cookieStatus`, `challengeReason`, `challengeResult`). Access credentials in URLs are redacted. +- **5,000-record cap:** Each query returns up to 100 entries per page (cursors bind to a snapshot for five minutes) and at most **5,000 records** total. An `edge_logs_truncated` warning means matching records past 5,000 were omitted; narrow the window or add filters. Use [Stats](/stats) for aggregated traffic trends beyond 24 hours. -`--request-id` and `--handler` are applied over pages already fetched, so give a `--limit` large enough to cover the window you care about. +## Filters -Use `--since` and `--until` for an ISO 8601 time window. Edge logs have their own [window and retention limits](/infrastructure/edge-request-logs#filters-and-time-windows). +`--request-id` and `--handler` are applied over pages already fetched, so give a `--limit` large enough to cover the window you care about. Use `--since` and `--until` for an ISO 8601 time window. ## Retention @@ -111,3 +136,7 @@ sf builds logs bld_123 --follow | [`listSpaceEdgeLogs`](/api/reference/activity/listspaceedgelogs) | `GET /v1/spaces/{spaceId}/logs/edge` | | [`listSpaceRuntimeLogs`](/api/reference/activity/listspaceruntimelogs) | `GET /v1/spaces/{spaceId}/logs/runtime` | | [`listBuildLogs`](/api/reference/builds/listbuildlogs) | `GET /v1/builds/{buildId}/logs` | + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/meta.ts b/content/(operate)/meta.ts index 8acec961..85b10607 100644 --- a/content/(operate)/meta.ts +++ b/content/(operate)/meta.ts @@ -5,7 +5,6 @@ export default defineMeta({ collapsed: false, pages: [ "share", - "sso", "comments", "stats", "tag-manager", @@ -17,7 +16,7 @@ export default defineMeta({ "production-checklist", "performance", "troubleshooting", - "feedback", "infrastructure", + "feedback", ], }); diff --git a/content/(operate)/performance.mdx b/content/(operate)/performance.mdx index ad585ee0..c92cbd76 100644 --- a/content/(operate)/performance.mdx +++ b/content/(operate)/performance.mdx @@ -100,4 +100,4 @@ Check which version served a request and verify cache behavior with `curl`: curl -sI https://my-space.space.fast/ | grep -iE 'x-spacefast|cache-control|etag' ``` -Compare cache hits, status codes, and response latency with [`sf logs`](/cli/reference/logs#sf-logs-target-kind), [Edge request logs](/infrastructure/edge-request-logs), [Logs](/logs), and [Stats](/stats). +Compare cache hits, status codes, and response latency with [`sf logs`](/cli/reference/logs#sf-logs-target-kind), [Edge request logs](/logs#edge-request-logs), [Logs](/logs), and [Stats](/stats). diff --git a/content/(operate)/production-checklist.mdx b/content/(operate)/production-checklist.mdx index 4fad3eee..0f10726d 100644 --- a/content/(operate)/production-checklist.mdx +++ b/content/(operate)/production-checklist.mdx @@ -7,7 +7,7 @@ Check these nine areas before sending production traffic to a Space. ## Custom domain and HTTPS -- Attach your custom domain and confirm its DNS records and TLS certificate are healthy with [`sf domains check`](/cli/reference/domains#sf-domains-check-domain) and [`sf domains diagnostics`](/cli/reference/domains#sf-domains-diagnostics-domain) (`sf domains diagnostics example.com --space my-space`). See [Custom domains](/domains), [DNS management](/domains/dns), and [TLS certificates](/infrastructure/tls-certificates). +- Attach your custom domain and confirm its DNS records and TLS certificate are healthy with [`sf domains check`](/cli/reference/domains#sf-domains-check-domain) and [`sf domains diagnostics`](/cli/reference/domains#sf-domains-diagnostics-domain) (`sf domains diagnostics example.com --space my-space`). See [Custom domains](/domains), [DNS management](/domains/dns), and [TLS certificates](/domains/tls-certificates). - Confirm your primary hostname (`example.com` vs `www.example.com`) so the secondary hostname redirects cleanly with `308`. ## Channels and promotion @@ -34,7 +34,7 @@ Check these nine areas before sending production traffic to a Space. ## Headers, redirects, and caching - Configure redirects, rewrites, and response headers in [`spacefast.config.ts`](/config-file) and inspect local rules with [`sf routing inspect`](/cli/reference/routing#sf-routing-inspect) before promoting. See [Redirects and rewrites](/redirects) and [Headers](/headers). -- Add security headers (`X-Content-Type-Options`, `Referrer-Policy`, `Content-Security-Policy`) without overriding platform-managed transport headers. See [HTTP and security headers](/infrastructure/http-security-headers). +- Add security headers (`X-Content-Type-Options`, `Referrer-Policy`, `Content-Security-Policy`) without overriding platform-managed transport headers. See [HTTP and security headers](/headers#security-cors-and-caching-headers). - Verify live caching headers on a public URL after promotion (private previews always return `private, no-store`). See [Caching](/caching) and [Performance and optimization](/performance). ## Stats and tags @@ -44,7 +44,7 @@ Check these nine areas before sending production traffic to a Space. ## Logs and audit trail -- Verify access to origin logs ([`sf logs`](/cli/reference/logs#sf-logs-target-kind)), edge logs (`sf logs edge`), and runtime logs (`sf logs runtime --follow`). See [Logs](/logs) and [Edge request logs](/infrastructure/edge-request-logs). +- Verify access to origin logs ([`sf logs`](/cli/reference/logs#sf-logs-target-kind)), edge logs (`sf logs edge`), and runtime logs (`sf logs runtime --follow`). See [Logs](/logs) and [Edge request logs](/logs#edge-request-logs). - Confirm your team's log and activity retention windows match your incident-response requirements on [Activity and audit logs](/activity). ## Backups and exports diff --git a/content/(operate)/security.mdx b/content/(operate)/security.mdx index e1dfd12f..a8b950c2 100644 --- a/content/(operate)/security.mdx +++ b/content/(operate)/security.mdx @@ -51,9 +51,7 @@ Crawler identification is separate from Space access. Requests claiming to be `G Whether genuine `GPTBot`, `ClaudeBot`, or `PerplexityBot` requests pass is not established, and there is no documented guarantee that AI crawlers are allowed. Private and preview hostnames also carry access and indexing restrictions independent of this challenge. -When reporting a challenge, include the URL, time, status, response body, `User-Agent`, and source IP. An absent [edge request log](/infrastructure/edge-request-logs) row is not evidence that a request was allowed. - -WP Cloud's `ssl-social-crawler-redirect` endpoint is unrelated: its documented purpose is HTTPS-to-HTTP redirects for Facebook, Twitter, and LinkedIn to retain historic share counts, not AI-crawler access. +When reporting a challenge, include the URL, time, status, response body, `User-Agent`, and source IP. An absent [edge request log](/logs#edge-request-logs) row is not evidence that a request was allowed. ## Report abusive content @@ -67,22 +65,20 @@ curl -X POST https://api.spacefast.com/v1/abuse-reports \ `category` accepts `malware`, `phishing`, `spam`, `copyright`, `illegal_content`, or `other`. `description` takes 10 to 5,000 characters. Spacefast reviews reports and may disable the Space. -## Infrastructure security +## Infrastructure and governance -Spacefast runs on managed infrastructure with automated failover, edge DDoS mitigation, TLS management, and traffic rules. See the infrastructure guides for each layer: +Spacefast pairs team governance controls with managed edge protection, TLS management, and automated failover: | Area | Guide | | --- | --- | -| Overview of platform-managed vs Space-managed controls | [Infrastructure](/infrastructure) | -| Edge DDoS mitigation and firewall rules | [DDoS protection](/infrastructure/ddos-protection) | -| Browser challenge mode during active attacks | [Defensive Mode](/infrastructure/defensive-mode) | -| Edge rate limiting vs API rate limits | [Rate limiting](/infrastructure/rate-limiting) | -| Managed TLS issuance, renewal, and custom certificates | [TLS certificates](/infrastructure/tls-certificates) | -| Security response headers and platform-owned transport headers | [HTTP and security headers](/infrastructure/http-security-headers) | -| PHP filesystem modes vs immutable versions | [Filesystem permissions](/infrastructure/filesystem-permissions) | -| Edge request logs, challenge verdicts, and filters | [Edge request logs](/infrastructure/edge-request-logs) | -| Edge and origin IP ranges and outbound behavior | [IP ranges](/infrastructure/ip-ranges) | -| DNS verification records and ownership proof | [Domain verification records](/infrastructure/domain-verification-records) | -| Automatic region failover | [Automated failover](/infrastructure/automated-failover) | -| Edge caching and origin pools | [Origin and edge servers](/infrastructure/origin-edge-servers) | -| Hardware specs, compression, and server boundaries | [Server specifications and settings](/infrastructure/server-specs-settings) | +| Approval policies, Team Reviews, Work Mode, and Emergency Pause | [Approvals and Emergency Pause](/approvals) | +| Edge firewall, DDoS protection, Defensive Mode, and edge rate limiting | [Traffic Rules and firewall](/traffic-rules) | +| Managed TLS issuance, renewal, and custom certificates | [TLS certificates](/domains/tls-certificates) | +| DNS verification records and ownership proof | [Domain verification records](/domains/verification) | +| Security response headers, CORS, and HSTS | [Response headers](/headers) | +| Edge request logs, challenge verdicts, and filters | [Logs](/logs#edge-request-logs) | +| Overview of platform-managed network, failover, IPs, specs, and read-only containment | [Infrastructure](/infrastructure) | + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/share.mdx b/content/(operate)/share.mdx index 7270d7a5..0f3833e8 100644 --- a/content/(operate)/share.mdx +++ b/content/(operate)/share.mdx @@ -260,9 +260,15 @@ Register an OAuth app on your team with [`sf oauth-apps create`](/cli/reference/ sf oauth-apps create \ --name "Guestbook" \ --redirect-uri https://my-space.space.fast/auth/callback +sf oauth-apps list +sf oauth-apps inspect +sf oauth-apps update --name "Guestbook Prod" +sf oauth-apps delete ``` -Apps are public by default and use PKCE from the browser. Pass `--confidential` only for a server-side app; its client secret prints once, and you can rotate it with [`sf oauth-apps secret rotate`](/cli/reference/oauth-apps#sf-oauth-apps-secret-rotate-app). Run [`sf oauth-apps inspect`](/cli/reference/oauth-apps#sf-oauth-apps-inspect-app) to read the app's OpenID Connect endpoints and redirect URIs. +Apps are public by default and run an OpenID Connect authorization code flow with PKCE (`openid`, `profile`, and `email` scopes). Pass `--confidential` only for a server-side app; its client secret prints once, and you can rotate it with [`sf oauth-apps secret rotate`](/cli/reference/oauth-apps#sf-oauth-apps-secret-rotate-app). Run [`sf oauth-apps inspect`](/cli/reference/oauth-apps#sf-oauth-apps-inspect-app) to read the app's OpenID Connect endpoints (`https://api.spacefast.com/v1/auth/oauth2/authorize`, `https://api.spacefast.com/v1/auth/oauth2/token`) and redirect URIs. + +Building a [SpacePress](/build) app? You do not need to register a separate OAuth app: link visitors directly to `/__spacefast/sign-in?return=/path/` (or scaffold it with `sf add auth`). See [App users and sign-in](/users). ## What a visitor sees @@ -306,3 +312,9 @@ The same card holds two team-wide switches: - **Hide from search engines**: every Space in the team serves `noindex` on its live hostnames, overriding the Space's own setting. It stays on while **Private spaces only** is on. Only team owners and admins can change these switches, and only from the dashboard. For team-wide visibility audits and bulk lock-down on Enterprise plans, see [Security and trust](/security). + +## CLI, API, MCP, and SDK + + + + diff --git a/content/(operate)/space-transfers.mdx b/content/(operate)/space-transfers.mdx index bd279cb1..4e85a858 100644 --- a/content/(operate)/space-transfers.mdx +++ b/content/(operate)/space-transfers.mdx @@ -82,3 +82,7 @@ On Enterprise plans, a parent team owner or admin can turn on `restrictSpaceTran | [`transfer_team_to_customer_unsupported`](/errors/transfer_team_to_customer_unsupported) | A team's Space can move only to another team, not to a partner customer | | [`transfer_push_failed`](/errors/transfer_push_failed) | The source runtime could not push Space blobs into the transfer bucket; retry | | [`transfer_verify_failed`](/errors/transfer_verify_failed) | The target runtime could not verify transferred blobs; retry | + +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/stats.mdx b/content/(operate)/stats.mdx index 5d45e8b1..72e47930 100644 --- a/content/(operate)/stats.mdx +++ b/content/(operate)/stats.mdx @@ -85,32 +85,32 @@ curl "https://api.spacefast.com/v1/spaces/spc_xxxxxxxx/analytics?window=7d" \ There is no window-level request total in the payload. Sum `series[].requests` for it, which is what the dashboard does. -## Browser stats (Now and Trends) +## Browser stats (Spacefast Stats) -Labs + + +Spacefast Stats adds live visitor insights (**Now**), historical trends (**Trends**), and an on-Space Stats drawer to every Space on enrolled teams. Join through [**Team settings → Labs**](https://my.spacefast.com/?to=/:team/settings/labs) (see [Labs](/labs)). Open the Space and choose [**Stats**](https://my.spacefast.com/?to=/:team/:space/stats) in the sidebar to see who is on your Space right now (**Now**) and how visits change over 7, 30, or 90 days (**Trends**). You must be signed in as an editor of the Space. ### Requirements and controls -- **Team access**: Browser stats aren't available to every team yet. Once your team has access, Spacefast tracks every Space by default unless an editor switches it off. +- **Team access**: Spacefast Stats is in Private Beta via [Labs](/labs). Once your team is enrolled, Spacefast tracks every Space by default unless an editor switches it off. - **Per-Space switch**: on the [**Stats**](https://my.spacefast.com/?to=/:team/:space/stats) page, choose **Turn Off** to stop tracking a Space or **Turn On Stats** to resume it from the next visit. Turning it off keeps existing history. - **Page Enhancements**: collecting visits on published pages requires **Page Enhancements** enabled in the Space's settings (`superpowers.enabled` in [the configuration file](/config-file#access-public-identity-theme-and-snippets)). Opening the dashboard does not start collection while Page Enhancements is off. - **Comments not required for the dashboard**: the dashboard **Now** and **Trends** cards do not require [Comments](/comments). If only one of the live or history services is configured on a deployment, only its card appears. -### What Now and Trends show +### Features included in Spacefast Stats -| View | What it shows | +| Feature | What it shows and how it works | | --- | --- | -| **Now** | Live visitor count, active pages, and recent arrivals | -| **Now** | Traffic sources, countries, engagement, and recent events where available | -| **Trends** | Visitors, page views, and engaged time over 7, 30, or 90 days | -| **Trends** | Top pages, period-over-period comparisons, and engagement by page | -| **Trends** | Referrers and scroll depth | - -The Space's analytics profile orders which live views appear first. Any measurement a source cannot supply is shown as unavailable or left out, never counted as zero. Visitor analytics counts visitors in aggregate without listing individual people. +| **Now (live view)** | Real-time active visitor count, active pages, recent arrivals, traffic sources, countries, engagement, and recent events where available | +| **Trends (7 / 30 / 90 days)** | Visitors, page views, engaged time, top pages, period-over-period comparisons, engagement by page, referrers, and scroll depth | +| **On-Space Stats drawer** | Opens directly on the live Space when **Page Enhancements** and [Comments](/comments) are both enabled, letting editors watch live traffic without switching tabs | +| **Adaptive analytics profiles** | Automatically orders the most relevant live views first based on what kind of Space you published | +| **Privacy-first collection** | Strips IP addresses, raw user agents, and browser fingerprints; honors analytics consent refusal and Global Privacy Control (`GPC`); counts visitors without consent using a daily rotating UTC hash (raw events retained up to 395 days) | -Browser events carry no IP address, raw user agent, or browser fingerprint. Spacefast drops events whenever the visitor denies analytics consent or sends Global Privacy Control (`GPC`). A visitor who has not consented is counted per UTC day with a daily rotating hash, so multi-day totals are not additive. Spacefast keeps raw events for up to 395 days. +Any measurement a source cannot supply is shown as unavailable or left out, never counted as zero. Visitor analytics counts visitors in aggregate without listing individual people. If **Trends** cannot be reached, reload the page to try again. A gap or an error is not evidence that nobody visited. @@ -118,9 +118,12 @@ If **Trends** cannot be reached, reload the page to try again. A gap or an error For a published Space, the **Stats** page links straight to the live Space: -- **`Spacebar Stats`** appears when both **Page Enhancements** and [Comments](/comments) are enabled on the live Space (not only on previews), opening the live Space with its on-Space Stats drawer. +- **On-Space Stats drawer** appears when both **Page Enhancements** and [Comments](/comments) are enabled on the live Space (not only on previews), opening the live Space with its on-Space Stats drawer. - Otherwise, the button opens the live Space without the drawer. ## Third-party analytics tags To run external analytics such as Google Analytics, Plausible, or PostHog with consent controls and reviewed releases, use [Tag Manager](/tag-manager). You can also add a Google Analytics measurement ID or Google Tag Manager container ID under [**Customization**](https://my.spacefast.com/?to=/:team/:space/customization); see [Customization](/customization). +## CLI, API, MCP, and SDK + + diff --git a/content/(operate)/tag-manager.mdx b/content/(operate)/tag-manager.mdx index de7c51b6..e7e328b7 100644 --- a/content/(operate)/tag-manager.mdx +++ b/content/(operate)/tag-manager.mdx @@ -1,11 +1,9 @@ --- title: Tag Manager description: Govern analytics, marketing, monitoring, and custom tags across Spaces and teams with reviewed revisions, consent rules, preview sessions, and rollback -sidebar: - badge: Public Beta --- -Public Beta + Tag Manager manages analytics, marketing, support, monitoring, and custom tags across a Space or a whole team. Changes move through versioned revisions, per-environment releases, and consent rules. You can roll back any environment to an earlier approved revision without republishing your Space. @@ -167,3 +165,7 @@ Tag IDs cannot contain `--`. | Space releases and apply | [`applySpaceTagConfig`](/api/reference/tags/applyspacetagconfig), [`releaseSpaceTagRevision`](/api/reference/tags/releasespacetagrevision), [`rollbackSpaceTagRelease`](/api/reference/tags/rollbackspacetagrelease) | | Preview and inheritance | [`createSpaceTagPreviewSession`](/api/reference/tags/createspacetagpreviewsession), [`getSpaceTagInheritance`](/api/reference/tags/getspacetaginheritance), [`updateSpaceTagInheritance`](/api/reference/tags/updatespacetaginheritance) | | Team tags | [`listTeamTagRevisions`](/api/reference/tags/listteamtagrevisions), [`listTeamTagTemplates`](/api/reference/tags/listteamtagtemplates) | + +## CLI, API, MCP, and SDK + + diff --git a/content/(reference)/api/authentication.mdx b/content/(reference)/api/authentication.mdx index 3345f30b..353ba997 100644 --- a/content/(reference)/api/authentication.mdx +++ b/content/(reference)/api/authentication.mdx @@ -5,7 +5,7 @@ description: Every credential the Spacefast API accepts, where each one is creat The API takes one header, but a valid token can still get a 403 on some routes. -## The header +## Authorization header ```http Authorization: Bearer @@ -124,7 +124,7 @@ For third-party apps, Spacefast is an OAuth 2.0 authorization server. | Authorize | `https://api.spacefast.com/v1/auth/oauth2/authorize` | | Token | `https://api.spacefast.com/v1/auth/oauth2/token` | -Authorization code is the flow for people, client credentials for machines. The scopes: +Authorization code is the flow for people, client credentials for machines. Register a team machine client (`profile: "machine"`) with [`createTeamOAuthClient`](/api/reference/teams/createteamoauthclient) (`POST /v1/teams/{teamId}/oauth-clients`) to exchange a client ID and secret at `/v1/auth/oauth2/token` (`grant_type=client_credentials`). The scopes: | Scope | What it allows | | --- | --- | diff --git a/content/(reference)/api/connectors.mdx b/content/(reference)/api/connectors.mdx index f13cd2e4..2c5a6d0e 100644 --- a/content/(reference)/api/connectors.mdx +++ b/content/(reference)/api/connectors.mdx @@ -1,15 +1,14 @@ --- -title: Connectors -description: Register tool sources, connect accounts, set policy rules, and run connector tools over the API, with the scopes, shapes, and error codes each step uses -sidebar: - badge: Public Beta +title: Connectors API +description: API scopes, team query selection, connection scoping, and error codes for /v1/connectors endpoints --- -Public Beta + + -Connectors are available on Go, Pro, and Enterprise plans. A team on Personal gets `feature_unavailable`. +Every Connectors API endpoint lives under `/v1/connectors` (OpenAPI tag `Connectors`) on Go, Pro, and Enterprise plans. Personal teams receive [`feature_unavailable`](/errors/feature_unavailable). -The connectors API lets a team register tool sources, connect accounts, set policy rules, and run tools. Every operation sits under `/v1/connectors` with the `Connectors` tag. For concepts, dashboard workflows, and Space roles, see [Connectors](/connectors). +For concepts, dashboard workflows, Space roles, CLI commands, and MCP tool execution, see [Connectors](/connectors). For full request and response schemas, see the [REST API reference](/api/reference). ## Scopes and team selection @@ -23,340 +22,28 @@ The connectors API lets a team register tool sources, connect accounts, set poli A signed-in session compiles scopes from the caller's team role: team owners and admins receive all three scopes, and team members receive `connectors:read` and `connectors:execute`. Team policy rules and per-credential connection limits still apply to every member call. -To limit an API key to specific connections, pass `connectorAccess: { connectionIds: ["cxn_…"] }` when creating or updating the key (`POST /v1/api-keys` or `PATCH /v1/api-keys/{apiKeyId}`). Send `connectorAccess: null` to remove the limit. OAuth grants can be limited to specific connections on the consent screen or updated later on **Connected apps**. See [Authentication](/api/authentication). +Connector routes are team-scoped and carry no team ID in the path. Pass `?team=` whenever your credential can access more than one team; omitting it returns `team_required`. -Connector routes are team-scoped but carry no team in the path. Pass `?team=` when your credential can act for more than one team. Without it, the request fails with `team_required`. A team without connectors access answers `feature_unavailable`. +## Restrict a credential to specific connections -## Register a connector +To limit an API key to specific connections, pass `connectorAccess: { connectionIds: ["cxn_…"] }` when calling [`createApiKey`](/api/reference/account/createapikey) or [`updateApiKey`](/api/reference/account/updateapikey). Pass `connectorAccess: null` to lift the restriction. OAuth grants can be limited to specific connections on the consent screen or updated later on **Connected apps**. See [Authentication](/api/authentication). - +## Key operations -```bash curl -curl -sS -X POST "https://api.spacefast.com/v1/connectors?team=acme" \ - -H "Authorization: Bearer $SPACEFAST_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "slug": "widgets", - "title": "Widgets", - "source": { "kind": "openapi", "specUrl": "https://api.example.com/openapi.json" } - }' -``` - -```ts SDK -const connector = await client.post("/v1/connectors", { - query: { team: "acme" }, - body: { - slug: "widgets", - title: "Widgets", - source: { kind: "openapi", specUrl: "https://api.example.com/openapi.json" }, - }, -}); -``` - - - -| Field | Type | What it does | -| --- | --- | --- | -| `slug` | string | Team-unique slug and tool namespace. 1 to 64 characters matching `^[a-z0-9][a-z0-9-]*$`. Required. It can't be `add`, `browse`, `catalog`, `connections`, `detect`, `policies`, `runs`, `spacefast`, or `tools` | -| `title` | string | Display name, 1 to 255 characters. Required | -| `description` | string | Agent-visible note, up to 1,000 characters | -| `source` | object | `{ kind: "openapi", specUrl \| spec, baseUrl? }`, `{ kind: "graphql", endpoint }`, or `{ kind: "mcp", endpoint }`. Required unless `presetId` carries one | -| `presetId` | string | A catalog row `id`. It supplies the source and the authentication recipe | -| `authMethods` | array | Override the authentication the source declares. Each item is an object with `kind` (`api_key`, `oauth2`, `none`, or `first_party`), `slug`, and `label` | -| `specOverrides` | array | Up to 200 RFC 6902 JSON Patch operations applied to the fetched spec | - -The call fetches the source, builds the tool list, and answers `201` with the connector. An MCP endpoint must be remote. Spacefast asks it how it authenticates, so a server that wants OAuth gets an `oauth2` method. - -```json -{ - "data": { - "slug": "widgets", - "title": "Widgets", - "description": null, - "source": "openapi", - "sourceUrl": "https://api.example.com/openapi.json", - "firstParty": false, - "presetId": null, - "authMethods": [{ "kind": "api_key", "slug": "api_key", "label": "API key" }], - "toolCount": 12, - "connections": [], - "specSyncedAt": "2026-10-24T09:14:02.111Z", - "createdAt": "2026-10-24T09:14:02.111Z", - "updatedAt": "2026-10-24T09:14:02.111Z" - } -} -``` - -To find what is behind a URL first, call `detectConnectorSource` with `{ "url": "..." }`. It answers an array of candidates, most confident first. Each carries `kind`, `confidence` (`high`, `medium`, or `low`), `endpoint`, `title`, `slug`, and `presetId`. Register the `endpoint`, which can differ from the URL you sent. - -The catalog lists curated presets, the public registry, and the team's own connectors. Filter it with `query`, `surface` (`openapi`, `graphql`, `mcp`), and `kind` (`preset`, `registry`, `team`). Each row carries `alreadyAdded` and `connectorSlug`. Pass a row's `id` as `presetId` to register it. A row with `endpointInputRequired: true` also needs a `source` with the provider-specific endpoint. - -| Operation | Path | Scope | +| Action | Operation | Route | | --- | --- | --- | -| [`getConnectorCatalog`](/api/reference/connectors/getconnectorcatalog) | `GET /v1/connectors/catalog` | `connectors:read` | -| [`detectConnectorSource`](/api/reference/connectors/detectconnectorsource) | `POST /v1/connectors/detect` | `connectors:write` | -| [`registerConnector`](/api/reference/connectors/registerconnector) | `POST /v1/connectors` | `connectors:write` | -| [`listConnectors`](/api/reference/connectors/listconnectors) | `GET /v1/connectors` | `connectors:read` | -| [`getConnector`](/api/reference/connectors/getconnector) | `GET /v1/connectors/{connectorRef}` | `connectors:read` | -| [`updateConnector`](/api/reference/connectors/updateconnector) | `PATCH /v1/connectors/{connectorRef}` | `connectors:write` | -| [`deleteConnector`](/api/reference/connectors/deleteconnector) | `DELETE /v1/connectors/{connectorRef}` | `connectors:write` | -| [`getConnectorCatalogLogo`](/api/reference/connectors/getconnectorcataloglogo) | `GET /v1/connectors/catalog/logo/{domain}` | none | - -`updateConnector` accepts `title`, `description`, `refreshSpec`, and `specOverrides`. `refreshSpec: true` fetches the source again and rebuilds the tools. Connections and policy rules survive it. `deleteConnector` disconnects every account on the connector, then removes it. A connector with `firstParty: true` cannot be removed. - -Registration, detection, and source refreshes share one budget of 60 per team per hour. Past it, requests fail with `429` and `rate_limited`. See [Rate limits](/api/rate-limits). - -## Connect an account - -```bash -curl -sS -X POST "https://api.spacefast.com/v1/connectors/connections?team=acme" \ - -H "Authorization: Bearer $SPACEFAST_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "connector": "widgets", - "owner": "team", - "credential": { "kind": "api_key", "value": "sk_example_key" } - }' -``` - -| Field | Type | What it does | -| --- | --- | --- | -| `connector` | string | Connector slug. Required | -| `owner` | `team` or `personal` | `team` shares it with the team. `personal` keeps it yours, within this team. Required | -| `displayName` | string | Label, 1 to 255 characters. Defaults to the connector's title | -| `description` | string | Agent-visible note, up to 1,000 characters | -| `authMethod` | string | Auth method slug. Required only when more than one method applies | -| `credential` | object | `{ kind: "api_key", value }` or `{ kind: "fields", values }`. Omit it and the server says what it needs | -| `returnPath` | string | Same-origin dashboard path to land on after authorization. Up to 512 characters, starting with `/` | - -Credentials are write-only. No endpoint ever returns one. Only a person can create a `personal` connection. An API key gets `connection_forbidden`. - -The `200` answer has one of three `status` values. Branch on it. - -```json -{ "data": { "status": "connected", "connection": { "id": "cxn_3f9c2d1a4b5e6f70", "status": "active" } } } -``` - -```json -{ - "data": { - "status": "authorization_required", - "connection": { "id": "cxn_3f9c2d1a4b5e6f70", "status": "pending_authorization" }, - "authorizeUrl": "https://provider.example.com/oauth/authorize?state=example", - "expiresAt": "2026-10-24T09:24:02.111Z" - } -} -``` - -```json -{ - "data": { - "status": "input_required", - "connector": "widgets", - "authMethod": "api_key", - "fields": [{ "name": "value", "label": "API key", "secret": true, "required": true, "guidance": null }] - } -} -``` - -The connection objects above are shortened. For `authorization_required`, send the person to `authorizeUrl`. The provider callback completes the connection, and the dashboard calls `completeConnection` with the `state` and `code`. For `input_required`, nothing was created. Collect `fields`, then call again with `credential.values` and the same `authMethod`. `getConnectorCredentialGuidance` returns the provider's help for a domain: `label`, `mintUrl`, `docsUrl`, `notes`, and `steps`. - -A connection carries `id`, `connector`, `owner`, `displayName`, `description`, `status`, `identityLabel`, `credentialConfigured`, `authMethod`, `scopes`, `isDefault`, `serving`, `servingRequest`, `toolCount`, `createdBy`, `lastCheckedAt`, `revokedAt`, `createdAt`, and `updatedAt`. `status` is `pending_authorization`, `active`, `degraded`, `needs_reauth`, or `revoked`. `isDefault` is true when this is the only live connection on its connector, so an agent that names the connector alone gets it. Nobody sets it. - -| Operation | Path | Scope | -| --- | --- | --- | -| [`createConnection`](/api/reference/connectors/createconnection) | `POST /v1/connectors/connections` | `connectors:write` | -| [`completeConnection`](/api/reference/connectors/completeconnection) | `POST /v1/connectors/connections/complete` | `connectors:write` | -| [`getConnectorCredentialGuidance`](/api/reference/connectors/getconnectorcredentialguidance) | `GET /v1/connectors/catalog/{domain}/guidance` | `connectors:read` | -| [`listConnections`](/api/reference/connectors/listconnections) | `GET /v1/connectors/connections` | `connectors:read` | -| [`getConnection`](/api/reference/connectors/getconnection) | `GET /v1/connectors/connections/{connectionId}` | `connectors:read` | -| [`updateConnection`](/api/reference/connectors/updateconnection) | `PATCH /v1/connectors/connections/{connectionId}` | `connectors:write` | -| [`checkConnectionHealth`](/api/reference/connectors/checkconnectionhealth) | `POST /v1/connectors/connections/{connectionId}/health` | `connectors:read` | -| [`refreshConnection`](/api/reference/connectors/refreshconnection) | `POST /v1/connectors/connections/{connectionId}/refresh` | `connectors:write` | -| [`reconnectConnection`](/api/reference/connectors/reconnectconnection) | `POST /v1/connectors/connections/{connectionId}/reconnect` | `connectors:write` | -| [`disconnectConnection`](/api/reference/connectors/disconnectconnection) | `POST /v1/connectors/connections/{connectionId}/disconnect` | `connectors:write` | - -`listConnections` filters by `owner` (`team`, `personal`, or `any`, the default), `connector`, `status`, and `includeRevoked`. `updateConnection` changes `displayName`, `description`, and `serving`. It cannot change a credential. `reconnectConnection` takes an optional `credential`, answers with the same three statuses as `createConnection`, and keeps the connection's id, label, policy rules, and Space bindings. `checkConnectionHealth` returns `connectionId`, `status`, `reachable`, `latencyMs`, `detail`, `toolCount`, and `checkedAt`. `refreshConnection` reads the provider's tools again. `disconnectConnection` purges the credential and marks the connection `revoked`. Calling it again changes nothing. - -A connection the credential may not use answers `404`, the same as one that does not exist. - -## Read tools and policy - -A tool address is `/`. While exactly one usable connection matches, `/` also works. A second usable connection turns the short form into `connection_ambiguous`, and no connection is then the default. - -Each tool carries `address`, `name`, `summary`, `safety` (`read_only`, `write`, or `destructive`), `effect`, `decidedBy`, and `inputSchema`. `effect` is the policy result: `approve`, `require_approval`, or `block`. `decidedBy` is `{ ruleId, pattern, owner }`, or `null` when the tool's own default applied. - -A policy rule has `id`, `pattern`, `action`, `owner`, `position`, and `createdAt`. - -| `pattern` | Matches | -| --- | --- | -| `*` | Every tool | -| `/*` | Every tool on every connection of one connector | -| `/` | One tool on every connection of one connector | -| `/*` | Every tool of one connection | -| `/` | One tool on one connection | - -The server sets `position` from the pattern's specificity, so the most specific rule wins. A `team` rule is a floor that a `personal` rule can tighten but never loosen. Only a person can create a `personal` rule. A rule's `pattern` and `owner` are fixed. `updateConnectorPolicy` changes `action` only. - -```bash -curl -sS "https://api.spacefast.com/v1/connectors/policies/resolve?team=acme&address=cxn_3f9c2d1a4b5e6f70/charges.create" \ - -H "Authorization: Bearer $SPACEFAST_API_KEY" -``` - -```json -{ - "data": { - "address": "cxn_3f9c2d1a4b5e6f70/charges.create", - "effect": "require_approval", - "decidedBy": { "ruleId": "pol_example", "pattern": "*", "owner": "team" }, - "explanation": "The team rule \"*\" resolves this address to require_approval." - } -} -``` - -| Operation | Path | Scope | -| --- | --- | --- | -| [`listConnectorTools`](/api/reference/connectors/listconnectortools) | `GET /v1/connectors/{connectorRef}/tools` | `connectors:read` | -| [`listConnectionTools`](/api/reference/connectors/listconnectiontools) | `GET /v1/connectors/connections/{connectionId}/tools` | `connectors:read` | -| [`listConnectorPolicies`](/api/reference/connectors/listconnectorpolicies) | `GET /v1/connectors/policies` | `connectors:read` | -| [`createConnectorPolicy`](/api/reference/connectors/createconnectorpolicy) | `POST /v1/connectors/policies` | `connectors:write` | -| [`updateConnectorPolicy`](/api/reference/connectors/updateconnectorpolicy) | `PATCH /v1/connectors/policies/{policyRuleId}` | `connectors:write` | -| [`deleteConnectorPolicy`](/api/reference/connectors/deleteconnectorpolicy) | `DELETE /v1/connectors/policies/{policyRuleId}` | `connectors:write` | -| [`resolveConnectorPolicy`](/api/reference/connectors/resolveconnectorpolicy) | `GET /v1/connectors/policies/resolve` | `connectors:read` | - -The tool lists filter by `query` and `effect`. - -## Run a tool - -```bash -curl -sS -X POST "https://api.spacefast.com/v1/connectors/runs?team=acme" \ - -H "Authorization: Bearer $SPACEFAST_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "input": { "kind": "tool", "address": "cxn_3f9c2d1a4b5e6f70/issues.list", "args": { "limit": 5 } }, - "idempotencyKey": "list-issues-1" - }' -``` - -| Field | Type | What it does | -| --- | --- | --- | -| `input` | object | `{ kind: "tool", address, args? }` for one call, or `{ kind: "code", code }` for a program. Required | -| `waitMs` | integer | How long to wait for a final status, 0 to 120000. Defaults to 30000 | -| `idempotencyKey` | string | Retry with the same key to get the original run back, 1 to 320 characters | -| `unattendedApprovals` | `park` or `deny` | When a call needs approval: park it, the default, or fail at once | - -`args` is validated against the tool's `inputSchema` and defaults to `{}`. A program can call any tool the credential may use, and it runs for at most 10 seconds. - -A new run answers `201`, whatever its `status` when the wait ends. A retry with the same `idempotencyKey` and the same input answers `200` with the original run. The same key with a different input fails with `409` and `idempotency_key_reused`. - -A run that fails is not an HTTP error. The request succeeded and the run did not, so read `status`. - -```json -{ - "data": { - "id": "cxr_8c1d4a7f2e6b0c3d", - "status": "awaiting_approval", - "origin": "api", - "space": null, - "handler": null, - "visitor": false, - "input": { "kind": "tool", "address": "cxn_3f9c2d1a4b5e6f70/issues.create", "digest": "sha256-example" }, - "usage": { "toolCalls": 0, "egressBytes": 0, "durationMs": 41 }, - "createdAt": "2026-10-24T09:14:02.111Z", - "approval": { - "decisionId": null, - "mode": "human", - "address": "cxn_3f9c2d1a4b5e6f70/issues.create", - "preview": { "title": "Broken link on pricing page" }, - "reason": "policy_require_approval", - "matchedPattern": "*", - "approvalUrl": "https://my.spacefast.com/approvals?run=cxr_8c1d4a7f2e6b0c3d", - "expiresAt": "2026-10-24T09:29:02.111Z" - } - } -} -``` - -| `status` | Extra fields | Meaning | -| --- | --- | --- | -| `running` | none | Still working. Read the run again | -| `awaiting_approval` | `approval` | Parked on a decision | -| `succeeded` | `completedAt`, `result` | Done | -| `failed` | `completedAt`, `error` | Done. `error` is a problem document with `code`, `status`, and `detail` | -| `expired` | `completedAt` | Parked for 15 minutes with no decision. Submit it again | - -`input` never echoes the arguments. `approval.preview` masks values whose keys look like secrets. `approval.reason` is `policy_require_approval` when a rule parked the call, or `annotation_requires_approval` when the tool asked for approval itself. - -| Operation | Path | Scope | -| --- | --- | --- | -| [`createConnectorRun`](/api/reference/connectors/createconnectorrun) | `POST /v1/connectors/runs` | `connectors:execute` | -| [`getConnectorRun`](/api/reference/connectors/getconnectorrun) | `GET /v1/connectors/runs/{runId}` | `connectors:read` | -| [`listConnectorRuns`](/api/reference/connectors/listconnectorruns) | `GET /v1/connectors/runs` | `connectors:read` | -| [`resumeConnectorRun`](/api/reference/connectors/resumeconnectorrun) | `POST /v1/connectors/runs/{runId}/resume` | `connectors:execute` | - -`listConnectorRuns` returns the team's runs newest first, and filters by `status`, `origin`, `space`, and `connection`. `status=awaiting_approval` lists the runs waiting on a decision. - -Runs share a budget of 1,200 per team per hour. Past it, requests fail with `429` and `rate_limited`. - -## Resume a parked run - -`resumeConnectorRun` takes `action` (`accept`, `decline`, or `cancel`) and `content`, the values a parked call asked for. A `decline` or `cancel` fails the run with `connector_approval_declined`. - -A run parked in `human` mode refuses a decision from an API key or an agent with `human_approval_required`. A person decides at `approvalUrl`, which executes the call and settles the run. Read the settled status and `result` with `getConnectorRun` (`sf connectors run inspect `). Calling `resumeConnectorRun` on a settled run fails with `connector_run_not_resumable`, and calling it without an `action` before a decision fails with `connector_approval_required`. +| Register a connector source | [`registerConnector`](/api/reference/connectors/registerconnector) | `POST /v1/connectors` | +| Create an account connection | [`createConnection`](/api/reference/connectors/createconnection) | `POST /v1/connectors/connections` | +| Set team policy rules (`approve`, `require_approval`, `block`) | [`createConnectorPolicy`](/api/reference/connectors/createconnectorpolicy) | `POST /v1/connectors/policies` | +| Run a tool or multi-tool sandbox program | [`createConnectorRun`](/api/reference/connectors/createconnectorrun) | `POST /v1/connectors/runs` | +| Resume a run paused on approval | [`resumeConnectorRun`](/api/reference/connectors/resumeconnectorrun) | `POST /v1/connectors/runs/{runId}/resume` | ## Errors -Every failure is an RFC 9457 problem document. See [Errors](/api/errors). - -| Code | Status | When | +| Code | Status | Cause | | --- | --- | --- | -| `team_required` | 422 | The credential can act for several teams and `team` is missing | -| `feature_unavailable` | 422 | Connectors are turned off for the team | -| `connector_slug_taken` | 409 | The team already has a connector with that slug | -| `connector_source_unreachable` | 422 | The source did not load when registering or refreshing | -| `connector_source_blocked` | 422 | The source URL is not reachable from Spacefast | -| `connector_source_invalid` | 422 | `source.kind` does not match the catalog row named by `presetId` | -| `connector_not_found` | 422 | `presetId` matches no catalog row, or a policy pattern names an unknown connector or connection | -| `connector_first_party_immutable` | 409 | The connector is built into Spacefast | -| `connection_forbidden` | 422 | An API key asked for a `personal` connection or rule | -| `connection_needs_reauth` | 409 | A health probe found no credential, or the authorization is not finished | -| `connection_needs_reauth` | 422 | Connecting failed: the method doesn't fit the connector or the credential, the authorization failed, or the sign-in expired | -| `connection_revoked` | 409 | The connection is disconnected | -| `connection_serving_not_granted` | 422 | `serving` was set on a personal connection | -| `malformed_policy_pattern` | 422 | The pattern does not fit the grammar | -| `malformed_tool_address` | 422 | `resolveConnectorPolicy` got an address that does not resolve | -| `idempotency_key_reused` | 409 | The run key was used with a different input | -| `human_approval_required` | 403 | A non-person tried to decide a run parked for a person | -| `connector_approval_required` | 422 | No decision is recorded yet | -| `connector_run_not_resumable` | 409 | The run already settled, or the decision was already claimed | -| `rate_limited` | 429 | The team passed the hourly budget for registrations or runs | - -These codes appear in a failed run's `error`, inside a successful HTTP response (`200` or `201`): - -| Code | Status in `error` | When | -| --- | --- | --- | -| `connector_tool_blocked` | 403 | A `block` rule matched | -| `connector_approval_declined` | 403 | A person declined or canceled the parked call | -| `connector_approval_required` | 403 | The call needed approval and `unattendedApprovals` was `deny` | -| `connection_ambiguous` | 409 | A `/` address matched more than one connection | -| `connection_not_found` | 404 | The address names no connection the credential can use | -| `connection_forbidden` | 403 | The credential may not use that connection | -| `connection_needs_reauth` | 401 | The provider refused the stored credential. Reconnect it | -| `connector_tool_not_found` | 404 | The connection has no tool by that name | -| `connector_tool_failed` | varies | The provider call failed | -| `connector_program_failed` | 422 | A code program threw | -| `connector_run_budget_exhausted` | 429 | The run passed its budget of 400 outbound requests or 64 MiB read | -| `run_replay_diverged` | 409 | A resumed program made different calls than before the pause | - -## Space bindings, serving, and agents - -A Space manages its connector roles, bindings, serving requests, public-serving allowances, and visitor connections under the `Spaces` tag: - -- **Roles:** `getSpace` (for the current `config` overlay and `settingsDigest`) and `updateSpace` (sending the full `config` with your `config.connectors` change and `settingsDigest` as `baseSettingsDigest`, because `config` replaces the stored settings overlay). -- **Bindings:** `listSpaceConnectorBindings`, `bindSpaceConnector`, and `unbindSpaceConnector`. -- **Space serving:** `requestSpaceConnectorServing`, `listConnectorServingRequests`, `approveConnectorServingRequest`, `denyConnectorServingRequest`, and `setSpaceConnectorPublicServing`. -- **Visitor connections:** `listVisitorConnectionUsers` and `revokeVisitorConnection`. - -See [Connectors](/connectors) for the Space workflow. - -Hosted MCP exposes no connector operations. On-device MCP, `sf mcp`, reaches connectors through one gateway tool, `search_connector_tools`. See [MCP server](/agents/mcp-server). +| [`feature_unavailable`](/errors/feature_unavailable) | `403` | Team plan does not include Connectors | +| `team_required` | `400` | Credential can act for multiple teams and `?team=` was omitted | +| `connector_policy_blocked` | `403` | Team policy blocks this tool call | +| [`approval_policy_blocked`](/errors/approval_policy_blocked) | `403` | Approval policy or Emergency Pause blocked the action | +| `connector_approval_required` | `202` / `403` | Run parked waiting on a Team Review decision in [Approvals](/approvals) | diff --git a/content/(reference)/api/errors.mdx b/content/(reference)/api/errors.mdx index 09ba6ac8..87b0ff9c 100644 --- a/content/(reference)/api/errors.mdx +++ b/content/(reference)/api/errors.mdx @@ -5,7 +5,7 @@ description: RFC 9457 problem documents, the stable error code, pointer semantic Every failure from this API is an RFC 9457 problem document with a stable `code`, letting you branch on that code, point a user at the exact bad field, and decide whether to retry. -## The shape +## Problem Details format Failures answer `Content-Type: application/problem+json`. Nothing else. That covers validation failures, rate limits, IP blocks, and the 404 catch-all alike. diff --git a/content/(reference)/api/pagination.mdx b/content/(reference)/api/pagination.mdx index 3a040d61..07e8ab3b 100644 --- a/content/(reference)/api/pagination.mdx +++ b/content/(reference)/api/pagination.mdx @@ -41,7 +41,7 @@ Ordering belongs to the endpoint. Versions are newest first, while storage objec A cursor is an opaque continuation value. Do not parse it, build one, or store it as a durable bookmark. Pass back exactly what you got. -## The loop +## Paginate through all results Stop when `nextCursor` is `null`. Never re-send a cursor you have already used. If the response hands back the same cursor you sent, that's a broken page, not the end. Looping on it spins forever. Treat it as an error. diff --git a/content/(reference)/api/rate-limits.mdx b/content/(reference)/api/rate-limits.mdx index 3ec6e360..a10227a2 100644 --- a/content/(reference)/api/rate-limits.mdx +++ b/content/(reference)/api/rate-limits.mdx @@ -5,7 +5,7 @@ description: The per-credential and per-IP request budgets, hourly publish and b Two layers of limits sit in front of the API: a general per-minute request budget (600 per minute per credential, 300 per minute per IP), and hourly budgets on expensive actions. Use the rate-limit headers when present; they can be absent when accounting is unavailable. -## The general budget +## Default request budget A fixed 60-second window applies to every `/v1` request: @@ -55,7 +55,7 @@ A credential-free `POST /v1/publish` pays its own budgets instead. The first three fail with `anonymous_publish_rate_limited`. -## What a 429 looks like +## Rate-limit response (`429`) ```json { diff --git a/content/(reference)/api/versioning.mdx b/content/(reference)/api/versioning.mdx index 89fa1a99..1d2008ba 100644 --- a/content/(reference)/api/versioning.mdx +++ b/content/(reference)/api/versioning.mdx @@ -5,6 +5,8 @@ description: How Spacefast versions the REST API under /v1, tracks OpenAPI contr The Spacefast API versions routes in the URL path under `/v1`, and the OpenAPI specification stamps each published contract snapshot in `info.version`. Spacefast marks deprecated operations in the specification and sends standard `Deprecation`, `Sunset`, and `Link` headers on live responses. +Use the [upgrade guide](/upgrading) to replace deprecated routes and update client code. + ## URL path version Every public API operation lives under `/v1` on `https://api.spacefast.com`. diff --git a/content/(reference)/api/webhooks.mdx b/content/(reference)/api/webhooks.mdx index e94e1c89..413ed046 100644 --- a/content/(reference)/api/webhooks.mdx +++ b/content/(reference)/api/webhooks.mdx @@ -116,7 +116,7 @@ comment.unarchived Only failed cron runs are reported. A successful run is silent. Variable events name the key and never the value. -## The delivery +## Delivery payload and headers Spacefast `POST`s `application/json` with three extra headers. diff --git a/content/(reference)/cli/index.mdx b/content/(reference)/cli/index.mdx index e651add0..0fbd077e 100644 --- a/content/(reference)/cli/index.mdx +++ b/content/(reference)/cli/index.mdx @@ -5,6 +5,8 @@ description: Install sf, authenticate, and use the shared contract for global fl `sf` publishes folders and projects to Spacefast and manages versions, domains, access, data, teams, and agent tooling. Every command shares the same global flags, `--json` receipt format, and exit-code table. For every command's full arguments and flags, see the [CLI command reference](/cli/reference). +Use the [upgrade guide](/upgrading) to update commands, configuration, and automation from earlier releases. + ## Install Install the npm package globally with Node.js 22.19 or newer: diff --git a/content/(reference)/config-file.mdx b/content/(reference)/config-file.mdx index 8dcc90b3..b8a123de 100644 --- a/content/(reference)/config-file.mdx +++ b/content/(reference)/config-file.mdx @@ -155,7 +155,7 @@ Every top-level key accepted by `spacefast.config.ts` and `sf.jsonc`: | `build` | object | Repository and local build commands, directories, presets, and timeout | [Publish from Git](/git) | | `placement` | `{ burstable?, edge? }` | Worker bursting and opt-in edge placement for eligible redirects and headers | [Infrastructure](/infrastructure) | | `markdownNegotiation` | boolean | Accepted flag; runtime enforcement is not active yet | — | -| `system` | object | Control-plane manifest for a Partner API tenant's system Space | [Partner configuration](/platforms/partner-api/configuration) | +| `system` | object | Partner tenant configuration for a Partner API system Space | [Partner configuration](/platforms/partner-api/configuration) | ## Key details @@ -185,7 +185,7 @@ Rules declared in Space settings (through the dashboard, CLI, or API) match ahea One `runtime` block per version, discriminated on `kind`: - `kind: "functions"`: optional `entry` (auto-detected from `.open-next/worker.js`, `handler.ts`/`js`/`mjs`, or `functions/` when omitted; naming a missing file fails publish) and optional `compatibilityDate` (`YYYY-MM-DD`). See [Functions](/functions). -- `kind: "zero"`: `server` (required) and `client` (defaults to the scaffold entry). See [Migrating from Zero 0.8](/zero-migration). +- `kind: "zero"`: `server` (required) and `client` (defaults to the scaffold entry). See [Migrating from Zero 0.8](/guides/zero-migration). `crons` accepts up to 8 entries, each with `path` (literal `/...` path up to 512 chars, no wildcards, placeholders, or query string) and `schedule` (`hourly`, `daily`, `twicedaily`, `weekly`, `Nh`/`Nd`/`Nw`, or a numeric five-field crontab). Your plan determines how many declared crons run; see [Crons](/crons). diff --git a/content/(reference)/glossary.mdx b/content/(reference)/glossary.mdx index 3aa5ee1a..61e4d74c 100644 --- a/content/(reference)/glossary.mdx +++ b/content/(reference)/glossary.mdx @@ -1,9 +1,41 @@ --- title: Glossary -description: Core Spacefast terms used across these docs, defined in one place +description: Canonical Spacefast product names, exact casing, and core platform terms defined in one place --- -Core terms used across the Spacefast documentation, with links to the guides that explain each one in detail. +Canonical Spacefast product names and core platform terms, defined once here so guides stay concise and link back instead of repeating definitions. + +## Products and features + +Use these exact names and casing in public prose. Keep package names, commands, URLs, and config keys lowercase inside code spans. + +| Canonical name | How to write it in prose | Primary docs page | +| --- | --- | --- | +| **Spacefast** | Capitalized `S`, lowercase `f`. Keep this exact casing in prose, and describe Spacefast by what it does (publish, serve, live, infrastructure, or runtime). | [Introduction](/) | +| **Space** | Always capitalized `Space` (plural `Spaces`) for the Spacefast resource; never say "site" for a Space. | [Spaces](/spaces) | +| **SpacePress** | Capital `S`, capital `P`, one word. Managed application server on Spacefast (no custom origin code, plugins, or themes outside SpacePress). | [Build on a Space](/build) | +| **SpacePress Admin** | Capital `S`, `P`, `A`. The modern block editor interface at `/wp-admin/new/`. | [WordPress and Content API](/wordpress) | +| **Spacefast CLI** (`sf`) | Write "Spacefast CLI" or `` `sf` `` in code spans. | [sf CLI](/cli) | +| **Spacefast Builds** | Remote source builds and framework detection. Never name internal sandbox vendors. | [Frameworks and builds](/guides/frameworks) | +| **Spacefast DNS** | Managed DNS zones, record management, and Domain Connect. | [DNS management](/domains/dns) | +| **Spacefast Share** | Grants, share links, passwords, invitations, and visitor sign-in on Spaces. | [Spacefast Share](/share) | +| **Spacefast Stats** | Private Beta browser visitor analytics (**Now**, **Trends**, and the on-Space Stats drawer). Distinguish from **edge traffic stats**. | [Stats](/stats) | +| **Spacefast Tag Manager** | Governed tag revisions, preview sessions, consent policy, and releases (short form: **Tag Manager**). | [Tag Manager](/tag-manager) | +| **Spacefast for Platforms** | Multi-tenant offering and Partner API for external platforms publishing customer Spaces. | [Spacefast for Platforms](/platforms) | +| **Sign in with Spacefast** | Exact title phrase (`Sign in with Spacefast`) for visitor sign-in on private Spaces, SpacePress `/__spacefast/sign-in`, and OAuth apps (`sf oauth-apps`). | [Spacefast Share](/share#sign-in-with-spacefast) | +| **Drop** | Drag-and-drop browser publish flow at `drop.fast`. | [Publish](/publish) | +| **Functions** / **Worker** | **Functions** is the serverless runtime; a **Worker** is the compiled JavaScript/TypeScript handler it runs (`functions/`, `handler.ts`, or `"use worker";`). | [Workers](/functions) | +| **Connectors** | Team-scoped connections to external REST, GraphQL, and MCP services with server-sealed credentials. | [Connectors](/connectors) | +| **Traffic Rules** | Edge firewall and cache-bypass rules declared in `spacefast.config.ts` or Space settings. | [Traffic Rules and firewall](/traffic-rules) | +| **Page Enhancements** | Platform-injected UI and tooling on rendered HTML pages (Tag Manager, browser stats, Remix pill, Space bar, and Comments). | [Customization](/customization) | +| **Per-Space Boost** | Optional `$9/month` add-on for one Go or Pro Space raising compute, crons, email, and custom certificates (short form: **Boost**). | [Pricing and limits](/pricing#per-space-boost) | +| **Labs** | Team opt-in program under **Team settings → Labs** for early Private Beta features. | [Labs](/labs) | +| **Team Memories** | Labs feature storing lasting team facts and preferences loaded automatically by connected agents. | [Team Memories](/team-memories) | +| **Team Skills** | Labs feature enabling reusable team practices (such as SEO or accessibility) for connected agents. | [Team Skills](/team-skills) | +| **Design System** | Labs feature storing team colors, typography, layout, voice, and brand assets for agents. | [Design System](/design-system) | +| **Poppy** | Personal Agent Protocol (`Poppy 1.0`) for agent OAuth, discovery (`/.well-known/poppy.json`), and scoped browser sessions. | [Poppy](/agents/poppy) | +| **Partner API** | The `partner` OpenAPI surface used by platform integrators to provision and manage customer Spaces. | [Partner API](/platforms/partner-api) | +| **Zero** | Earlier transactional app runtime replaced by SpacePress for new apps. Deployed Zero 0.8 Spaces keep serving. | [Migrating from Zero 0.8](/guides/zero-migration) | ## Ability @@ -15,11 +47,11 @@ A server-side `query()` or `mutation()` handler in `sp/` (or declared under `app ## Build -The step that turns project source code into publishable output. You can build locally with `sf build` or let Spacefast build remotely from a connected Git repository. See [Frameworks](/guides/frameworks). +The step that turns project source code into publishable output. You can build locally with `sf build` or let Spacefast Builds compile remotely from a connected Git repository. See [Frameworks and builds](/guides/frameworks). ## Capsule -The compiled server bundle of a legacy Zero 0.8 application. `sf publish` compiles Zero TypeScript server code into a capsule that installs onto the Space alongside its database. See [Migrating from Zero 0.8](/zero-migration). +The compiled server bundle of a legacy Zero 0.8 application. `sf publish` compiles Zero TypeScript server code into a capsule that installs onto the Space alongside its database. See [Migrating from Zero 0.8](/guides/zero-migration). ## Channel @@ -31,7 +63,11 @@ Attaching an anonymous Space (published without an account) to a Spacefast accou ## Collection -A structured content type declared under `app.collections` in `spacefast.config.ts` (or `spacepress.config.ts`), backed by your Space's database with typed fields and access rules. See [Collections](/collections). +A structured content type declared with `collection()` under `sp/` (or `app.collections` in `spacefast.config.ts`), backed by managed WordPress with typed fields, drafts, revisions, staged versions, comments, and access rules. See [Collections and CMS](/collections). + +## Deploy token + +A Space-scoped `sfm_` machine credential created with `sf deploy-tokens create` for CI pipelines or scripts targeting one Space. See [API keys and tokens](/api-keys#deploy-tokens). ## Drop @@ -39,11 +75,11 @@ The drag-and-drop publish flow at [drop.fast](https://drop.fast): drag a folder, ## Functions -The runtime that runs a [Worker](#worker) alongside your Space's static files, supporting npm packages, framework server output (including OpenNext Next.js), and outbound HTTP. See [Functions](/functions). +The runtime that runs a [Worker](#worker) alongside your Space's static files, supporting npm packages, framework server output (including OpenNext Next.js), and outbound HTTP. See [Workers](/functions). ## Grant -One rule in a Space's access list naming an audience (`public`, `team`, a named person, a share link, a password, a machine credential, or an external identity), a role, route patterns, and a target. Grants are additive; a Space with no matching Grants is private. See [Share and access](/share). +One rule in a Space's access list naming an audience (`public`, `team`, a named person, a share link, a password, a machine credential, or an external identity), a role, route patterns, and a target. Grants are additive; a Space with no matching Grants is private. See [Spacefast Share](/share). ## Live (the live channel) @@ -57,9 +93,13 @@ The Personal Agent Protocol (`Poppy 1.0`) supported by Spacefast so personal age A container for versions, domains, data, and access settings, served at its own hostname. A Space can exist before anything is published. Custom domains belong to a team and are assigned to a Space. See [Spaces](/spaces). +## Space key + +The `sfc_` credential returned when publishing an unclaimed anonymous Space. It authorizes updates to that Space and claiming it into a team. See [API keys and tokens](/api-keys#every-credential-by-prefix). + ## SpacePress -The full-stack TypeScript app framework built into every Space. SpacePress compiles collections, SQL tables, typed ORM queries, server actions, background jobs, TSX pages, `"use client"` interactive islands, Markdown sync, and WooCommerce stores into native WordPress and PHP with no Node.js server in production. See [Build on a Space](/build) and [Collections and CMS](/collections). +The managed full-stack TypeScript app framework built into every Space. SpacePress compiles collections, SQL tables, typed ORM queries, server actions, background jobs, TSX pages, `"use client"` interactive islands, Markdown sync, and WooCommerce stores onto Spacefast's managed application server with no Node.js server in production. See [Build on a Space](/build) and [Collections and CMS](/collections). ## Team @@ -67,7 +107,7 @@ The owner of Spaces, domains, API keys, and billing in a self-serve account, eve ## Traffic Rules -Edge firewall and cache-bypass rules declared under `firewall` and `cache.bypass` in `spacefast.config.ts` or in Space settings. Traffic Rules block, challenge, or bypass cache for requests matching attributes such as path, IP, country, headers, cookies, or query parameters before they reach the Space. See [Redirects and rewrites](/redirects). +Edge firewall and cache-bypass rules declared under `firewall` and `cache.bypass` in `spacefast.config.ts` or in Space settings. Traffic Rules block, challenge, or bypass cache for requests matching attributes such as path, IP, country, headers, cookies, or query parameters before they reach the Space. See [Traffic Rules and firewall](/traffic-rules). ## Version @@ -75,8 +115,8 @@ An immutable snapshot created when a publish changes files or configuration. Eve ## Worker -The compiled JavaScript server code run by [Functions](#functions) in an isolated runtime beside a Space's static files. Static assets serve directly from the Space, while a Worker handles the dynamic routes it claims, with access to `env.DB`, storage, connectors, and outbound `fetch()`. See [Functions](/functions). +The compiled JavaScript server code run by [Functions](#functions) in an isolated runtime beside a Space's static files. Static assets serve directly from the Space, while a Worker handles the dynamic routes it claims, with access to `env.DB`, storage, connectors, and outbound `fetch()`. See [Workers](/functions). ## Zero -The earlier transactional app runtime that compiles TypeScript tables, queries, mutations, actions, and HTTP endpoints into a [capsule](#capsule) paired with a MySQL database. New apps declare `collections` and `actions` directly in `spacefast.config.ts` or use [Functions](#functions). See [Migrating from Zero 0.8](/zero-migration). +The earlier transactional app runtime that compiles TypeScript tables, queries, mutations, actions, and HTTP endpoints into a [capsule](#capsule) paired with a MySQL database. New apps use [SpacePress](#spacepress) or [Functions](#functions). See [Migrating from Zero 0.8](/guides/zero-migration). diff --git a/content/(reference)/limits.mdx b/content/(reference)/limits.mdx index b46a4478..6a195ec6 100644 --- a/content/(reference)/limits.mdx +++ b/content/(reference)/limits.mdx @@ -1,6 +1,6 @@ --- -title: Limits -description: Every enforced Spacefast platform limit, anonymous cap, retention window, and rate limit with the error code returned when crossed +title: Platform limits +description: Every enforced Spacefast platform cap, anonymous limit, retention window, and rate limit with the error code returned when crossed --- Platform limits apply identically across every plan, while plan allowances scale per team and per Space on [Pricing and limits](/pricing). diff --git a/content/(reference)/meta.ts b/content/(reference)/meta.ts index 1346796f..604644cb 100644 --- a/content/(reference)/meta.ts +++ b/content/(reference)/meta.ts @@ -3,5 +3,5 @@ import { defineMeta } from "blume"; export default defineMeta({ title: "Reference", collapsed: false, - pages: ["cli", "api", "config-file", "limits", "errors", "glossary", "changelog"], + pages: ["cli", "api", "config-file", "limits", "errors", "glossary", "upgrading", "changelog"], }); diff --git a/content/(reference)/upgrading.mdx b/content/(reference)/upgrading.mdx new file mode 100644 index 00000000..dd2cadcd --- /dev/null +++ b/content/(reference)/upgrading.mdx @@ -0,0 +1,198 @@ +--- +title: Upgrade guide +description: Update Spacefast API clients, CLI scripts, projects, and MCP connections against the current public contracts. +--- + +Upgrade `sf`, then check scripts that parse its receipts or rely on default Space access. Regenerate API clients from the current OpenAPI documents and refresh the tool list in each MCP client. + +## Upgrade checklist + +1. Run `npm install -g spacefast` or `brew upgrade spacefast`, then run `sf --version`. The npm install requires Node.js 22.19 or newer. Standalone binaries include the runtime. See the [CLI installation instructions](/cli). +2. Run `npm install @spacefast/sdk@latest` in each SDK project. Type-check the project and test publish, pagination, and error handling. Read the [SDK reference](/api/sdk). +3. Refresh MCP tools and rerun agent setup if the client still sends cached names. Use [Spacefast setup](https://spacefast.com/setup.md) or run `sf setup agent`. +4. Run `sf check` from the project root before publishing. Validate any config changes and verify access on a preview or test Space. +5. Regenerate REST bindings against [Spacefast OpenAPI](https://api.spacefast.com/openapi.json) or [Partner OpenAPI](https://api.spacefast.com/openapi.partner.json). Check each route, operation ID, required field, success status, and permission your integration uses. + +## Spacefast REST API + +### Replace deprecated operations + +Each row gives the current migration for a legacy operation. A row with two verbs applies independently to each verb. + +| Before | After | +| --- | --- | +| `GET /v1/me/approval-policy` (`getEffectiveApprovalPolicy`) | `GET /v1/approvals/policy` | +| `GET /v1/me/approval-rules` (`listStandingApprovalRules`) | `GET /v1/approvals/rules` | +| `POST /v1/me/approval-rules` (`createStandingApprovalRule`) | `POST /v1/approvals/rules` | +| `DELETE /v1/me/approval-rules/{ruleId}` (`revokeStandingApprovalRule`) | `DELETE /v1/approvals/rules/{ruleId}` | +| `GET` or `PUT /v1/me/grants/{grantId}/approval-policy` (`getGrantApprovalPolicyLegacy`, `setGrantApprovalPolicyLegacy`) | Keep the verb and call `/v1/me/grants/{grantId}/approvals/policy`. | +| `GET` or `PUT /v1/spaces/{spaceId}/approval-policy` (`getSpaceApprovalPolicyLegacy`, `setSpaceApprovalPolicyLegacy`) | Keep the verb and call `/v1/spaces/{spaceId}/approvals/policy`. | +| `GET` or `PUT /v1/teams/{teamId}/approval-policy` (`getTeamApprovalPolicyLegacy`, `setTeamApprovalPolicyLegacy`) | Keep the verb and call `/v1/teams/{teamId}/approvals/policy`. | +| `PATCH /v1/me/dashboard-preferences` (`updateDashboardPreferences`) | Call `PATCH /v1/me/preferences`. Omit keys to keep them. Send `null` to clear a key. Read current preferences from `GET /v1/me`. | +| `GET /v1/spaces/{spaceId}/usage` (`getSpaceUsage`) | Call `GET /v1/teams/{teamId}/usage?spaceId={spaceId}` (`getUsage`) and update the response parser. The legacy route sunsets on February 15, 2027. | +| `GET /v1/spaces/{spaceId}/data-sources` (`listSpaceDataSources`) | Existing Spaces can still read saved sources. For new WordPress connections, set the `WORDPRESS_URL` Space variable. | + +The following Zero app-user operations carry a deprecation marker. The public contract lists no replacement route for these operations. Keep existing Zero calls scoped to the app and plan user migration separately when moving to SpacePress. See [app users](/users) and [migrate from Zero](/guides/zero-migration). + +| Legacy operation | Operation ID | +| --- | --- | +| `GET /v1/spaces/{spaceId}/users` | `listSpaceUsers` | +| `GET /v1/spaces/{spaceId}/users/{userId}` | `getSpaceUser` | +| `PATCH /v1/spaces/{spaceId}/users/{userId}` | `setSpaceUserSuspended` | +| `POST /v1/spaces/{spaceId}/users/{userId}/deletion` | `completeSpaceUserDeletion` | +| `GET /v1/spaces/{spaceId}/users/{userId}/sessions` | `listSpaceUserSessions` | +| `POST /v1/spaces/{spaceId}/users/{userId}/sessions/revoke` | `revokeSpaceUserSessions` | +| `GET /v1/spaces/{spaceId}/users/settings` | `getSpaceUsersSettings` | +| `PATCH /v1/spaces/{spaceId}/users/settings` | `updateSpaceUsersSettings` | + +Log `Deprecation` (a structured date written as `@`), `Sunset` (an HTTP date when scheduled), and the `Link` with `rel="deprecation"`. In automated checks, `sf api --include` prints these headers to stderr. See [versioning and deprecations](/api/versioning). + +For approval policy or Work Mode writes that accept `If-Match`, reuse the latest strong `ETag`. For human decisions, prefer `PATCH /v1/approvals/{approvalId}` over the compatibility approve and deny endpoints. On `412`, read the current settings before applying your edit again. On `approval_policy_blocked`, simulate the action through `POST /v1/approvals/policy/simulate` to identify the rule or pause. See [Approvals](/approvals). + +### Update request and response handling + +| Before | After | +| --- | --- | +| Legacy `/push-new/` or `/v1/anonymous-claim/*` calls | Start with the current [anonymous publish and claim flow](/agents/anonymous-and-claim). Keep the Space key and use the claim routes from the current contract. | +| Deployment reads and promotion scripts | Use version reads, finalize or promote through the version endpoints, and poll any returned operation until it reaches a terminal status. See the [API reference](/api/reference). | +| `links.resume` on a publish receipt | Follow `links.refresh` for more upload instructions. The old alias carries the same URL. | +| Version file `raw`, `content`, `direct-url`, `inline`, or `url-preview` helpers | List files with `GET /v1/spaces/{spaceId}/versions/{versionId}/files`. Use the sibling `files/links` endpoint for current file links. | +| A JSON receipt from API key or individual grant revocation | Handle `204` with an empty body. API key and feedback creation now declare `201`. Version creation can return `200` or `201`. | +| Global `/v1/environment` calls | Use the Space or team `variables` endpoints with the corresponding owner ID. | +| Old access policies, protection flags, invites, or service tokens | Read `GET /v1/spaces/{spaceId}/share` and manage Grants through `/v1/spaces/{spaceId}/share/entries`. Use Share Links, People, password credentials, machine credentials, or an identity connection as appropriate. See [Share](/share). | +| `access: "team"` or `newSpaceGrantPreset: "team"` | Write `private` for access by the owning team. Treat `team` as a legacy API input spelling where the current schema accepts it. | +| Every Space create or publish receipt has `access` | Handle an omitted field. `POST /v1/spaces` supports `capabilities: ["optional_access"]` for clients that handle receipts without a link. A publish receipt can omit `access` when there is no Open link. | +| Source and comparison lists read cursors from `data.pagination` | Send `Accept: application/json; spacefast-list-page=1` and read top-level `pagination`. Keep the header on subsequent page requests. The SDK, current CLI, and MCP request this shape. | +| Rollback assumes the saved routing rules | Set `refreshRewrites: false` to restore the saved version exactly. Rollback refreshes rewrites by default. | +| `thumbnail.sourceUrl` or Space `region` | Read `thumbnail.url` or `dataLocation`. Use a credential that can read Space content when fetching a private thumbnail. | +| `dataSources` and `defaultDataSource` in config writes | Set `WORDPRESS_URL` as a Space variable. Existing configuration can still be read through the legacy route. | +| `spaceId` for GitHub installation and repository lists | Pass `teamId` to `listGithubInstallations` and `listGithubInstallationRepositories`. | +| Team usage `usage` and `spaceStorage` fields | Read `limits` and `spaces[].storageBytes`. The compatibility fields are scheduled for removal on February 15, 2027. | +| Usage budget `workPausePercent` | Remove it from requests. New builds and Worker requests stop at 100% of budget. | +| `move` in domain verification, or `ownership.expiresAt` and `ownership.moveAvailable` | Prove ownership using the claim's TXT record. If you manage both Spaces, remove the domain from the first Space before adding it to the second. | +| A member sign-in `connectionId` points at an identity connection | Supply `issuer`, `clientId`, and `clientSecret` to `PUT /v1/teams/{teamId}/member-sign-in`. Use `enabled: false` to retain setup. `DELETE` removes setup. | +| `askDocs` sends a conversation to `POST /v1/docs/ask` | Send `question` and optional `path` to `POST /v1/docs/answer`. The conversation endpoint is now `continueDocsConversation`. | +| `includeCheckout`, `checkoutUnavailable`, mandatory `checkout`, or top-level billing `stripeCustomerId` and `subscription` | Read `purchase.confirmUrl` for required confirmation. Omit `includeCheckout`, handle a missing `checkout`, and remove reads of the retired fields. | + +The page header applies to `listSpaceSourceCommits`, `listSpaceSourceTags`, `listSpaceSourceBranches`, `listSpaceSourceNotesRefs`, `listSpaceSourceWorkspaces`, `searchSpaceSourceFiles`, and `compareSpaceDeploymentVersions`. Without the header, those operations preserve the earlier shape. Responses vary on `Accept`. + +Use a credential for the operation's audience and required scopes. An API key, deploy token, Space key, and OAuth access token each have different authority. Purchase with a signed-in user where required. A team API key cannot save registrant contacts or buy domains. For OAuth, request one resource per exchange and use a matching DPoP proof for a DPoP-bound refresh token. See [API authentication](/api/authentication). + +Handle unknown response fields and enum values. Read successful JSON from `data` where the operation defines that envelope. Handle empty responses by status. For cursor lists, send back `pagination.nextCursor` until `hasMore` is false. Use the endpoint's own paging parameters for offset lists. Persist an `Idempotency-Key` across retries of the same supported mutation. For failures, branch on the problem `code` and keep the `requestId`. See [pagination](/api/pagination), [idempotency](/api/idempotency), and [API errors](/api/errors). + +## Partner API + +| Before | After | +| --- | --- | +| Import the general API contract in a partner client | Generate against [Partner OpenAPI](https://api.spacefast.com/openapi.partner.json). Account, team, onboarding, and dashboard operations from older snapshots can be absent. Check the current [Partner API reference](/platforms/api/reference) before calling them. | +| `addExternalPrincipalSpaceDomain` | Use `addSpaceCustomDomain` for `POST /v1/spaces/{spaceId}/domains`. | +| Domain registration updates send `contactId: null` | Omit `contactId` to keep the contact. Use a valid contact ID when changing it. | +| Customer IDs differ by letter case between your database, API requests, and JWTs | Use one stable lowercase external principal ID across all three. | +| Customer JWT handles customer administration | Use a tenant API key for customer management. Send a JSON body for lifecycle calls, even when it is `{}`. | +| Daily Space usage receipt | Filter `GET /v1/usage` by `spaceId` or `principalId`. Read hourly records, deduplicate by `usageRecordId`, and apply signed quantities and corrections without losing integer precision. | + +The Partner snapshot marks the same Space usage, data source, Space approval policy, and Zero app-user operations as deprecated. For usage, switch to `GET /v1/usage?spaceId={spaceId}` (`listUsage`). Use the same Space approval policy paths shown above. Use a Space variable for new WordPress connections and plan Zero app-user migration separately. See [Partner authentication](/platforms/partner-api) and [customer management](/platforms/partner-api/customers). + +## Spacefast CLI + +| Before | After | +| --- | --- | +| `-o` for team selection | Use `-T` or `--team`. | +| `sf create` | Use `sf spaces create` to create a Space or `sf init` to scaffold a local project. | +| `sf deployments` | Use `sf versions list`, `sf versions inspect`, `sf versions promote`, or `sf rollback`. | +| Pass a secret as a positional argument to `sf env set` | Omit the value and pass `--value-from-stdin`. New variables default to write-only. | +| `sf migrate URL` for a public site | Use the explicit `sf migrate site URL` form or keep the shorthand. Use `sf migrate app` for local app source. | +| `sf zero`, `sf wp`, or `sf users` scripts | Check the current CLI command list. Use `sf check`, `sf dev`, `sf build`, and `sf db` for the supported project tasks. The app-user API has its own deprecation markers. | +| `sf access show`, `sf access grant`, and `sf access logout-all` | Use `sf share show`, `sf share grant`, and `sf access sessions revoke`. | +| `sf share add EMAIL` or `sf password set` | Use `sf share people invite EMAIL` or `sf share password create`. | +| One machine credential for viewing and publishing | Use `sf share token` for visitor access and `sf deploy-tokens` for automation that publishes. | +| `sf channels ls` or older promotion aliases | Use `sf channels list`, `sf channels history`, and `sf channels set`. | +| Old firewall policy commands | Review [Traffic Rules](/traffic-rules). Use `sf rules list`, `sf rules validate`, and `sf rules test` to check rules before use. | +| `sf comments archive` and `sf comments unarchive` | Use `sf comments resolve` and `sf comments reopen`. | +| `sf builds get`, `sf builds ls`, or `sf builds refresh-upload` | Use `sf builds inspect`, `sf builds list`, or `sf builds upload refresh`. | +| `sf spaces get`, `sf spaces rm`, or `sf spaces export` | Use `sf spaces inspect`, `sf spaces archive`, or `sf spaces download` for the respective tasks. | +| `sf api-keys rm`, `sf env rm`, or `sf domains dns rm` | Use `sf api-keys revoke`, `sf env remove`, or `sf domains dns remove`. | +| `sf rules ls` or `sf rules rm` | Use `sf rules list` or `sf rules remove`. | +| `sf db export --out` | Use `sf db export --output`. | +| `sf init --runtime zero` | Use `sf init --template app` for a new SpacePress app. Use `sf init --dry-run` to inspect the files first. | +| `sf tags versions` | Use `sf tags revisions`. Review the current arguments for each revision and release command. | +| `sf domains check --move` | Use `sf domains check DOMAIN` and follow the TXT verification instructions. | +| `sf login --handoff` from MCP | Use the one-use code from `cli_login` with `sf login --device-code`. Log in again if a saved CLI credential has no issuing API recorded. | +| Publish with `--access team` | Use `--access private` for the owning team. For a public Space, pass `--access public` explicitly. | +| Read an Open link from every new publish receipt | Create a Share Link when you need one. New team Spaces default to private. Check your team defaults before a publish that creates a Space. | +| Parse a secret from every JSON receipt | Read `data` on stdout and `error` on stderr. Pass `--show-secret` only on commands that advertise it and keep the output out of logs. API key creation prints the new secret in human output and masks it in JSON. | +| Treat unknown commands as a general failure in standalone builds | Expect exit `2` for invalid input. Check the [CLI exit codes](/cli) for other failures. | +| Read the live version from `x-spacefast-version` | Use `sf fetch PATH --verify VERSION`. The CLI checks version health and supports the old response header on older Spaces. | + +Use `sf init` to create a project and `sf add` to add a recipe to a project. Read the current command contracts for [database and logs](/cli), [OAuth apps](/cli/reference/oauth-apps#sf-oauth-apps), [billing](/cli/reference/billing#sf-billing-card), and [purchases](/cli/reference/purchases#sf-purchases-inspect-id). Check installed commands with `sf map --paths` before changing automation. + +## Project configuration and runtimes + +### Move serving configuration to TypeScript + +You can keep `sf.jsonc` or migrate it to `spacefast.config.ts`. For the strict JSONC `version: 1` shape, move the values to their TypeScript keys and remove the JSON schema marker. + +| Before | After | +| --- | --- | +| `serve.index` | `index` | +| `serve.spaFallback` | `fallback` | +| `serve.cleanUrls` | `cleanUrls` | +| `serve.directoryListing` | `listing` | +| `metadata` | `meta` | + +```ts spacefast.config.ts +import { defineConfig } from "spacefast/config"; + +export default defineConfig({ + cleanUrls: true, + fallback: false, +}); +``` + +Remove `runtime.database` and `runtime.fetch` if present. Functions receive `env.DB`. Outbound access depends on whether the Space has been claimed. + +Keep the rest of your settings and the existing `.spacefast/space.json` link. Run `sf check` before removing the old config. TypeScript config takes precedence if both files exist. For raw uploads, send JSON-compatible config. To ship evaluated TypeScript config with a prebuilt archive, run: + +```bash +sf build +sf publish .spacefast/build-output.tgz --prebuilt +``` + +Remote builds detect their own settings unless you set them explicitly. Set `fallback: false` or publish with `--spa false` to turn off SPA fallback detection. See [project configuration](/config-file) and [publishing](/publish). + +### Move a Zero or TypedPress app to SpacePress + +| Before | After | +| --- | --- | +| Local `content.managed` source | Preview with `sf migrate app --from content.managed --dry-run`, then run `sf migrate app --from content.managed`. The command writes a SpacePress posts collection. | +| A published Zero 0.8 Space | Follow the [Zero migration](/guides/zero-migration) to back up data and import the rows you need. Test on a preview or new Space before moving your domain. | +| `zero.config.ts` | Preview with `sf migrate app --from zero --dry-run`, then run `sf migrate app --from zero`. The command converts source and checks compilation. Move data and users separately. | +| `typedpress.config.ts` and `tp/` | Use `spacepress.config.ts` and `sp/`. Move files out of `tp/` before running the app migration. | +| App definitions in two config files | Keep app definitions in either the standalone `spacepress.config.ts` or the `app` block of `spacefast.config.ts`. | +| Connector roles declared in the Zero capsule | Declare roles under `connectors` in project config. Use the `personal` role kind in place of `owner`. | +| Old context document endpoints | Read `GET /wp/v2/pages?slug=context&context=edit` and save with `POST /wp/v2/pages/{id}`. | + +Both app migration commands convert source files. Export and import content, rows, and users separately. + +For a legacy Zero 0.8 Space, an API response with `zero_upgrade_required` blocks new Zero 0.8 versions. An existing published version keeps serving. + +For Wrangler projects, check the asset directory and Worker entry point together. With `assets.directory` configured, publish packages those assets and compiles `main` from the Wrangler project root. For server-rendered Next.js, check paths covered by `redirects()` and `rewrites()` in `next.config`. Those requests now reach the Worker. Use the current [framework instructions](/guides/frameworks) for Astro, Vite, and other framework build output. + +## SDK, MCP, and hostnames + +| Before | After | +| --- | --- | +| Generated path-derived SDK operation names | Regenerate from OpenAPI and use its current `operationId` values. For example, use `listSpaceVersions` in place of `getV1SpacesBySpaceIdVersions`. | +| Direct `uploadSessionFiles` call without `apiUrl` | Pass the API base URL configured on your transport. Use the destinations issued by that upload session. If you call `assertUploadDestination` directly, pass `named` from `uploadSessionDestinations(session)`. | +| MCP code mode, `search`, `execute`, or `?codemode=` | Refresh the tool list and call tools by their current operation IDs. Use `spacefast://skills/api` for calling instructions. For docs search use `searchDocs` and for a saved approval use `resume_execution`. | +| MCP `--mode`, daemon, HTTP, or status commands | Use `sf mcp` for local stdio or `sf mcp proxy` for a stdio connection to hosted MCP. See [MCP setup](/agents/mcp-server). | +| Space claim operations exposed as MCP tools | Use the claim link from the publish receipt to claim in a browser. Use `sf continue` after approval to exchange the saved Space key. | +| Hosted MCP connector gateway | Use On-Device MCP for the connector gateway. Hosted MCP and `sf mcp proxy` use the hosted tool catalog. | +| Saved API key in the Claude Desktop extension | Run `sign_in` once to approve device login. On `mcp_client_upgrade_required`, update the CLI or extension and reconnect. | +| Assumed signed-out access to `publish` | Honor the hosted connection's `access` or `groups` preset. Complete sign-in when the preset requires it. | +| Cached domain conversation tools | Send one brief to `searchDomains`. MCP no longer offers `continueDomainConversation`, `classifyDomainMessage`, or `continueDocsConversation`. | +| Older routing normalization | Keep hostname case folding ASCII and account for a trailing DNS dot. `normalizeHostname` is available from `@spacefast/common/utils/hostname`. The routing entry point still re-exports it. | +| Cached agent installer or old plugin setup | Fetch [Spacefast setup](https://spacefast.com/setup.md) or run `sf setup agent` to refresh setup instructions. | +| Construct all new live URLs under `view.fast` | Read the live URL from the receipt. New Spaces default to `space.fast`. Existing `view.fast` URLs keep serving. | + +Documentation redirects from `/api/operations/*` lead to reference pages. Update documentation links separately from executable API requests, which use the method and path in OpenAPI. diff --git a/content/(routing)/caching.mdx b/content/(routing)/caching.mdx index 91e9e046..1c4d28a5 100644 --- a/content/(routing)/caching.mdx +++ b/content/(routing)/caching.mdx @@ -56,7 +56,7 @@ export default defineConfig({ }); ``` -You can also add cache-bypass rules without publishing via [`sf rules add`](/cli/reference/rules#sf-rules-add) (`--kind cache-bypass`) or the dashboard's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page. See [Traffic Rules](/redirects#traffic-rules) for the full match grammar and limits. +You can also add cache-bypass rules without publishing via [`sf rules add`](/cli/reference/rules#sf-rules-add) (`--kind cache-bypass`) or the dashboard's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page. See [Traffic Rules](/traffic-rules) for the full match grammar and limits. ### Override `Cache-Control` for browsers @@ -149,3 +149,7 @@ Browsers need no purge: `max-age=0` forces revalidation on navigation, so return ## Validators Every `200` response carries a content-derived `ETag`, so republishing identical bytes produces the same tag. The edge answers conditional requests directly with `304` when nothing changed. Static responses carry no `Last-Modified` header. + +## CLI, API, MCP, and SDK + + diff --git a/content/(routing)/customization.mdx b/content/(routing)/customization.mdx index d56a0180..9fbd4f12 100644 --- a/content/(routing)/customization.mdx +++ b/content/(routing)/customization.mdx @@ -237,6 +237,11 @@ Publish fails on the first error diagnostic and keeps the current live version s | `index_files_missing` | Warning | `index` page omits `` | | `page_indexable` | Warning | `access` or `denied` page declares itself indexable (served noindex regardless) | + +## CLI, API, MCP, and SDK + + + ## Next steps - [Project configuration](/config-file): full `meta`, `theme`, and `superpowers` schema diff --git a/content/(routing)/domains/dns.mdx b/content/(routing)/domains/dns.mdx index 8fc2cb53..9d87e543 100644 --- a/content/(routing)/domains/dns.mdx +++ b/content/(routing)/domains/dns.mdx @@ -180,6 +180,11 @@ Nameserver changes can take up to 48 hours to reach every network. Individual re | [`domain_connect_conflict`](/errors/domain_connect_conflict) | Template would replace existing records | Review `details.records` and approve replacement or pass `force=1` | | [`registrar_writes_disabled`](/errors/registrar_writes_disabled) | Registrar writes are paused | Try again later; nothing was changed | + +## CLI, API, MCP, and SDK + + + ## Next steps - [Custom domains](/domains): attach a domain to a Space and issue HTTPS certificates diff --git a/content/(routing)/domains/index.mdx b/content/(routing)/domains/index.mdx index 66538c57..f960e2e2 100644 --- a/content/(routing)/domains/index.mdx +++ b/content/(routing)/domains/index.mdx @@ -91,14 +91,14 @@ If existing `A`, `AAAA`, `CNAME`, or `ALIAS` records in a Spacefast DNS zone blo ### When a TXT record appears -Most domains need no TXT record. One appears only when the hostname is already in use elsewhere and you must prove control (see [Domain verification records](/infrastructure/domain-verification-records)): +Most domains need no TXT record. One appears only when the hostname is already in use elsewhere and you must prove control (see [Domain verification records](/domains/verification)): - **Another provider holds the hostname**: Publish the `TXT` record named for the hostname whose value starts with `atomic-domain-`. Remove any `CNAME` at that name first, because a `TXT` record cannot share a name with a `CNAME`. Keep only one `atomic-domain-` record per hostname; two cause the claim to fail. - **Another Space serves the hostname**: Adding it to your Space creates a claim and returns a `_spacefast-claim.` `TXT` record. Publish it at your DNS provider and run `sf domains check`. Once Spacefast observes it, the hostname moves to your Space and stops serving the old one. A claim does not expire and changes nothing until proven. If you manage both Spaces, you can remove the domain from the old Space and add it here instead. -Spacefast provisions and renews certificates automatically once DNS validates. See [TLS certificates](/infrastructure/tls-certificates) and [IP ranges](/infrastructure/ip-ranges). +Spacefast provisions and renews certificates automatically once DNS validates. See [TLS certificates](/domains/tls-certificates) and [IP ranges](/infrastructure/ip-ranges). -## Apex and www travel together +## Apex and `www` hostnames Adding a registrable apex or its `www` twin sets up both: `example.com` includes `www.example.com`, and `www.example.com` includes `example.com`. Other subdomains, such as `app.example.com`, connect on their own. @@ -260,6 +260,13 @@ www.example.com purpose=www dns=not_configured txt=missing ssl=missing [`preflightDomain`](/api/reference/domains/preflightdomain) (`GET /v1/domains/preflight?name=example.com`) runs name validation and serving checks before creating any record. Its `canHost` field is advisory: `false` still lets you add the domain and claim it with TXT proof, and `null` means the check was unavailable. + +## CLI, API, MCP, and SDK + + + + + ## Next steps - [DNS](/domains/dns): Spacefast DNS zones, email records, nameservers, and Domain Connect diff --git a/content/(routing)/domains/meta.ts b/content/(routing)/domains/meta.ts index 2f8ff45d..58c4113b 100644 --- a/content/(routing)/domains/meta.ts +++ b/content/(routing)/domains/meta.ts @@ -1,3 +1,7 @@ import { defineMeta } from "blume"; -export default defineMeta({ title: "Domains", collapsed: true, pages: ["urls", "index", "dns", "registration", "transfers"] }); +export default defineMeta({ + title: "Domains", + collapsed: true, + pages: ["urls", "index", "dns", "tls-certificates", "verification", "registration", "transfers"], +}); diff --git a/content/(routing)/domains/registration.mdx b/content/(routing)/domains/registration.mdx index 4ddff2cd..d9708cb9 100644 --- a/content/(routing)/domains/registration.mdx +++ b/content/(routing)/domains/registration.mdx @@ -53,6 +53,17 @@ Ask your agent to find and buy a domain. In an MCP host that supports MCP Apps, For agent workflows, see [Domain research for assistants](/agents/domain-research). + + + +Search and compare domain names interactively from any terminal without installing the CLI: + +```bash +ssh fastdomainsearch.com +``` + +Sign in once through the browser device flow to buy domains or save results to your team. Spacefast remembers your SSH public key for future sessions (up to 7 days without use and 30 days at most). + @@ -220,6 +231,11 @@ Check upcoming expiration dates in team [**Domains**](https://my.spacefast.com/? | [`registrar_unavailable`](/errors/registrar_unavailable) | Registrar could not be reached | Retry shortly; paid purchases retry automatically | | [`registrar_writes_disabled`](/errors/registrar_writes_disabled) | Registrar writes are paused; nothing charged | Try again later | + +## CLI, API, MCP, and SDK + + + ## Next steps - [Custom domains](/domains): attach your registered domain to a Space diff --git a/content/(routing)/domains/tls-certificates.mdx b/content/(routing)/domains/tls-certificates.mdx new file mode 100644 index 00000000..79b86980 --- /dev/null +++ b/content/(routing)/domains/tls-certificates.mdx @@ -0,0 +1,50 @@ +--- +title: TLS certificates +description: Automatic HTTPS, Spacefast DNS setup, per-hostname certificate checks, and recovery from blocked issuance. +--- + +Spacefast provisions and renews Transport Layer Security (TLS) certificates (often called SSL certificates) for your Space's hostnames automatically. When a custom domain uses [Spacefast DNS](/domains/dns) (including domains registered through Spacefast), Spacefast writes the required routing records and sets up HTTPS automatically with no manual DNS changes. On external DNS, issuance starts once the hostname resolves to Spacefast with a reachable validation path. + +:::note[SSL vs. TLS] +TLS is the modern successor to SSL. The UI and API still use the familiar name SSL in some fields, even though every version of the legacy SSL protocol is disabled. +::: + +## Provisioning and renewal + +Spacefast issues certificates through Let's Encrypt and Google Trust Services. Issuance uses the ACME HTTP-01 challenge, so each hostname must resolve to the supplied infra addresses and allow the certificate authority to fetch its challenge over HTTP. + +If your domain uses Spacefast DNS, attaching it to a Space configures the apex and `www` routing records automatically so validation and certificate issuance run on their own. You only need to intervene if pre-existing conflicting records (`A`, `AAAA`, `CNAME`, or `ALIAS`) or restrictive `CAA` records in the zone block issuance. Clear conflicting records in a Spacefast DNS zone with [`sf domains dns replace`](/cli/reference/domains#sf-domains-dns-replace-domain). + +The apex (`example.com`) and `www` (`www.example.com`) are validated and managed independently. One hostname can have an active certificate while the other is still pending or reporting an error. Check every hostname returned by your domain setup. + +Renewals happen automatically with no routine maintenance. Failed attempts are requeued automatically, and consecutive failures increase the delay before the next attempt (`retry_date` moves farther into the future). Fix the underlying DNS or configuration problem before requesting an immediate retry. If Let's Encrypt itself is experiencing an outage, check Let's Encrypt service status before changing DNS. + +## Check a certificate + +```bash +sf domains diagnostics example.com --space my-site +``` + +Diagnostics report DNS, verification, and SSL state for each hostname, including the issuing authority, expiration, validation state, HTTPS status, and any failed attempt. + +To inspect the certificate presented by a public hostname from the terminal: + +```bash +echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -issuer -dates +``` + +Certificate chains and issuer common names can change. Check the issuer organization (`Let's Encrypt` or `Google Trust Services`) or the provider field returned by the API rather than pinning an integration to a specific common name. + +## When issuance is blocked + +Check that the hostname's address records match Spacefast's instructions. Remove old `A` and `AAAA` records that still send requests elsewhere. If `CAA` records restrict certificate authorities, allow Let's Encrypt and Google Trust Services. Check that an extra proxy or redirect does not intercept the HTTP-01 validation request. + +After fixing the cause, select **Retry HTTPS** on the Space's [**Domains**](https://my.spacefast.com/?to=/:team/:space/domains) page (shown while a certificate is failing), run `sf domains check example.com --space my-site --retry-ssl`, or call [`retrySpaceCustomDomainSsl`](/api/reference/domains/retryspacecustomdomainssl) (`POST /v1/spaces/{spaceId}/domains/{domainId}/ssl/retry`). Retries are rate limited; repeated retries do not repair a DNS or `CAA` error. + +See [Custom domains](/domains#troubleshooting) for diagnostic codes such as `ssl_pending` and `ssl_renewal_blocked`, and [Domain verification records](/domains/verification) when another site already holds the hostname. + +## Protocol support and cipher negotiation + +During the TLS handshake, the edge and client pick the strongest mutually supported cipher from the server's preferred list. Spacefast disables SSL, TLS 1.0, and TLS 1.1. Modern clients negotiate TLS 1.2 or TLS 1.3. + +Some TLS 1.2 ciphers remain enabled for compatibility with older browsers and devices. A security scanner can flag one of those fallback ciphers even when modern clients negotiate a stronger choice. Evaluate scanner findings against protocol version, negotiation order, browser compatibility, and the specific exploit described in the report. diff --git a/content/(routing)/domains/transfers.mdx b/content/(routing)/domains/transfers.mdx index fabe6616..2b53a96f 100644 --- a/content/(routing)/domains/transfers.mdx +++ b/content/(routing)/domains/transfers.mdx @@ -185,6 +185,11 @@ Enabling the transfer lock again remains available for recovery even when new tr | [`domain_transfer_lock_unconfirmed`](/errors/domain_transfer_lock_unconfirmed) | Registrar has not confirmed the lock change | Refresh registration state and retry the lock call | | [`domain_transfer_authority_changed`](/errors/domain_transfer_authority_changed) | Registration access changed before the registrar action | Refresh the domain and start again with current purchase access | + +## CLI, API, MCP, and SDK + + + ## Next steps - [Domain registration](/domains/registration): buy domains, manage contacts, and handle renewals diff --git a/content/(routing)/domains/verification.mdx b/content/(routing)/domains/verification.mdx new file mode 100644 index 00000000..df7033cd --- /dev/null +++ b/content/(routing)/domains/verification.mdx @@ -0,0 +1,49 @@ +--- +title: Domain verification records +description: Publish the exact TXT records needed to prove control of a Space hostname when another site already holds it. +--- + +Most hostnames need no verification record, because the address records are enough. A TXT record appears only when the hostname is already in use elsewhere. Copy the exact record names and values from your domain's setup instructions. + +## Get the records for your hostname + +```bash +sf domains add example.com --space my-site +sf domains diagnostics example.com --space my-site +``` + +The Space's [**Domains**](https://my.spacefast.com/?to=/:team/:space/domains) setup page also shows the required records. When the domain uses [Spacefast DNS](/domains/dns), Spacefast writes the routing records automatically when you attach it to a Space; on external DNS, add the records wherever your DNS is managed. For the complete connection flow, see [Custom domains](/domains). + +There are two kinds of verification records, and they prove different claims: + +- An `atomic-domain-…` record proves you control a hostname that another site on the same infra already uses. +- A `_spacefast-claim.` record moves a hostname away from another Space. + +Do not substitute one for the other or construct a TXT value from an example. Collision messages never reveal which other customer or site holds the hostname. + +## When an `atomic-domain-` record is required + +A hostname already attached to a site elsewhere on the same infra, such as WordPress.com or Pressable, can require an extra TXT record before it can attach to Spacefast. Spacefast retrieves that unique proof and includes it in the DNS instructions. + +The value starts with `atomic-domain-` and belongs at the exact hostname being verified. The apex (`example.com`) and `www.example.com` each receive a unique value when both are verified. + +Publish only the currently required verification value at each hostname. Multiple distinct TXT values starting with `atomic-domain-` at the same hostname can prevent verification, even when one matches Spacefast's instructions. Remove a superseded `atomic-domain-` value when moving the hostname. Keep unrelated TXT records, including email authentication records. + +A `CNAME` cannot coexist with a TXT record at the same hostname. Follow Spacefast's address-record instructions instead. + +## Resolve a domain held by an older site + +If you recognize the domain as attached to an older site you control, detach it from that older site first. Do not cancel the domain registration or DNS service. + +When you cannot detach the domain from the older site, publish the TXT verification record for the apex hostname and, when requested, for `www`. A `www` verification record is rarely needed when `www` is a `CNAME`, but it can still be required if another site previously claimed `www` as a separate alias. + +## Check and retain the proof + +```bash +sf domains check example.com --space my-site +sf domains diagnostics example.com --space my-site +``` + +DNS propagation can delay a successful check. Inspect every hostname in diagnostics; a verified apex does not prove that `www` is ready. + +Keep required verification records after setup so future checks can still prove control. A domain's verification state, routing readiness, and [TLS certificate](/domains/tls-certificates) state are separate. A TXT record alone does not make the hostname live. diff --git a/content/(routing)/headers.mdx b/content/(routing)/headers.mdx index 95f1a1dd..8b6d2cbf 100644 --- a/content/(routing)/headers.mdx +++ b/content/(routing)/headers.mdx @@ -64,7 +64,7 @@ If both `_headers` and project configuration define the same header for a path, - **Raw pathname matching**: Header matchers cannot include a port and match the raw pathname, so they are sensitive to trailing slashes. - **Requested URL**: Header rules match the URL the visitor requested, not the target path an internal rewrite served. - **Pattern grammar**: `*` matches a splat and `:name` matches one segment; regular expressions are not supported. -- **Edge placement**: By default, your Space applies header rules at origin. Setting `config.placement.edge` to `true` moves eligible header rules to the edge on the next publish (see [Traffic Rules](/redirects#place-redirects-and-headers-at-the-edge)). +- **Edge placement**: By default, your Space applies header rules at origin. Setting `config.placement.edge` to `true` moves eligible header rules to the edge on the next publish (see [Traffic Rules and firewall](/traffic-rules#place-redirects-and-headers-at-the-edge)). ## Reserved and restricted headers @@ -80,11 +80,29 @@ Header names must match `^[A-Za-z0-9-]+$`. Publish rejects platform-owned and tr Spacefast rejects `Basic-Auth` first, redacts it from diagnostics, and strips it from compiled rules so credentials never reach logs. For access control, use [Spacefast Share](/share). -## Caching and security headers +## Security, CORS, and caching headers -You can set `Cache-Control`, which emits a `header_cache_control_platform_managed` warning at publish. Your `Cache-Control` value applies to browser responses, while shared edge caching stays platform-managed. To skip the edge cache for specific paths, add a `cache.bypass` rule instead. See [Caching](/caching). +You can set `Cache-Control`, which emits a `header_cache_control_platform_managed` warning at publish. Your `Cache-Control` value applies to browser responses, while shared edge caching stays platform-managed. To skip the edge cache for specific paths, add a `cache.bypass` rule in [Traffic Rules](/traffic-rules) instead. See [Caching](/caching). -For recommended `Content-Security-Policy`, `X-Frame-Options`, `Referrer-Policy`, and other security header setups, see [HTTP and security headers](/infrastructure/http-security-headers). +| Header | Purpose | Can your Space set it? | +| --- | --- | --- | +| `Content-Security-Policy` | Restricts which origins can load scripts, frames, fonts, and other resources | Yes, test carefully | +| `Access-Control-Allow-Origin` | Names the origin whose browser code may read a cross-origin response | Yes | +| `Access-Control-Allow-Headers` | Lists request headers permitted by a CORS preflight response | Yes | +| `Access-Control-Allow-Methods` | Lists HTTP methods permitted by a CORS preflight response | Yes | +| `Access-Control-Allow-Credentials` | Tells browsers whether frontend code may read a credentialed cross-origin response | Yes | +| `Access-Control-Expose-Headers` | Lists response headers readable by cross-origin frontend code | Yes | +| `X-Frame-Options` | Restricts framing to prevent unwanted embeds | Yes, on Space routes | +| `X-Content-Type-Options` | Set `nosniff` to prevent browsers from guessing a different MIME type | Yes | +| `Referrer-Policy` | Controls how much referrer information accompanies outgoing requests | Yes | +| `X-Robots-Tag` | Controls search-engine indexing at the HTTP header level | Yes | +| `X-XSS-Protection` | Legacy browser filter; rely on a tested `Content-Security-Policy` instead | Yes, rarely needed | +| `Strict-Transport-Security` | Forces HTTPS in browsers. Platform-managed; authored rules cannot replace it | Platform-managed | +| `Cache-Control` | Controls browser caching while shared caching follows [Caching](/caching) | Yes, with caching rules | + +- **HSTS:** Spacefast sends the base `Strict-Transport-Security` header automatically. Never enable `includeSubDomains` or `preload` elsewhere until every current and future subdomain serves HTTPS, because browsers cache HSTS policies long after configuration changes. +- **CORS:** Test from the real requesting browser origin and verify `OPTIONS` preflight responses (a passing `curl` check does not prove browser JavaScript can read the response). Avoid reflecting arbitrary origins when `Access-Control-Allow-Credentials: true` is active. +- **Content Security Policy:** Start with `Content-Security-Policy-Report-Only`, check console violations across forms, embeds, analytics, login, and payment flows, and retest whenever third-party scripts change. ## Inspect headers locally and live @@ -94,12 +112,12 @@ Check which custom header rules match a URL in your local build output before pr sf routing inspect --routing ./dist --url https://example.com/downloads/file.zip ``` -Replace `./dist` with your publish root and repeat `--url` for multiple paths. `sf routing inspect` shows compiled custom header rules, not runtime defaults or managed edge cache headers. +Replace `./dist` with your publish root and repeat `--url` to check multiple paths. `sf routing inspect` shows compiled custom header rules, not runtime defaults or managed edge cache headers. -To check live runtime headers after publishing, run `curl -I`: +To check live runtime headers after publishing, run `curl -sS -D - -o /dev/null` while logged out so session cookies do not alter caching, clear caches after edits, and repeat the request to verify both origin and Edge Cache responses: ```bash -curl -sI https://my-space.space.fast/downloads/file.zip +curl -sS -D - -o /dev/null https://my-space.space.fast/downloads/file.zip ``` Private previews always return `Cache-Control: private, no-store`, so test live edge caching on a public live URL. See [Testing before promotion](/caching#testing-before-promotion). @@ -113,9 +131,13 @@ Private previews always return `Cache-Control: private, no-store`, so test live | `_headers` file size | 2 MiB | Read cap | | `sf.jsonc` file size | 256 KiB | Error | +## CLI, API, MCP, and SDK + + + ## Next steps -- [HTTP and security headers](/infrastructure/http-security-headers): security policy examples and browser checks - [Caching](/caching): default edge and browser cache policies -- [Redirects and rewrites](/redirects): path redirects, proxies, and Traffic Rules +- [Redirects and rewrites](/redirects): path redirects, proxies, and SPA fallback +- [Traffic Rules and firewall](/traffic-rules): edge firewall, cache bypass, and edge placement - [`sf routing inspect` CLI reference](/cli/reference/routing#sf-routing-inspect): full inspection options diff --git a/content/(routing)/meta.ts b/content/(routing)/meta.ts index e84a31b2..1e3ee0ce 100644 --- a/content/(routing)/meta.ts +++ b/content/(routing)/meta.ts @@ -1,3 +1,7 @@ import { defineMeta } from "blume"; -export default defineMeta({ title: "Domains & routing", collapsed: false, pages: ["domains", "redirects", "headers", "caching", "customization"] }); +export default defineMeta({ + title: "Domains & routing", + collapsed: false, + pages: ["domains", "redirects", "headers", "traffic-rules", "caching", "customization"], +}); diff --git a/content/(routing)/redirects.mdx b/content/(routing)/redirects.mdx index 7f937bd7..5536f122 100644 --- a/content/(routing)/redirects.mdx +++ b/content/(routing)/redirects.mdx @@ -1,11 +1,11 @@ --- title: Redirects and rewrites -description: Configure redirects, rewrites, upstream proxies, clean URLs, SPA fallback, and edge Traffic Rules in spacefast.config.ts +description: Configure redirects, internal rewrites, upstream proxies, clean URLs, and SPA fallback in spacefast.config.ts --- -Declare redirects, internal rewrites, upstream proxies, and edge Traffic Rules in `spacefast.config.ts`. Redirect and rewrite rules evaluate in order and the first match wins. +Declare redirects, internal rewrites, and upstream proxies in `spacefast.config.ts`. Redirect and rewrite rules evaluate in order and the first match wins. -For response headers, see [Response headers](/headers). Spacefast compiles routing rules when you publish, and you can check them locally with `sf routing inspect` before publishing. +For response headers, see [Response headers](/headers). For edge firewall and cache-bypass rules, see [Traffic Rules and firewall](/traffic-rules). Spacefast compiles routing rules when you publish, and you can check them locally with `sf routing inspect` before publishing. ## Configure redirects and rewrites @@ -83,7 +83,7 @@ Status decides the action (`301`/`302`/`303`/`307`/`308` redirect, `200` path re Rules merge in this order: `_redirects` first, then `redirects` from project configuration, then `rewrites` from project configuration. A config rule whose source is already claimed by an unconditional `_redirects` rule never runs and reports `redirect_shadowed_by_file`. Spacefast never serves `_redirects` as public content and returns `404` if requested. -Space settings overlays written via the API or dashboard prepend ahead of file and config rules so urgent changes match first without removing committed rules. +Rules saved in Space settings via the API or dashboard prepend ahead of file and config rules so urgent changes match first without removing committed rules. ## Matching rules @@ -192,137 +192,6 @@ For custom `404.html` files and Spacefast's built-in error templates, see [Custo Static files answer `GET` and `HEAD`. Any other method against an existing static path returns `405` with an `Allow` header, never `404` and never the SPA shell. `OPTIONS` receives no synthetic `204`. Compiled redirects accept every method. -## Traffic Rules - -Traffic Rules run at the edge to block or challenge requests (`firewall`) or skip the edge cache (`cache.bypass`) based on request attributes such as path, country, IP, or headers. - -### Where rules live - -| Source | `origin` | Takes effect | -| --- | --- | --- | -| `firewall` and `cache.bypass` in `spacefast.config.ts` or `sf.jsonc` | `config` | On publish | -| Space settings: dashboard **Traffic Rules**, `sf rules add`, or [`updateSpace`](/api/reference/spaces/updatespace) | `overlay` | On save, without a publish | - -Settings rules evaluate before config rules. A settings rule with the same `name` and kind replaces the config rule at the edge. Put rules that ship with your code in `spacefast.config.ts`, and use Space settings for urgent blocks or bypasses that must apply immediately. - -A Space provisions its edge on its first publish. Validation, pause, and resume fail with [`traffic_rules_unavailable`](/errors/traffic_rules_unavailable) until the Space has published once. - -### Declare Traffic Rules - -Configure `firewall` and `cache.bypass` in `spacefast.config.ts` (the same keys work in `sf.jsonc`): - -```ts spacefast.config.ts -import { defineConfig } from "spacefast/config"; - -export default defineConfig({ - firewall: [ - { name: "protect-admin", action: "challenge", match: { path: "/admin/*" } }, - { - name: "block-logins", - action: "block", - status: 403, - match: { path: "/wp-login.php*" }, - }, - ], - cache: { - bypass: [ - { name: "fresh-api", match: { path: "/api/*" } }, - { name: "previews", match: { query: { preview: { op: "exists" } } } }, - ], - }, -}); -``` - -| Field | Type | Default | What it does | -| --- | --- | --- | --- | -| `name` | string | none | Lowercase letters, digits, `-`, and `_`, up to 61 characters; not all digits or reserved words (`add`, `validate`, `preview`, `bulk`, `ingress-allowlist`, `suspend-all`, `restore-all`); unique within its list | -| `description` | string, max 255 chars | none | Notes what the rule does | -| `action` | `"block"` \| `"challenge"` | required (firewall) | `block` answers without reaching the Space; `challenge` asks for human proof | -| `status` | integer, `400` to `499` | `403` | HTTP status for blocked requests (`block` only) | -| `match` | object | required | Request attributes to compare (at least one field) | -| `any` | boolean | `false` | When `true`, any matching field triggers the rule; otherwise all fields must match | - -Each list stops at the first matching rule. Firewall rules never match platform-reserved internal transport paths. - -### Match fields and operators - -| Field | Supported operators | -| --- | --- | -| `path`, `host` | `eq`, `neq`, `in`, `contains`, `startsWith`, `endsWith`, `wildcard` | -| `method`, `country`, `asn` | `eq`, `neq`, `in` | -| `ip` | `eq`, `neq`, `in`, `inCidr` | -| `userAgent`, `referer` | `eq`, `neq`, `in`, `contains`, `startsWith`, `endsWith`, `wildcard`, `exists` | -| `header`, `cookie`, `query` | Same as `userAgent`, keyed by name (for example `{ "x-api-client": { op: "exists" } }`) | -| `extension` | `eq`, `neq`, `in`, `exists` (without the leading dot) | -| `ja3`, `ja4` | `eq`, `in`, `exists` | - -Shorthand values expand as follows: a string with `*` uses `wildcard`, any other string uses `eq` (text fields ignore case), an array uses `in`, and an `ip` string with `/` uses `inCidr`. Use an explicit clause object for everything else (`{ op: "startsWith", value: "/admin/" }`, `{ op: "in", values: ["RU"], not: true }`, `{ op: "exists" }`). Read the full catalog via [`getTrafficRuleCatalog`](/api/reference/spaces/gettrafficrulecatalog). - -### Add, inspect, and remove settings rules - -Add overlay rules without publishing from the CLI or dashboard: - -```bash -sf rules add --kind firewall --action challenge --path '/wp-login.php*' -sf rules add --kind firewall --action block --country US,CA --not country -sf rules add --kind cache-bypass --path '/api/*' --name fresh-api -sf rules list -sf rules remove block-logins --kind firewall -``` - -To add a rule in the dashboard: - -1. Open the Space's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page and select **New Rule**. -2. Choose **Firewall** or **Cache**. -3. Configure the match pattern and action. -4. Select **Create Rule**. - -Use **Move up** and **Move down** to reorder rules, or **Remove** to delete overlay rules. To edit a config rule without publishing, select **Override in Dashboard** to copy it into Space settings. - -The **Edge Allowance** card and `sf rules list` (`listSpaceTrafficRules`) show each rule's placement (**Edge** or **Origin**) and state (`live`, `pending`, `over_quota`, `invalid`, `failed`, `suspended`, `disabled`, or `unknown`). Duplicate rules or duplicate names are reported under `collapsed`. - -To write settings rules over the API, read the Space with [`getSpace`](/api/reference/spaces/getspace), send back the full `config` with your updated `config.firewall` or `config.cache.bypass` arrays via [`updateSpace`](/api/reference/spaces/updatespace), and pass `settingsDigest` as `baseSettingsDigest` to avoid overwriting concurrent edits. - -### Test a URL and validate rules - -Evaluate firewall and cache-bypass rules locally without sending requests to your Space: - -```bash -sf rules test /wp-login.php --country RU -sf rules test /api/orders --file spacefast.config.ts -sf rules validate -``` - -`sf rules validate` checks your config file against the grammar and edge limits, printing field paths such as `firewall[0].match.country` and exiting `2` on errors (same check as [`validateSpaceTrafficRules`](/api/reference/spaces/validatespacetrafficrules)). - -On the Space's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page, open **Test a request against your rules** under the rule list to test a path with optional **Country**, **IP address**, **User agent**, **Header**, or **Cookie** values. The dashboard tester does not accept method, ASN, referrer, JA3, or JA4 inputs, so rules using those fields may behave differently at the edge. - -### Pause and resume all rules - -Pause every Traffic Rule at once without deleting them: - -```bash -sf rules pause -sf rules resume -``` - -In the dashboard, select **Pause All Edge Rules** and **Resume**. Over the API, call [`pauseSpaceTrafficRules`](/api/reference/spaces/pausespacetrafficrules) and [`resumeSpaceTrafficRules`](/api/reference/spaces/resumespacetrafficrules). Pause and resume apply immediately without a publish. Rules added while paused stay parked until resumed. - -### Place redirects and headers at the edge - -By default, your Space answers redirects and header rules at origin. To move eligible rules to the edge, set `config.placement.edge` to `true` via [`updateSpace`](/api/reference/spaces/updatespace); the change applies at the next publish. Rules the edge cannot evaluate faithfully (such as path captures, proxies, `404` rules, or redirects outside `301`/`302`/`307`/`308`) remain at origin. Publishing with edge placement while rules are paused fails with [`traffic_rules_placement_incomplete`](/errors/traffic_rules_placement_incomplete). - -### When rule changes take effect - -| Change | Takes effect | -| --- | --- | -| `firewall` or `cache.bypass` in `spacefast.config.ts` or `sf.jsonc` | On publish | -| `firewall` or `cache.bypass` in Space settings | On settings save | -| `redirects`, `rewrites`, or `headers` in Space settings | Immediately on a Space with a live version, else first publish | -| `_redirects`, `_headers`, or config `redirects`, `rewrites`, `headers` | On publish | -| Pause or resume | Immediately | -| `placement.edge` | Next publish | - ## Inspect compiled routing rules Test local routing files and `spacefast.config.ts` against specific URLs before publishing or promoting: @@ -343,8 +212,6 @@ sf routing compute --space my-space ## Limits -### Redirect and config limits - | Limit | Value | Severity | | --- | --- | --- | | Total redirect and rewrite rules after merge | 2,100 | Error | @@ -354,23 +221,13 @@ sf routing compute --space my-space | `_redirects` file size | 2 MiB | Read cap | | `sf.jsonc` file size | 256 KiB | Error | -### Traffic Rules limits - -| Limit | Value | -| --- | --- | -| Rules per `firewall` or `cache.bypass` list | 50 | -| Comparisons per firewall rule | 47 | -| Comparisons per cache-bypass rule | 50 | -| Values in one `in` or `inCidr` clause | 1,000 | -| Characters per value | 4,096 | -| Characters per header, cookie, or query name | 128 | -| Characters in `description` | 255 | -| Rules active at the edge | Set by the edge (shown in **Edge Allowance**) | +## CLI, API, MCP, and SDK -Space settings and config files each keep their own lists. Keyed fields count one comparison per key, and a firewall rule with `any: true` uses one edge slot per comparison. + ## Next steps +- [Traffic Rules and firewall](/traffic-rules): edge firewall, cache bypass, DDoS protection, and Defensive Mode - [Response headers](/headers): set or remove HTTP response headers - [Caching](/caching): default cache policies and testing before promotion -- [`sf routing` CLI reference](/cli/reference/routing#sf-routing-inspect) and [`sf rules` CLI reference](/cli/reference/rules#sf-rules): full flag reference +- [`sf routing` CLI reference](/cli/reference/routing#sf-routing-inspect): full inspection options diff --git a/content/(routing)/traffic-rules.mdx b/content/(routing)/traffic-rules.mdx new file mode 100644 index 00000000..c4d9f18a --- /dev/null +++ b/content/(routing)/traffic-rules.mdx @@ -0,0 +1,196 @@ +--- +title: Traffic Rules and firewall +description: Block or challenge requests at the edge, bypass edge cache, and understand Spacefast DDoS protection, Defensive Mode, and rate limiting +--- + +Traffic Rules run at the edge to block or challenge requests (`firewall`) or skip the edge cache (`cache.bypass`) based on request attributes such as path, country, IP, or headers. Every Space also includes automatic edge DDoS protection, browser challenges (Defensive Mode), and traffic rate limiting with no setup required. + +## Where Traffic Rules live + +| Source | `origin` | Takes effect | +| --- | --- | --- | +| `firewall` and `cache.bypass` in `spacefast.config.ts` or `sf.jsonc` | `config` | On publish | +| Space settings: [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules), `sf rules add`, or [`updateSpace`](/api/reference/spaces/updatespace) | `overlay` | On save, without a publish | + +Settings rules evaluate before config rules. A settings rule with the same `name` and kind replaces the config rule at the edge. Put rules that ship with your code in `spacefast.config.ts`, and use Space settings for urgent blocks or bypasses that must apply immediately. + +A Space provisions its edge on its first publish. Validation, pause, and resume fail with [`traffic_rules_unavailable`](/errors/traffic_rules_unavailable) until the Space has published once. + +## Declare Traffic Rules + +Configure `firewall` and `cache.bypass` in `spacefast.config.ts` (the same keys work in `sf.jsonc`): + +```ts spacefast.config.ts +import { defineConfig } from "spacefast/config"; + +export default defineConfig({ + firewall: [ + { name: "protect-admin", action: "challenge", match: { path: "/admin/*" } }, + { + name: "block-logins", + action: "block", + status: 403, + match: { path: "/wp-login.php*" }, + }, + ], + cache: { + bypass: [ + { name: "fresh-api", match: { path: "/api/*" } }, + { name: "previews", match: { query: { preview: { op: "exists" } } } }, + ], + }, +}); +``` + +| Field | Type | Default | What it does | +| --- | --- | --- | --- | +| `name` | string | none | Lowercase letters, digits, `-`, and `_`, up to 61 characters; not all digits or reserved words (`add`, `validate`, `preview`, `bulk`, `ingress-allowlist`, `suspend-all`, `restore-all`); unique within its list | +| `description` | string, max 255 chars | none | Notes what the rule does | +| `action` | `"block"` \| `"challenge"` | required (firewall) | `block` answers without reaching the Space; `challenge` asks for human proof | +| `status` | integer, `400` to `499` | `403` | HTTP status for blocked requests (`block` only) | +| `match` | object | required | Request attributes to compare (at least one field) | +| `any` | boolean | `false` | When `true`, any matching field triggers the rule; otherwise all fields must match | + +Each list stops at the first matching rule. Firewall rules never match platform-reserved internal transport paths. + +### Match fields and operators + +| Field | Supported operators | +| --- | --- | +| `path`, `host` | `eq`, `neq`, `in`, `contains`, `startsWith`, `endsWith`, `wildcard` | +| `method`, `country`, `asn` | `eq`, `neq`, `in` | +| `ip` | `eq`, `neq`, `in`, `inCidr` | +| `userAgent`, `referer` | `eq`, `neq`, `in`, `contains`, `startsWith`, `endsWith`, `wildcard`, `exists` | +| `header`, `cookie`, `query` | Same as `userAgent`, keyed by name (for example `{ "x-api-client": { op: "exists" } }`) | +| `extension` | `eq`, `neq`, `in`, `exists` (without the leading dot) | +| `ja3`, `ja4` | `eq`, `in`, `exists` | + +Shorthand values expand as follows: a string with `*` uses `wildcard`, any other string uses `eq` (text fields ignore case), an array uses `in`, and an `ip` string with `/` uses `inCidr`. Use an explicit clause object for everything else (`{ op: "startsWith", value: "/admin/" }`, `{ op: "in", values: ["RU"], not: true }`, `{ op: "exists" }`). Read the full catalog via [`getTrafficRuleCatalog`](/api/reference/spaces/gettrafficrulecatalog). + +## Add, inspect, and remove settings rules + +Add Space settings rules without publishing from the CLI or dashboard: + +```bash +sf rules add --kind firewall --action challenge --path '/wp-login.php*' +sf rules add --kind firewall --action block --country US,CA --not country +sf rules add --kind cache-bypass --path '/api/*' --name fresh-api +sf rules list +sf rules remove block-logins --kind firewall +``` + +To add a rule in the dashboard: + +1. Open the Space's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page and select **New Rule**. +2. Choose **Firewall** or **Cache**. +3. Configure the match pattern and action. +4. Select **Create Rule**. + +Use **Move up** and **Move down** to reorder rules, or **Remove** to delete Space settings rules. To edit a config rule without publishing, select **Override in Dashboard** to copy it into Space settings. + +The **Edge Allowance** card and `sf rules list` (`listSpaceTrafficRules`) show each rule's placement (**Edge** or **Origin**) and state (`live`, `pending`, `over_quota`, `invalid`, `failed`, `suspended`, `disabled`, or `unknown`). Duplicate rules or duplicate names are reported under `collapsed`. + +To write settings rules over the API, read the Space with [`getSpace`](/api/reference/spaces/getspace), send back the full `config` with your updated `config.firewall` or `config.cache.bypass` arrays via [`updateSpace`](/api/reference/spaces/updatespace), and pass `settingsDigest` as `baseSettingsDigest` to avoid overwriting concurrent edits. + +## Test a URL and validate rules + +Evaluate firewall and cache-bypass rules locally without sending requests to your Space: + +```bash +sf rules test /wp-login.php --country RU +sf rules test /api/orders --file spacefast.config.ts +sf rules validate +``` + +`sf rules validate` checks your config file against the grammar and edge limits, printing field paths such as `firewall[0].match.country` and exiting `2` on errors (same check as [`validateSpaceTrafficRules`](/api/reference/spaces/validatespacetrafficrules)). + +On the Space's [**Traffic Rules**](https://my.spacefast.com/?to=/:team/:space/rules) page, open **Test a request against your rules** under the rule list to test a path with optional **Country**, **IP address**, **User agent**, **Header**, or **Cookie** values. The dashboard tester does not accept method, ASN, referrer, JA3, or JA4 inputs, so rules using those fields may behave differently at the edge. + +## Pause and resume all rules + +Pause every Traffic Rule at once without deleting them: + +```bash +sf rules pause +sf rules resume +``` + +In the dashboard, select **Pause All Edge Rules** and **Resume**. Over the API, call [`pauseSpaceTrafficRules`](/api/reference/spaces/pausespacetrafficrules) and [`resumeSpaceTrafficRules`](/api/reference/spaces/resumespacetrafficrules). Pause and resume apply immediately without a publish. Rules added while paused stay parked until resumed. + +## Place redirects and headers at the edge + +By default, your Space answers redirects and header rules at origin. To move eligible rules to the edge, set `config.placement.edge` to `true` via [`updateSpace`](/api/reference/spaces/updatespace); the change applies at the next publish. Rules the edge cannot evaluate faithfully (such as path captures, proxies, `404` rules, or redirects outside `301`/`302`/`307`/`308`) remain at origin. Publishing with edge placement while rules are paused fails with [`traffic_rules_placement_incomplete`](/errors/traffic_rules_placement_incomplete). + +### When rule changes take effect + +| Change | Takes effect | +| --- | --- | +| `firewall` or `cache.bypass` in `spacefast.config.ts` or `sf.jsonc` | On publish | +| `firewall` or `cache.bypass` in Space settings | On settings save | +| `redirects`, `rewrites`, or `headers` in Space settings | Immediately on a Space with a live version, else first publish | +| `_redirects`, `_headers`, or config `redirects`, `rewrites`, `headers` | On publish | +| Pause or resume | Immediately | +| `placement.edge` | Next publish | + +## Automatic DDoS protection + +Spaces include platform-level protection against denial-of-service and distributed denial-of-service (DDoS) attacks automatically at the edge with no setup or plugin required. + +Inbound requests arrive through an Anycast IP range that connects visitors to a nearby Spacefast edge data center without exposing origin addresses directly. At the edge, a load balancer answers eligible requests from Edge Cache, applies rate limiting and traffic classification, and filters repeated or unwanted traffic before it consumes origin compute. Send traffic directly to Spacefast DNS rather than stacking a third-party proxy in front whenever possible, because extra proxies can mask client IPs and interfere with edge classification and TLS HTTP-01 checks. + +## Defensive Mode and browser challenges + +Defensive Mode uses edge browser challenges to reduce unwanted automated traffic. Most challenges are automated proof-of-work checks that pass in up to five seconds, though the platform can escalate to an interactive checkbox. Spacefast also challenges suspicious traffic independently of Defensive Mode (such as spoofed crawlers), so seeing a browser-check page does not by itself mean manual or Automatic Defensive Mode is active. + +| Trigger | Behavior | +| --- | --- | +| Manual Defensive Mode | Lasts from 30 minutes to seven days. Contact Spacefast support if site-wide protection is needed during an incident. | +| Automatic Defensive Mode | Enabled temporarily after an origin compute-limit event recorded internally as HTTP `599` (a compute worker was not available in time, even if CPU is not maxed out). Can auto-extend while conditions persist; legitimate visitors are challenged at most once per hour. | +| Traffic classification | Triggered when a request matches an abusive or spoofed pattern, such as a spoofed crawler, even while Defensive Mode is off. | +| Firewall `challenge` rule | A `sf rules` rule with `action: "challenge"` targets patterns you define, independently of site-wide Defensive Mode. | + +Challenge responses return HTTP `403`. The platform challenge system cannot be fully disabled. Recognized legitimate traffic (including essential commerce callbacks) has built-in exceptions that also apply to firewall `challenge` rules, but always test critical webhooks and integrations after adding challenge rules. + +## Edge rate limiting (`429`) vs. capacity (`599`) and challenges (`403`) + +The edge classifies traffic by request rate, URL pattern, `User-Agent`, proxy traits, and connection signals rather than IP address alone. Exact thresholds evolve with traffic; do not build applications around an undocumented requests-per-second cap. + +- **True edge rate limit (`429`)**: The request matched an edge rate limit and appears as `429` in [edge request logs](/logs#edge-request-logs) and [Stats](/stats). Bursts of `429`s can also accompany a DDoS event or crawl loops hitting `404` URLs. +- **Origin compute limit (`599`)**: A visitor-facing rate-limit page can represent an internal HTTP `599` event (no compute worker available in time). Compare edge logs and origin logs rather than assuming every visible `429` is a request-rate rule. +- **Application admission limit (`429` + `Retry-After`)**: Spacefast bounds concurrent application work. Respect `Retry-After` and back off exponentially. +- **Browser challenge (`403`)**: Belongs to Defensive Mode or traffic classification, not rate limiting. See [HTTP status codes](/infrastructure/http-status-codes) for all platform-controlled codes and [API rate limits](/api/rate-limits) for `api.spacefast.com` limits. + +### Send an accurate `User-Agent` from your own automation + +Send a specific, accurate `User-Agent` (such as `ExampleMonitor/1.0`) from every monitor, webhook, sync job, or API client you control instead of generic library defaults. Never copy a browser or `Googlebot` `User-Agent`: spoofed crawler headers from outside Google's network trigger an HTTP `403` challenge and do not show how Spacefast treats genuine search crawlers. + +### Verify or report unexpected blocks + +Inspect edge and origin logs together for the affected hostname and UTC window: + +```bash +sf logs edge --space my-site --status 429 +sf logs edge --space my-site --status 403 +sf logs access --space my-site +``` + +When reporting an unexpected challenge or false-positive rate limit to Spacefast support, include the affected Space and hostname, exact UTC timestamps, full request URLs, source IP addresses, complete `User-Agent` headers, and whether any third-party proxy sits in front of the Space. + +## Limits + +| Limit | Value | +| --- | --- | +| Rules per `firewall` or `cache.bypass` list | 50 | +| Comparisons per firewall rule | 47 | +| Comparisons per cache-bypass rule | 50 | +| Values in one `in` or `inCidr` clause | 1,000 | +| Characters per value | 4,096 | +| Characters per header, cookie, or query name | 128 | +| Characters in `description` | 255 | +| Rules active at the edge | Set by the edge (shown in **Edge Allowance**) | + +Space settings and config files each keep their own lists. Keyed fields count one comparison per key, and a firewall rule with `any: true` uses one edge slot per comparison. + +## CLI, API, MCP, and SDK + + diff --git a/content/_llms-preamble.md b/content/_llms-preamble.md index 1a5cab76..8bf78172 100644 --- a/content/_llms-preamble.md +++ b/content/_llms-preamble.md @@ -3,19 +3,19 @@ title: llms.txt preamble description: Agent guidance placed at the top of dist/llms.txt through agents.llmsTxt.details. The underscore keeps it out of the site; verify-prose still lints it. --- -Spacefast is the build companion and infrastructure for people and AI agents: one Space combines static files, full-stack SpacePress apps (collections, SQL tables, ORM queries, server actions, jobs, TSX pages, WooCommerce, and WordPress REST/Abilities), MySQL, Workers, object storage, transactional email, crons, connectors, custom domains, and sharing — all configured in `spacefast.config.ts` and driven through the CLI, REST API, SDK, MCP, or Poppy. Billing changes require a person in the dashboard. +Spacefast is the build companion and infrastructure for people and AI agents. One Space combines static files, full-stack SpacePress apps (collections, SQL tables, ORM queries, server actions, jobs, TSX pages, WooCommerce, and WordPress REST and Abilities), MySQL, Workers, object storage, transactional email, crons, connectors, custom domains, and sharing. Everything is configured in `spacefast.config.ts` and driven through the CLI, REST API, SDK, MCP, or Poppy. Billing changes require a person in the dashboard. -Read this header first: it gives you the exact machine-readable endpoints, setup paths, and reference pointers before the authored page index. +Read this header first. It gives you exact machine-readable endpoints, sharp edges, setup paths, and reference pointers before the authored page index. ## Read any page as Markdown -Add `.md` to any docs URL to get raw Markdown without HTML chrome: +Add `.md` to any docs URL to fetch raw Markdown without HTML chrome: ```text https://spacefast.com/docs/publish/ -> https://spacefast.com/docs/publish.md ``` -Every authored page works both ways. For the OpenAPI references, parse the machine-readable specs below instead of scraping HTML. +Every authored page works both ways. For OpenAPI references, parse the machine-readable specs below instead of scraping HTML. ## Machine-readable endpoints @@ -33,13 +33,23 @@ Every authored page works both ways. For the OpenAPI references, parse the machi | Read one docs page by slug | `GET https://api.spacefast.com/v1/docs/pages/{slug}` | | Ask docs endpoint | `POST https://api.spacefast.com/v1/docs/ask` | +## Agent gotchas + +- **New Spaces start private.** Unless the team changed its default, a bare `liveUrl` requires sign-in. Confirm access or create a viewer share link before declaring a Space public. +- **Reuse `.spacefast/` on updates.** Do not list Spaces before a normal publish, and pass `createNew: true` only when the user asks for a separate Space. +- **SpacePress is a managed application server.** No custom origin code runs outside SpacePress (no arbitrary PHP, third-party WordPress plugins, theme ZIPs, `.htaccess`/`.user.ini`, or `wp plugin install`). Use `spacepress.config.ts`, `sp/`, and `"spacepress/*"` imports; put Node/npm code in Workers and external APIs in Connectors. Validate with `sf check` and deploy with `sf publish` (never run `spacepress login`, `spacepress push`, or `spacepress dev`). Read visitor-scoped data from `"spacepress/server/db"`. Use `.column()` / `storageName` / `.alias()` (not `.was()`), and omit `locales` (currently disabled). On `feature_unavailable`, tell a team owner or admin to join SpacePress under Settings → Labs. +- **Idempotency and polling.** Send an `Idempotency-Key` on `POST` mutations and poll `operation_status` or `GET /v1/operations/{operationId}` until terminal (`succeeded`, `failed`, or `canceled`). +- **Approvals and pauses.** When an action pauses for approval or hits Emergency Pause, wait for the person's decision and call `resume_execution` with the saved `executionId`. Never start a duplicate mutation to work around a pending approval. +- **Never print secrets.** Keep `sfa_`, `sfm_`, `sfs_` keys, upload tokens, and `.spacefast/state.json` out of logs and replies. +- **Human-only actions.** Billing changes, team membership/role edits, and approving/denying approval requests always require a signed-in person in the dashboard. + ## Task-to-reference pointers - **Exact CLI flags, exit codes, and anchors:** [CLI overview](https://spacefast.com/docs/cli.md) and [CLI reference](https://spacefast.com/docs/cli/reference.md). - **Exact `spacefast.config.ts` keys and `sf.jsonc` fallback:** [Project configuration](https://spacefast.com/docs/config-file.md). New projects use `spacefast.config.ts` with `defineConfig` from `spacefast/config`; `sf.jsonc` remains permanently supported. - **Exact RFC 9457 error codes:** construct `https://spacefast.com/docs/errors/.md` directly from the problem document's `code`, or browse the [Error reference](https://spacefast.com/docs/errors.md). - **Exact plan allowances and caps:** [Pricing and limits](https://spacefast.com/docs/pricing.md) and [Limits](https://spacefast.com/docs/limits.md). -- **HTTP request schemas and idempotency:** parse `https://api.spacefast.com/openapi.json`, or browse [REST API](https://spacefast.com/docs/api.md) and [API reference](https://spacefast.com/docs/api/reference). +- **HTTP request schemas and idempotency:** parse `https://api.spacefast.com/openapi.json`, or browse [REST API](https://spacefast.com/docs/api.md) and [API reference](https://spacefast.com/docs/api/reference/). - **Per-client agent setup and connection methods:** [Agent setup](https://spacefast.com/docs/setup/) and [Ways to connect](https://spacefast.com/docs/connect/). ## Set up an agent @@ -50,9 +60,7 @@ Any agent that can fetch URLs and make HTTP requests can follow: Fetch https://spacefast.com/setup.md and follow it. ``` -That guide distinguishes connected MCP/CLI clients, anonymous HTTP publishing (via `https://spacefast.com/publish-spec.json`), and full-stack Space apps. - -For coding agents in a terminal, run the zero-install setup wizard or install the plugin/skill: +For coding agents in a terminal, run the zero-install setup wizard or install the skill: ```bash npx -y spacefast setup @@ -77,7 +85,7 @@ Read one page with `GET https://api.spacefast.com/v1/docs/pages/{slug}`. Each re Large generated families appear as their index pages below so this index stays concise; their URLs are frozen contracts: -- [Error reference](https://spacefast.com/docs/errors): every error code and resolution (`https://spacefast.com/docs/errors/`). -- [API reference](https://spacefast.com/docs/api/reference): browsable REST API (`https://api.spacefast.com/openapi.json` for machine parsing). -- [Changelog](https://spacefast.com/docs/changelog): release timeline, with per-package history linked from it. -- [Agent setup](https://spacefast.com/docs/setup) and [Ways to connect](https://spacefast.com/docs/connect): generated per-agent setup pages and connection methods. +- [Error reference](https://spacefast.com/docs/errors/): every error code and resolution (`https://spacefast.com/docs/errors/`). +- [API reference](https://spacefast.com/docs/api/reference/): browsable REST API (`https://api.spacefast.com/openapi.json` for machine parsing). +- [Changelog](https://spacefast.com/docs/changelog/): release timeline, with per-package history linked from it. +- [Agent setup](https://spacefast.com/docs/setup/) and [Ways to connect](https://spacefast.com/docs/connect/): generated per-agent setup pages and connection methods. diff --git a/content/agents/anonymous-and-claim.mdx b/content/agents/anonymous-and-claim.mdx index 896f6ef3..89aae082 100644 --- a/content/agents/anonymous-and-claim.mdx +++ b/content/agents/anonymous-and-claim.mdx @@ -40,7 +40,7 @@ From the browser, [drop.fast](https://drop.fast) does the same thing while signe Before claiming, you can publish updates, manage scoped viewer links, and promote or roll back to a version ID from an earlier receipt. Listing version history, downloading files, and exporting app data return [`space_unclaimed`](/errors/space_unclaimed) until someone claims the Space. Run [`sf spaces claim`](/cli/reference/spaces#sf-spaces-claim) in the publishing directory, sign in, then retry. -## The clock +## Expiry and recovery window An unclaimed Space serves for **{{anonymous-ttlSeconds}}** after creation or the latest publish that changes files, capped at {{anonymous-publishAbsoluteCapSeconds}} from creation, then stops. A publish that changes nothing creates no version and leaves the deadline where it was. @@ -50,7 +50,7 @@ Opening the claim page when less than an hour remains moves the deadline to one To get a warning before the clock runs out, leave an address. Set `email` on the publish body, or call [`createSpaceClaimReminder`](/api/reference/spaces/createspaceclaimreminder). The reminder goes out about 3 hours before expiry. Spacefast stores the address only until the Space is claimed or expires, then deletes it without writing it to logs. -## Caps +## Anonymous publish limits Anonymous publishing has stricter limits than the Personal plan: @@ -67,7 +67,7 @@ Exceeding the inline file-count or size ceiling returns [`publish_inline_limit_e One more difference: an unclaimed Space accepts every file type, but only *serves* text, images, fonts, JSON, web manifests, JavaScript, PDF, gzip, XML, RSS, and Atom. Other file types, such as archives or executables, upload normally but return `403` until you claim the Space. Full numbers are on [Limits](/limits). -## Claim it +## Claim an anonymous Space @@ -126,7 +126,7 @@ If you keep access, the agent's next request trades the demoted key for an API k For what a credential like this can and cannot do, see [what agents are allowed to do](/agents/permissions). -## Rotating the key +## Rotate the Space key If the key leaked, replace it with [`sf spaces key rotate`](/cli/reference/spaces#sf-spaces-key-rotate) or [`rotateSpaceKey`](/api/reference/publishing/rotatespacekey): @@ -136,7 +136,7 @@ sf spaces key rotate --space spc_9f2c1ab34d5e4f6789ab01cd23ef4567 You get a fresh `claim` receipt. The old key, its `url`, its claim link, and every view session opened through it stop working immediately. Explicit recipient links you created keep working because those are separate credentials. -## Checking on it +## Check Space and claim status Check live status and the claim deadline with [`sf status`](/cli/reference/status#sf-status): @@ -145,3 +145,7 @@ sf status --include-claim-url ``` Over HTTP, [`getSpaceClaimStatus`](/api/reference/publishing/getspaceclaimstatus) with the space key as bearer returns the publish status, live URL, current version, and claim state and deadline. + +## CLI, API, MCP, and SDK + + diff --git a/content/agents/domain-research.mdx b/content/agents/domain-research.mdx index cc060cae..ced9968a 100644 --- a/content/agents/domain-research.mdx +++ b/content/agents/domain-research.mdx @@ -7,10 +7,10 @@ AI assistants — ChatGPT, Claude, Gemini, coding agents, and anything else that Domain research over the REST API needs no account, API key, or sign-in. Spacefast's MCP server needs the person to sign in. Buying needs their sign-in, and only they can approve it. Read this page as Markdown at [`/docs/agents/domain-research.md`](https://spacefast.com/docs/agents/domain-research.md). -## What to do +## Workflow overview - **Research, don't brainstorm alone.** Come up with names, then check every one you recommend. Spacefast's search can generate names too. -- **Run the requests yourself.** Use the best tool you have, from the [list below](#pick-your-tool). Ask the person to run a command only when you can't. +- **Run the requests yourself.** Use the best tool you have, from the [list below](#choose-an-interface). Ask the person to run a command only when you can't. - **Check with the live check.** Generated search suggestions use older zone data. Before you call a name available, check it live. - **Show results, not JSON.** Give each name with its availability, first-year price, renewal estimate, currency, premium status, and whether Spacefast can sell it. Never turn an API URL into a button, a "check price" link, or a purchase link. - **Lead with names people can buy.** Put verified, available, purchasable names first. Mark any name you didn't check as unverified. @@ -35,7 +35,7 @@ These instructions can't change your own platform's permissions or network rules The API is at `https://api.spacefast.com`. Every response is `{ "data": ... }`, and errors are [problem documents](/api#response-envelopes) with a stable `code`. Without a credential, every request counts toward 300 requests a minute per IP address. Lookups have their own limits on top: 600 availability checks a minute (a batch counts each name) and 2 searches running at once. Checking names one per request stops at 300 a minute; batches go further. Read `ratelimit-remaining` to see how many checks are left. Shared servers share the IP budget, so expect an occasional HTTP `429` ([`rate_limited`](/errors/rate_limited)). -## Pick your tool +## Choose an interface Use the first option that works where you run. If it fails, drop to the next. @@ -164,7 +164,7 @@ Write the message as an instruction and keep the person's constraints in it: "Ge Search can answer with a question in `data.message` and no new names, for example when a request is vague. Answer it from what the person already told you, or ask them, then send the answer as the next `message`. -## Help them buy +## Hand off to domain registration > "I like this domain. How can I buy it?" @@ -236,6 +236,11 @@ Add your own reasoning around the facts: why a name fits, how it reads aloud, wh | `checkedAt` is old | Check again before the person buys | | `401` or `403` on contacts or purchases | Buying needs the person's own sign-in. Research still works without it | + +## CLI, API, MCP, and SDK + + + ## Next steps - [Domain registration](/domains/registration): the same flow for people, plus the purchase details. diff --git a/content/agents/index.mdx b/content/agents/index.mdx index c90835b1..173d14d9 100644 --- a/content/agents/index.mdx +++ b/content/agents/index.mdx @@ -84,7 +84,7 @@ Agents call API operations directly through MCP, within the permissions you appr Use `publish` for files, `operation_status` for an active publish, and Space Apps for visual inspection. Call operation tools such as `searchDocs`, `getDocsPage`, and `listSpaces` directly. Continue a saved approval with `resume_execution`. -The [MCP reference](/agents/mcp-server#the-tools) links the current tool catalog and explains the runtime differences. Read the operation schema before calling it, and check a write with a read before reporting success. +The [MCP reference](/agents/mcp-server#available-tools) links the current tool catalog and explains the runtime differences. Read the operation schema before calling it, and check a write with a read before reporting success. If your team has a saved [Design System](/design-system), your agent can read its standards and files while working on a project. Ask it to apply the system to a new build or bring an existing project into line with the current rules. @@ -102,7 +102,7 @@ Point docs.example.com at this Space and tell me which DNS records to add. ## Pick your client -Every supported client has its own step-by-step page under [Agent setup](/setup): +Every supported AI client has its own step-by-step setup guide under [Set up your agent](/setup), and protocol comparisons live under [Ways to connect](/connect). Pick your client in the sidebar or start with the most common setups: diff --git a/content/agents/mcp-server.mdx b/content/agents/mcp-server.mdx index 632d2acb..8f87b2eb 100644 --- a/content/agents/mcp-server.mdx +++ b/content/agents/mcp-server.mdx @@ -75,7 +75,7 @@ The local server takes its credential from the process, never from client config | `SPACEFAST_API_URL` | API base URL | | `SPACEFAST_MCP_WORKSPACE_ROOT` | Pins the one directory `publish` may read from | -## The tools +## Available tools The [Spacefast discovery card](https://api.spacefast.com/.well-known/mcp/server-card.json) publishes the hosted tool catalog. It is a Spacefast discovery artifact. Your connection's `tools/list` is the authority for the tools and input schemas available to that client. diff --git a/content/agents/permissions.mdx b/content/agents/permissions.mdx index 29867dcf..8cba800e 100644 --- a/content/agents/permissions.mdx +++ b/content/agents/permissions.mdx @@ -64,7 +64,16 @@ Press **Review** to see the rationale the agent gave, which Space or domain it t Only risky operations prompt: publishing over a live Space, deploying, rolling a version back, buying a domain, and changing DNS. Routine publishing doesn't, because people stop reading a prompt that appears on every publish. -Ask for one of those to see the flow end to end. +### Approval inbox, Team Reviews, session rules, and Emergency Pause + +Spacefast routes personal approval prompts, **Team Reviews** (grant approvals, tag revisions, connector serving requests, and parked connector calls), approval policies, Work Mode, and **Emergency Pause** through one approval system. See [Approvals and Emergency Pause](/approvals) for every policy scope, dry-run simulation (`POST /v1/approvals/policy/simulate`), and Pause endpoint: + +- **Team Reviews:** Team owners and admins review team-scoped actions in the same inbox. Access checks scope visible rows and personal rules to the teams and Spaces you administer. +- **Session approval rules:** Hosted MCP can remember approved safe calls for the current session so you do not re-approve identical actions. Sibling sessions sharing a grant keep separate rules, and ineligible actions fall back to a one-time approval. +- **Emergency Pause:** A field-level pause stops agent mutations (such as Space writes and join-link creation) while keeping human dashboard work and read-only calls running. Saving other approval categories preserves Pause. +- **Work Mode concurrency:** Updating Work Mode (`PUT /v1/spaces/{spaceId}/work-mode`) accepts an optional `If-Match` header with `ETag` concurrency checks and returns HTTP `412` if the policy changed since you read it. + +Ask for one of those risky actions to see the approval flow end to end. Roll this Space back to the previous version. @@ -96,3 +105,6 @@ A handoff link lives 15 minutes and can be redeemed once. A team can have 10 pen - **Stop All Agent Access** is the account-wide emergency stop. It revokes everything acting as you and cancels handoff links that were never redeemed. Team-owned automation is not yours alone, so it survives. Team owners and admins have the same control from the team's [**Agents**](https://my.spacefast.com/?to=/:team/agents) page, under **Who can act here**. **Remove from team** takes an agent's reach into that one team away and leaves the rest alone. +## CLI, API, MCP, and SDK + + diff --git a/content/agents/skills.mdx b/content/agents/skills.mdx index 0959ce07..87a25997 100644 --- a/content/agents/skills.mdx +++ b/content/agents/skills.mdx @@ -5,7 +5,7 @@ description: The base Spacefast skill and the task skills for saving and using a The Spacefast plugins and [`sf skills install`](/cli/reference/skills#sf-skills-install) install the base `spacefast` skill for publishing, inspection, and management. The format and tool choices depend on the client. Adding only an [MCP server](/agents/mcp-server) connection doesn't install the skill; run [`sf setup agent`](/cli/reference/setup#sf-setup-agent) to configure both. -The plugins also include task skills for building a Space, editing a Space, sharing, custom domains, fixing a deployment, and saving and using a team's Design System. For custom skills shared across your own team, see [Team Skills](/team-skills). +The plugins also include task skills for building a Space, editing a Space, sharing, custom domains, fixing a deployment, and saving and using a team's Design System. Teams with SpacePress enabled also receive the `spacepress` skill automatically through agent setup and context endpoints, teaching agents the exact `spacepress` module names, `sf check` / `sf publish` workflow, and server-side access rules. For custom skills shared across your own team, see [Team Skills](/team-skills). ## The base `spacefast` skill @@ -99,11 +99,11 @@ The rest sets behavior the tools alone do not enforce. `references.md` holds the deeper material: hosted versus On-Device differences, the update and claim flow, approvals and `resume_execution`, [`spacefast.config.ts`](/config-file) options, and signed uploads. The skill tells the agent to load it only when the question needs it. -## Kept in sync with the tools +## Automated tool-sync checks -A CI check re-renders every skill variant and compares the tool names it mentions against the live tool list, in both directions. A tool added without a skill update fails the build, and so does a skill that names a tool which no longer exists. The tool catalog comes from the API operations; read the current [MCP reference](/agents/mcp-server#the-tools). +A CI check re-renders every skill variant and compares the tool names it mentions against the live tool list, in both directions. A tool added without a skill update fails the build, and so does a skill that names a tool which no longer exists. The tool catalog comes from the API operations; read the current [MCP reference](/agents/mcp-server#available-tools). -## Install the base skill on its own +## Install the base skill without MCP If you want the skill without touching MCP config, the CLI installs the copy bundled with it. @@ -135,6 +135,6 @@ npx -y skills add spacefast/plugins --skill spacefast -g -y ## Install and update behavior -Installs are fail-closed. If the skill directory holds a file the manifest does not recognize, the CLI marks the state unverifiable and refuses to install or remove without `--force`. Only `.DS_Store`, `.localized`, `Thumbs.db`, and `desktop.ini` are exempt. +Installs refuse to overwrite unrecognized files. If the skill directory holds a file the manifest does not recognize, the CLI marks the state unverifiable and refuses to install or remove without `--force`. Only `.DS_Store`, `.localized`, `Thumbs.db`, and `desktop.ini` are exempt. The bundled skill refreshes itself. Almost every `sf` command upgrades an installed skill in the background, but only when the installation still matches its manifest. A copy you edited is left alone. diff --git a/content/guides/frameworks.mdx b/content/guides/frameworks.mdx index 6d0b59e1..d20e25b3 100644 --- a/content/guides/frameworks.mdx +++ b/content/guides/frameworks.mdx @@ -5,7 +5,7 @@ description: Publish your framework's output directly, or hand Spacefast the sou Publish built output directly when you have it; Spacefast can build from source when you don't. -## Two paths +## Remote builds vs. prebuilt uploads **Publish the output.** You run the build, Spacefast takes the directory. This is the fast path and the recommended default. Your machine or your CI already has the toolchain warm, and failures show up where you can debug them. The publish itself is a file upload. @@ -32,26 +32,25 @@ Detection uses this table for both paths. For a prebuilt static site, pass the o | --- | --- | --- | --- | | `vinext` | `vinext` dependency, unless the build script runs `next build`. If `next` is also installed, the build script must run `vinext build`, `vinext deploy`, or `vinext export` | `vinext build` | `dist/client` | | [Next.js, server-rendered](/guides/recipes/next) | `next` or `nextra` dependency on a supported release | `next build` | Run `sf publish` from the project root | -| [Next.js, static export](/guides/recipes/next#the-output-directory) | Next.js configured with `output: "export"` | `next build` | `out` by default. Run `sf publish ./out --prebuilt` | +| [Next.js, static export](/guides/recipes/next#output-directory) | Next.js configured with `output: "export"` | `next build` | `out` by default. Run `sf publish ./out --prebuilt` | | TanStack Start | `@tanstack/react-start` dependency | package script | `dist/client` | -| Nuxt | `nuxt` dependency | `nuxt generate` | `.output/public` | +| [Nuxt](/guides/recipes/nuxt) | `nuxt` dependency | `nuxt generate` | `.output/public` | | [Astro](/guides/recipes/astro) | `astro` dependency or `astro.config.*` | `astro build` | `dist` | | VitePress | `vitepress` dependency | `vitepress build docs` | `docs/.vitepress/dist` | -| SvelteKit | `@sveltejs/kit` dependency | package script | `build` | +| [SvelteKit](/guides/recipes/sveltekit) | `@sveltejs/kit` dependency | package script | `build` | | SolidStart | `@solidjs/start` dependency | `vinxi build` | `.output/public` | | Qwik | `@builder.io/qwik-city` dependency | package script | `dist` | | Gatsby | `gatsby` dependency | package script | `public` | | Remix | `@remix-run/dev` dependency | package script | `build/client` | -| Docusaurus | `@docusaurus/core` dependency | package script | `build` | +| [Docusaurus](/guides/recipes/docusaurus) | `@docusaurus/core` dependency | package script | `build` | | RedwoodJS | `@redwoodjs/core` dependency or `redwood.toml` | `redwood build web` | `web/dist` | | Angular | `@angular/cli` dependency or `angular.json` | `ng build` | `dist` | | Ember | `ember-cli` dependency or `ember-cli-build.js` | `ember build` | `dist` | | Gridsome | `gridsome` dependency or `gridsome.config.js` | `gridsome build` | `dist` | -| Eleventy | `@11ty/eleventy` dependency or `.eleventy.js`, `eleventy.config.*` | `eleventy` | `_site` | | Hexo | `hexo` dependency | `hexo generate` | `public` | | [Vite](/guides/recipes/vite) | `vite` dependency or `vite.config.*` | `vite build` | `dist` | | Zola | `config.toml` plus a `templates` directory | `zola build` | `public` | -| Hugo | `hugo.toml` or `config.toml` | `hugo` | `public` | +| [Hugo](/guides/recipes/hugo) | `hugo.toml` or `config.toml` | `hugo` | `public` | | Jekyll | `_config.yml`, `_config.yaml`, or `_config.toml` | `bundle exec jekyll build --config ` | `_site`, or `destination` from the config | | MkDocs | `mkdocs.yml` or `mkdocs.yaml` | `mkdocs build` | `site` | | Sphinx | `conf.py` | `sphinx-build -M html . _build` | `_build/html` | diff --git a/content/guides/index.mdx b/content/guides/index.mdx index ca816e9c..70b9a942 100644 --- a/content/guides/index.mdx +++ b/content/guides/index.mdx @@ -43,6 +43,12 @@ To let someone else try the form, [create a viewer link](/share). ## Recipes + + Typed collections, Markdown sync, drafts, revisions, RSS/Atom feeds, XML sitemaps, and TSX pages in one Space. + + + Dedicated MySQL tables, typed server actions, Sign in with Spacefast, progressive forms, and background jobs. + Publish a folder of HTML, CSS, and assets with no build step and no package manager. @@ -53,15 +59,30 @@ To let someone else try the form, [create a viewer link](/share). Build a supported Next.js release with server rendering or publish a prebuilt static export. - Build a static or server-rendered Astro Space and validate routing with `@spacefast/astro`. + Deploy static or server-rendered Astro, or move an existing Astro project off another platform. + + + Swap in `@sveltejs/adapter-static`, configure prerendering or SPA fallback, and publish `build`. + + + Remove platform Nitro presets, run `nuxt generate`, and publish `.output/public`. + + + Set `url` and `baseUrl`, run `npm run build`, and publish `build`. + + + Set `baseURL`, build `public`, and publish with `sf publish`. + + + Publish apps from pnpm, Turborepo, Bun, or npm workspaces with `--root-directory` and `--install-directory`. ## Migrate - - Capture a live public website into a static Space from your browser or with `sf migrate`. + + Pick the right mechanical path for a public website, framework repo, multi-app workspace, legacy app, or single HTTP request. Compare what carries across automatically and pick the guide for your current platform. diff --git a/content/guides/meta.ts b/content/guides/meta.ts index a26fe728..fab3f464 100644 --- a/content/guides/meta.ts +++ b/content/guides/meta.ts @@ -3,5 +3,5 @@ import { defineMeta } from "blume"; export default defineMeta({ title: "Guides", collapsed: false, - pages: ["index", "starters", "frameworks", "recipes", "migrate", "migrate-from"], + pages: ["index", "starters", "frameworks", "recipes", "migrate", "migrate-from", "zero-migration"], }); diff --git a/content/guides/migrate-from/cloudflare-pages.mdx b/content/guides/migrate-from/cloudflare-pages.mdx index 20a64d9b..226e01f6 100644 --- a/content/guides/migrate-from/cloudflare-pages.mdx +++ b/content/guides/migrate-from/cloudflare-pages.mdx @@ -41,7 +41,7 @@ Your `_redirects` and `_headers` files publish with your pages as optional migra For a public site, [set access to Public](/share#make-a-space-public), then open the homepage and a deep link while signed out. For a private site, first confirm neither address shows the page while signed out. Then open a [viewer link](/share#create-a-share-link) that covers both paths and confirm they load. - Add the domain to the Space and add the DNS records it asks for. Delete the old address records, because a leftover record blocks verification. If a proxy sits in front of the hostname, check that it does not block the HTTP validation request. Spacefast issues the certificate once DNS points at it. See [Custom domains](/domains) and [TLS certificates](/infrastructure/tls-certificates). + Add the domain to the Space and add the DNS records it asks for. Delete the old address records, because a leftover record blocks verification. If a proxy sits in front of the hostname, check that it does not block the HTTP validation request. Spacefast issues the certificate once DNS points at it. See [Custom domains](/domains) and [TLS certificates](/domains/tls-certificates). Once the certificate is active, repeat both checks on your custom domain. @@ -82,7 +82,7 @@ When you rewrite, check these differences: Requests and responses are the standard `Request` and `Response`, so code inside a handler that uses only those usually needs little change. -## What doesn't +## What does not carry over - **`cloudflare-cdn-cache-control`** and the other CDN-specific cache headers are rejected with `header_cdn_cache_unsupported`. Spacefast manages shared caching; `Cache-Control` still applies to browsers. See [Caching](/caching). - **`_routes.json`** and the `.wrangler` folder are dropped at publish. See [what gets uploaded](/publish#what-gets-uploaded). diff --git a/content/guides/migrate-from/github-pages.mdx b/content/guides/migrate-from/github-pages.mdx index 30a89480..02b2f25a 100644 --- a/content/guides/migrate-from/github-pages.mdx +++ b/content/guides/migrate-from/github-pages.mdx @@ -44,10 +44,10 @@ Connect the repository and Spacefast builds it on every push to the production b | --- | --- | | The repository | Stays on GitHub. Spacefast builds from its webhooks | | A Jekyll project with a `Gemfile` | Detected from its config file and built with `bundle exec jekyll build` | -| Hugo, Eleventy, Astro, MkDocs, and other generators | Detected from their dependency or config file. See [Frameworks and builds](/guides/frameworks) | +| Hugo, Astro, MkDocs, and other generators | Detected from their dependency or config file. See [Frameworks and builds](/guides/frameworks) | | Pages served from a folder such as `/docs` | Set **Output directory**, or **Root directory** for a generator, under **Build settings** | -## What you get on top +## Additional Spacefast capabilities - **Previews.** Pushes to other branches and pull requests build previews with their own alias, alongside the production branch. - **Overrides.** Set `build` options in `spacefast.config.ts` (see [Project configuration](/config-file)), or set **Root directory**, **Install command**, **Build command**, or **Output directory** under **Build settings**. diff --git a/content/guides/migrate-from/glitch.mdx b/content/guides/migrate-from/glitch.mdx new file mode 100644 index 00000000..ef051b67 --- /dev/null +++ b/content/guides/migrate-from/glitch.mdx @@ -0,0 +1,45 @@ +--- +title: Move from Glitch +description: Publish a downloaded Glitch project on Spacefast. Static projects publish as they sit; Node servers rewrite as Workers routes +--- + +Glitch stopped serving projects on July 8, 2025, and offered code downloads through the end of 2025 ([Glitch's announcement](https://blog.glitch.com/post/changes-are-coming-to-glitch), checked 2026-11-14). If you kept the download, your AI can publish it on Spacefast. + +## Move the project + + + + Put the project in its own folder. + + + Connect Spacefast to your agent ([Agents](/agents) lists the setup paths), open the folder, and send: + + + Publish the project in this folder on Spacefast. It used to run on Glitch. Keep it working the same way and send me the link. + + + A project with only HTML, CSS, and browser scripts publishes as it sits. A Node server needs its routes rewritten as [Workers](/functions) routes or moved to a [supported framework](/guides/frameworks), and your agent can do that rewrite. + + + `.env` files are never published. Set each value on the Space instead with `sf env set` or `sf env import .env`. See [Environment variables](/environment-variables). + + + A team's new Spaces start private unless the team changed its default. Make the Space public or create a share link in [Spacefast Share](/share) once it works. + + + +Without an agent, a folder with an `index.html` and no `package.json` publishes from [drop.fast](https://drop.fast) or with `sf publish`. See the [plain HTML recipe](/guides/recipes/html). + +## What carries over + +| From Glitch | On Spacefast | +| --- | --- | +| Static files | Published as they sit in the folder | +| Server routes | Rewritten as [Workers](/functions) routes taking a standard `Request` and returning a `Response` | +| Secrets from `.env` | Set as [environment variables](/environment-variables) and read from `env` | + +## What changes + +- **Timers inside a running server.** A Worker answers requests. Work that ran on a timer becomes a [cron](/crons), a scheduled `GET` against one of your own paths. +- **Local data files.** A Worker reaches the Space's [database](/database) through `env.DB`, not through a file in the project. Rewrite JSON or SQLite file reads and writes against `env.DB`, and load existing rows through the [SQL console](/database#open-the-sql-console). +- **The old project address.** Point your own domain at the Space with [Custom domains](/domains), and update links to the old address. diff --git a/content/guides/migrate-from/index.mdx b/content/guides/migrate-from/index.mdx index 7f58f87f..92ac7fd3 100644 --- a/content/guides/migrate-from/index.mdx +++ b/content/guides/migrate-from/index.mdx @@ -1,6 +1,6 @@ --- title: Move from another platform -description: Move a website to Spacefast from Netlify, Vercel, Cloudflare Pages, GitHub Pages, or here.now +description: Move a website to Spacefast from Netlify, Vercel, Cloudflare Pages, GitHub Pages, Glitch, Val Town, or here.now --- Most projects move with one publish. Spacefast builds the same source, reads the config files other platforms leave in a repository, and flags what it cannot convert. Pick the platform you are leaving. @@ -18,6 +18,12 @@ Most projects move with one publish. Spacefast builds the same source, reads the Connect the repository. Jekyll and other generators are detected. + + Publish a downloaded Glitch folder; rewrite Node routes as Workers. + + + Move HTTP and scheduled vals before Val Town shuts down. + Publish the same folder from the same agent. diff --git a/content/guides/migrate-from/meta.ts b/content/guides/migrate-from/meta.ts index 8d352fca..053e1191 100644 --- a/content/guides/migrate-from/meta.ts +++ b/content/guides/migrate-from/meta.ts @@ -3,5 +3,5 @@ import { defineMeta } from "blume"; export default defineMeta({ title: "Move from", collapsed: true, - pages: ["index", "vercel", "netlify", "cloudflare-pages", "github-pages", "here-now"], + pages: ["index", "vercel", "netlify", "cloudflare-pages", "github-pages", "glitch", "val-town", "here-now"], }); diff --git a/content/guides/migrate-from/netlify.mdx b/content/guides/migrate-from/netlify.mdx index 6c3c722d..c715d15a 100644 --- a/content/guides/migrate-from/netlify.mdx +++ b/content/guides/migrate-from/netlify.mdx @@ -68,7 +68,7 @@ export default defineConfig({ The full rules for build detection are on [Frameworks and builds](/guides/frameworks). -## What doesn't +## What does not carry over - **Netlify Functions and edge functions.** Move request handling to a [Functions](/functions) route or a supported framework's server. Edge functions are flagged at publish. - **`netlify-cdn-cache-control`** is rejected with `header_cdn_cache_unsupported`. Spacefast manages shared caching; `Cache-Control` still applies to browsers. See [Caching](/caching). diff --git a/content/guides/migrate-from/val-town.mdx b/content/guides/migrate-from/val-town.mdx new file mode 100644 index 00000000..08f032f7 --- /dev/null +++ b/content/guides/migrate-from/val-town.mdx @@ -0,0 +1,46 @@ +--- +title: Move from Val Town +description: Move vals to Spacefast before Val Town closes. HTTP vals become Workers routes and scheduled vals become crons +--- + +Val Town closes on January 10, 2027, and code on Val Town becomes read-only on December 10, 2026 ([Val Town's announcement](https://blog.val.town/winding-down), checked 2026-11-14). Export your code first, then have your AI move it to Spacefast. + +## Move your vals + + + + Copy your vals and the vals they import into a folder. Val Town's [migration guides](https://docs.val.town/migration) cover exporting to GitHub. + + + Connect Spacefast to your agent ([Agents](/agents) lists the setup paths), open the folder, and send: + + + Publish the project in this folder on Spacefast. It used to run on Val Town. Keep it working the same way and send me the link. + + + + Set each environment variable your vals read on the Space with `sf env set` or `sf env import`. See [Environment variables](/environment-variables). + + + A team's new Spaces start private unless the team changed its default. Make the Space public or create a share link in [Spacefast Share](/share) once it works. + + + +## Where each kind of val goes + +| On Val Town | On Spacefast | +| --- | --- | +| HTTP val | A [Workers](/functions) route. A module in `functions/` exports a handler per HTTP method, or a root `handler.ts` default-exports `{ fetch }` and answers the whole Space | +| Scheduled val | A [cron](/crons) in `spacefast.config.ts` or `sf.jsonc`: a scheduled `GET` against a Worker route on your own Space | +| SQLite tables | The Space's [database](/database), through `env.DB` | +| Environment variables | [Environment variables](/environment-variables) on the Space, read from the handler's `env` argument | +| Static pages | Published files. See the [plain HTML recipe](/guides/recipes/html) | + +Handlers take a standard `Request` and return a standard `Response`, matching the shape HTTP vals use. + +## What to check + +- **Imports and runtime calls.** Replace `esm.town` imports with local files or npm packages, and replace `Deno.env.get` with the handler's `env` argument. The [Workers](/functions) page lists supported module types. +- **SQL.** Queries move from SQLite to the Space's database through `env.DB`. Check SQLite-specific syntax, and load existing rows through the [SQL console](/database#open-the-sql-console). +- **Schedules.** A five-field crontab schedule requires Boost. Until advanced schedules are enabled, crontabs run at the closest simple schedule, and a Space can declare at most 8 crons with no automatic retries. See [Crons](/crons). +- **Outbound requests.** A Worker's `fetch()` reaches any public host once the Space is claimed. See [Workers outbound HTTP](/functions#outbound-http). diff --git a/content/guides/migrate-from/vercel.mdx b/content/guides/migrate-from/vercel.mdx index cf8e4d66..59174241 100644 --- a/content/guides/migrate-from/vercel.mdx +++ b/content/guides/migrate-from/vercel.mdx @@ -86,7 +86,7 @@ A Spacefast cron is a scheduled `GET` against a path on your own Space, like a V Older releases have known security vulnerabilities, so they are refused before anything builds, with the version to upgrade to (matching OpenNext 1.20.17). The [Next.js recipe](/guides/recipes/next) has the details and the static export fallback. -## What doesn't +## What does not carry over - **Vercel functions** are flagged at publish. Move request handling to a [Functions](/functions) route or a supported framework's server. - **The `.vercel` folder** is dropped at publish, along with `node_modules` and `.env` files. See [what gets uploaded](/publish#what-gets-uploaded). diff --git a/content/guides/migrate.mdx b/content/guides/migrate.mdx index cd53a4ce..1e555739 100644 --- a/content/guides/migrate.mdx +++ b/content/guides/migrate.mdx @@ -1,11 +1,22 @@ --- -title: Copy a website -description: Copy a public website into a static Space from your browser or with sf migrate, then finish the move with a claim and a domain +title: Migrate a website or app +description: Pick the right migration path for a static website, framework repo, multi-app workspace, HTTP-only script, legacy Spacefast app, or another platform --- -Give Spacefast the URL of a live website and it publishes a static copy to a new Space. Your original website stays where it is, and copying it again makes another Space. +Pick the path that matches what you have today. Every path leaves your existing website untouched until you point your custom domain. -## Copy from your browser +## Choose your migration path + +| What you have | Fastest mechanical path | +| --- | --- | +| Public static website (no source repo) | Open [spacefast.com/migrate](https://spacefast.com/migrate/) or run `sf migrate site https://example.com` | +| Framework repository (Astro, Next.js, Vite, SvelteKit, Nuxt, Docusaurus, Hugo) | Follow the mechanical recipe ([Astro](/guides/recipes/astro), [Next.js](/guides/recipes/next), [Vite](/guides/recipes/vite), [SvelteKit](/guides/recipes/sveltekit), [Nuxt](/guides/recipes/nuxt), [Docusaurus](/guides/recipes/docusaurus), [Hugo](/guides/recipes/hugo)) and run `sf publish` | +| Multi-app workspace (pnpm, Turborepo, Bun, npm workspaces) | Follow [Multi-app workspaces](/guides/recipes/workspaces) with `--root-directory` and `--install-directory` | +| Another platform (Vercel, Netlify, Cloudflare Pages, GitHub Pages, Glitch, Val Town, here.now) | Follow [Move from another platform](/guides/migrate-from) | +| Legacy `zero.config.ts` or `content.managed` Spacefast app | Run `sf migrate app --from zero` (or `--from content.managed`) | +| No CLI (HTTP request only) | Upload directly via [`POST /v1/publish`](#publish-with-a-single-http-request) | + +## Copy a public website from your browser Open [spacefast.com/migrate](https://spacefast.com/migrate/), paste the address, and select **Migrate**. If you belong to more than one team, pick the one that receives the copy. @@ -13,24 +24,24 @@ The page shows each step and counts pages as they're copied. A small website tak Keep the tab open until it finishes. Signed in, the copy keeps going if you close it, and the new Space shows up in your [dashboard](https://my.spacefast.com). Signed out, the tab holds your only claim link, so if you close it you can't claim the copy. -When it finishes, the page links to the copy and says how many pages it copied. Check it before you move anything. See [Know what the copy contains](#know-what-the-copy-contains). +When it finishes, the page links to the copy and says how many pages it copied. Check it before you move anything. See [What the site capture includes](#what-the-site-capture-includes). -## Copy from the CLI +## Copy a public website from the CLI -`sf migrate` does the same from a terminal. It doesn't read your current directory. +[`sf migrate site`](/cli/reference/migrate#sf-migrate-site-url) (shorthand: [`sf migrate`](/cli/reference/migrate#sf-migrate-url)) runs the same capture from a terminal. It doesn't read your current directory. ```bash -sf migrate https://example.com +sf migrate site https://example.com ``` The CLI starts a capture build, follows it until the copy is published, and prints the result. A capture takes a while. The build can run for up to 75 minutes, and the CLI waits 15 minutes by default. To wait for the whole capture, raise the timeout: ```bash -sf migrate https://example.com --wait-timeout 4500 +sf migrate site https://example.com --wait-timeout 4500 ``` ```text -sf migrate URL [--team ] [--name ] [--idempotency-key ] +sf migrate site URL [--team ] [--name ] [--idempotency-key ] [--wait | --no-wait] [--wait-timeout ] [--show-secret] ``` @@ -53,7 +64,43 @@ sf migrate URL [--team ] [--name ] [--idempotency-key ] The global flags (`--api-url`, `--profile`, `--token`, `-y`, `--json`) also apply. See [`sf migrate`](/cli/reference/migrate#sf-migrate-url) and [the CLI overview](/cli). -## Choose what the URL can be +## Move a legacy Spacefast app to SpacePress (`sf migrate app`) + +Convert a `zero.config.ts` or `content.managed` project into SpacePress source files offline without running user code: + +```bash +sf migrate app --from zero --dry-run +sf migrate app --from zero +sf check +sf publish +``` + +Pass `--from content.managed` for a legacy managed-content project, `--dir ` to target a subdirectory, and `--force` to overwrite existing files. The command validates that the generated SpacePress project compiles before writing anything. + +## Publish with a single HTTP request + +If you cannot install `sf`, upload static files or an archive in one `POST` to [`/v1/publish`](/api/reference/publishing/createpublish) (full machine contract at `https://spacefast.com/publish-spec.json`): + +```bash +# Single or multiple files as multipart/form-data +curl -sS -X POST https://api.spacefast.com/v1/publish \ + -H "Authorization: Bearer $SPACEFAST_API_KEY" \ + -F "files=@index.html" +``` + +```bash +# Entire site as a ZIP archive (application/zip, application/x-tar, or application/gzip) +curl -sS -X POST https://api.spacefast.com/v1/publish \ + -H "Authorization: Bearer $SPACEFAST_API_KEY" \ + -H "Content-Type: application/zip" \ + --data-binary @site.zip +``` + +Omit the `Authorization` header to publish an unclaimed anonymous Space and receive a `claim` link and `sfc_` Space key. New Spaces start private: open the access link in the response or make the Space public with [Spacefast Share](/share). + +For declared multi-file manifests (`Content-Type: application/json`), send file paths and byte sizes (`{ "files": [{ "path": "index.html", "size": 28 }] }`, not inline file contents), upload each file to its returned signed upload target, and call [`finalizeSpaceVersion`](/api/reference/versions/finalizespaceversion). + +## Allowed source URLs The URL must: @@ -63,7 +110,7 @@ The URL must: - not be a Spacefast hostname - be at most 2,048 characters long -## Know what the copy contains +## What the site capture includes The capture renders the website as portable HTML and publishes those files as a static Space. If the capture produces no HTML file, the build fails. @@ -120,9 +167,9 @@ Use the same URL, `--team`, `--name`, and credential as the first run. The CLI k To return at once and check later, pass `--no-wait`. The receipt has the build ID. Follow it with [`sf builds logs`](/cli/reference/builds#sf-builds-logs-build), or repeat the run with the key. -## Finish the move +## Claim and attach a custom domain -1. To keep an anonymous copy, open the **Claim** link and pick a team. An unclaimed copy stops serving after 33 hours and 20 minutes. See [The clock](/agents/anonymous-and-claim#the-clock). +1. To keep an anonymous copy, open the **Claim** link and pick a team. An unclaimed copy stops serving after 33 hours and 20 minutes. See [Expiry and recovery window](/agents/anonymous-and-claim#expiry-and-recovery-window). 2. To serve the copy on your own domain, attach the domain to the new Space. See [Custom domains](/domains). 3. To edit the copy after you claim it, download it with `sf spaces download --space` and the ID from the `Space` line. Change the files, then publish them with `sf publish --space` and the same ID. diff --git a/content/guides/recipes/astro.mdx b/content/guides/recipes/astro.mdx index 900ac24d..f88467f1 100644 --- a/content/guides/recipes/astro.mdx +++ b/content/guides/recipes/astro.mdx @@ -5,11 +5,11 @@ description: Build an Astro Space and publish dist, with optional config and dev Astro is detected by its `astro` dependency, or by an `astro.config` file in `.mjs`, `.js`, `.ts`, `.cjs`, `.mts`, or `.cts`. -## What to build +## Build command The default `astro build`. Spacefast uses that command when your `package.json` has no `build` script of its own. -## The output directory +## Output directory `dist`. @@ -19,14 +19,52 @@ The default `astro build`. Spacefast uses that command when your `package.json` sf publish ``` -That detects Astro, installs dependencies, runs the build, and uploads `dist`. If you would rather build yourself: +That detects Astro, installs dependencies, runs `astro build`, and uploads `dist`. To build locally and upload the output directly: ```bash npm run build sf publish ./dist --prebuilt ``` -## What the receipt shows +## Move an existing Astro site to Spacefast + +Follow these mechanical steps to move an Astro project off Vercel, Netlify, or Cloudflare: + +1. **Remove the old platform adapter** (`@astrojs/vercel`, `@astrojs/netlify`, or `@astrojs/cloudflare`) from `package.json` and `astro.config.*`: + +```bash +npm uninstall @astrojs/vercel @astrojs/netlify @astrojs/cloudflare +``` + +2. **Choose static or server-rendered output:** + - **Static site (default):** remove `output: "server"` and `adapter` from `astro.config.mjs`. `astro build` emits static HTML into `dist`. + - **Server-rendered (SSR) routes:** install `@spacefast/astro` and set the Spacefast adapter (requires Astro 6 or newer; `sharp` runs at build time only): + +```bash +npm install @spacefast/astro +``` + +```js astro.config.mjs +import { defineConfig } from "astro/config"; +import spacefastAstroAdapter from "@spacefast/astro/adapter"; + +export default defineConfig({ + output: "server", + adapter: spacefastAstroAdapter(), +}); +``` + +3. **Move redirects, headers, and env vars:** keep redirects and headers in `spacefast.config.ts` (Spacefast also imports existing `vercel.json`, `netlify.toml`, `_redirects`, and `_headers`). Set required build variables with `sf env set KEY value`. +4. **Build and publish:** + +```bash +npm run build +sf publish ./dist --prebuilt +``` + +Or run `sf publish` to let Spacefast build remotely. If you added `spacefast.config.ts` or routing files, run `sf check` first to validate them. New Spaces start private: open the returned access link, or change access with [Spacefast Share](/share). + +## Publish receipt ```text Published: https://quiet-harbor.space.fast @@ -62,7 +100,7 @@ export default defineConfig({ }); ``` -## The gotcha +## Routing validation (`failOnRoutingError`) The integration's `failOnRoutingError` defaults to `true`. A malformed line in `_redirects` or `_headers` stops `astro build` with an error instead of shipping a Space whose routing silently fails. This means adding the integration can break a build that used to pass. Set `failOnRoutingError: false` to downgrade it to a log line while you fix the file. diff --git a/content/guides/recipes/docusaurus.mdx b/content/guides/recipes/docusaurus.mdx new file mode 100644 index 00000000..8eef3a91 --- /dev/null +++ b/content/guides/recipes/docusaurus.mdx @@ -0,0 +1,33 @@ +--- +title: Docusaurus +description: Build and move a Docusaurus documentation site to Spacefast with sf publish +--- + +Spacefast detects Docusaurus from the `@docusaurus/core` dependency, runs your `package.json` `build` script, and publishes `build`. + +## Move or configure a Docusaurus project + +1. **Check `url` and `baseUrl`** in `docusaurus.config.ts` (or `.js`) so links resolve at the root of your Space: + +```ts docusaurus.config.ts +const config = { + url: "https://my-docs.space.fast", + baseUrl: "/", +}; +``` + +2. **Move redirects or headers** from `vercel.json`, `netlify.toml`, or `@docusaurus/plugin-client-redirects` into `spacefast.config.ts` (see [Redirects and rewrites](/redirects)). +3. **Build and publish:** + +```bash +npm run build +sf publish ./build --prebuilt +``` + +Or let Spacefast build remotely from source: + +```bash +sf publish --remote +``` + +New Spaces start private: open the returned access link to verify docs pages and search, then adjust access in [Spacefast Share](/share) and repeat on your custom domain once HTTPS is active. See [Frameworks and builds](/guides/frameworks) for build overrides and variables. diff --git a/content/guides/recipes/html.mdx b/content/guides/recipes/html.mdx index 0cfd0e31..e253706c 100644 --- a/content/guides/recipes/html.mdx +++ b/content/guides/recipes/html.mdx @@ -5,7 +5,7 @@ description: Publish a folder of HTML, CSS, and images with no build step and no A folder of HTML, CSS, images, and fonts publishes as it sits on disk. No toolchain, no config file. -## What to build +## Source files Nothing. Write `index.html` and put the assets next to it. @@ -17,7 +17,7 @@ my-space/ logo.svg ``` -## The output directory +## Output directory The folder itself. There is no build output to find, so you hand `sf publish` the directory you wrote. @@ -29,7 +29,7 @@ sf publish ./my-space A single file works too. `sf publish ./index.html` sends one file and serves it at `/index.html`. -## What the receipt shows +## Publish receipt ```text Published: https://quiet-harbor.space.fast @@ -43,7 +43,7 @@ Published: https://quiet-harbor.space.fast `about.html` answers `/about`, and `/about.html` redirects there, because clean URLs are on by default. To add custom redirects, rewrites, or response headers, declare them in `spacefast.config.ts` (see [Redirects and rewrites](/redirects) and [Response headers](/headers)); `_redirects` and `_headers` files also work as optional migration conveniences. -## The gotcha +## Avoid accidental framework detection `sf publish` decides between "upload this" and "build this" from the file names in the folder. A `package.json`, a lockfile, or a framework config file sitting next to your `index.html` flips it to the build path. Then it installs dependencies and looks for a build command you may not have. diff --git a/content/guides/recipes/hugo.mdx b/content/guides/recipes/hugo.mdx new file mode 100644 index 00000000..b545d966 --- /dev/null +++ b/content/guides/recipes/hugo.mdx @@ -0,0 +1,31 @@ +--- +title: Hugo +description: Build and move a Hugo site to Spacefast with sf publish +--- + +Spacefast detects Hugo from `hugo.toml` or `config.toml`, runs `hugo`, and publishes `public`. + +## Move or configure a Hugo project + +1. **Set `baseURL`** in `hugo.toml` (or pass `--baseURL` when building): + +```toml hugo.toml +baseURL = "https://my-site.space.fast/" +``` + +2. **Ensure themes are present:** if your site uses a Git submodule theme, initialize it before building (`git submodule update --init --recursive`), or vendor the theme files in `themes/`. +3. **Move redirects or headers** from `netlify.toml` or `vercel.json` into `spacefast.config.ts` (see [Redirects and rewrites](/redirects)). +4. **Build and publish:** + +```bash +hugo --minify +sf publish ./public --prebuilt +``` + +Or let Spacefast build remotely from source: + +```bash +sf publish --remote +``` + +New Spaces start private: open the returned access link to verify pages and asset paths, then adjust access in [Spacefast Share](/share) and repeat on your custom domain once HTTPS is active. See [Frameworks and builds](/guides/frameworks) for build overrides and variables. diff --git a/content/guides/recipes/meta.ts b/content/guides/recipes/meta.ts index ddf27024..bb15bb66 100644 --- a/content/guides/recipes/meta.ts +++ b/content/guides/recipes/meta.ts @@ -1,3 +1,19 @@ import { defineMeta } from "blume"; -export default defineMeta({ title: "Recipes", collapsed: false, pages: ["html", "vite", "next", "astro"] }); +export default defineMeta({ + title: "Recipes", + collapsed: false, + pages: [ + "spacepress-blog", + "spacepress-app", + "html", + "vite", + "next", + "astro", + "sveltekit", + "nuxt", + "docusaurus", + "hugo", + "workspaces", + ], +}); diff --git a/content/guides/recipes/next.mdx b/content/guides/recipes/next.mdx index 86edd455..593c95a4 100644 --- a/content/guides/recipes/next.mdx +++ b/content/guides/recipes/next.mdx @@ -5,7 +5,7 @@ description: Build a Next.js app with the bundled Spacefast adapter on a support Spacefast detects Next.js from its `next` dependency. A project that also depends on `nextra` matches the Nextra row instead, which builds and outputs the same way. -## What to build +## Build command Spacefast runs `next build` by default. On Next 16.4.5 and later 16.4 releases, the CLI first points Next at the bundled `@spacefast/next-adapter` through the `NEXT_ADAPTER_PATH` environment variable, so you add nothing to `next.config`. The adapter opts the build into immutable static assets and writes down what Next produced for the classifier to read. @@ -18,7 +18,7 @@ Spacefast runs `next build` by default. On Next 16.4.5 and later 16.4 releases, Spacefast builds the same releases OpenNext 1.20.17 supports. Its minimum versions follow Next.js security releases, so every older release has published [security advisories](https://github.com/vercel/next.js/security/advisories), and Spacefast refuses to build it. Only stable releases count; Spacefast refuses canary and other prerelease versions. -## The output directory +## Output directory Static exports write to `out`. Server-rendered builds package the server entry and static assets automatically. @@ -30,7 +30,7 @@ sf publish Add redirects, headers, crons, or custom build settings in `spacefast.config.ts` if you need them; see [Project configuration](/config-file). -## What the receipt shows +## Publish receipt ```text Published: https://quiet-harbor.space.fast diff --git a/content/guides/recipes/nuxt.mdx b/content/guides/recipes/nuxt.mdx new file mode 100644 index 00000000..c2757b2e --- /dev/null +++ b/content/guides/recipes/nuxt.mdx @@ -0,0 +1,42 @@ +--- +title: Nuxt +description: Build and move a Nuxt project to Spacefast with static generation and sf publish +--- + +Spacefast detects Nuxt from the `nuxt` dependency, runs `nuxt generate`, and publishes `.output/public`. + +## Move or configure a Nuxt project + +1. **Remove platform-specific Nitro presets** (such as Vercel or Netlify presets) from `nuxt.config.ts`: + +```ts nuxt.config.ts +export default defineNuxtConfig({ + ssr: true, +}); +``` + +2. **Add redirects, headers, or SPA fallback** in `spacefast.config.ts` if your app uses client-side fallback routing: + +```ts spacefast.config.ts +import { defineConfig } from "spacefast/config"; + +export default defineConfig({ + fallback: "/200.html", +}); +``` + +3. **Move dynamic API routes (if any):** move `server/api/*` handlers that require live server execution into [Workers](/functions) under `functions/api/`. +4. **Build and publish:** + +```bash +npx nuxt generate +sf publish ./.output/public --prebuilt +``` + +Or let Spacefast build remotely from source: + +```bash +sf publish --remote +``` + +New Spaces start private: open the returned access link to verify rendered routes and assets, then adjust access in [Spacefast Share](/share) and repeat on your custom domain once HTTPS is active. See [Frameworks and builds](/guides/frameworks) for build overrides and variables. diff --git a/content/guides/recipes/spacepress-app.mdx b/content/guides/recipes/spacepress-app.mdx new file mode 100644 index 00000000..1757bc35 --- /dev/null +++ b/content/guides/recipes/spacepress-app.mdx @@ -0,0 +1,85 @@ +--- +title: SpacePress full-stack app +description: Build a full-stack SpacePress app with SQL tables, typed server actions, Sign in with Spacefast, progressive forms, and background jobs +--- + + + +Build a full-stack app with [SpacePress](/build) using a dedicated MySQL table, server-validated `query()` and `mutation()` actions, built-in Sign in with Spacefast (`/__spacefast/sign-in`), and an Action Scheduler background job, with no external database, auth server, or Node.js process required. + +## 1. Scaffold the app and auth routes + +```bash +sf init my-app +cd my-app +sf add auth +sf add form +``` + +`sf add auth` scaffolds Sign in with Spacefast routes (`/__spacefast/sign-in?return=/path/`) and `/account`, and `sf add form` scaffolds a progressive zero-JS contact form wired straight to a validated server mutation. + +## 2. Declare a SQL table in `sp/schema.ts` + +Use `table({ ... })` for relational app records with owner-scoped server access rules (never trust a user ID sent from the browser): + +```ts sp/schema.ts +import { boolean, table, text } from "spacepress"; + +export const tasks = table( + { + title: text().min(1).max(120), + done: boolean().default(false), + ownerId: text(), + }, + { + access: { + read: ({ user }) => (user ? { ownerId: user.id } : false), + create: "authenticated", + update: ({ user }) => (user ? { ownerId: user.id } : false), + delete: ({ user }) => (user ? { ownerId: user.id } : false), + }, + }, +); +``` + +## 3. Add typed server actions in `sp/tasks.ts` + +SpacePress infers input validation directly from your TypeScript parameter types and exposes every `query()` and `mutation()` at `POST /wp-json/spacepress/v1/actions/` and as a WordPress Ability: + +```ts sp/tasks.ts +import { mutation, query } from "spacepress"; +import { HttpError } from "spacepress/server"; +import { tasks } from "spacepress/server/db"; + +export const listMyTasks = query( + { access: "authenticated" }, + async ({ limit }: { limit: number }) => { + return tasks.list({ where: { done: false }, limit }); + }, +); + +export const completeTask = mutation( + { access: "authenticated", idempotent: true }, + async ({ id }: { id: number }) => { + const row = await tasks.update(id, { done: true }); + if (!row) throw new HttpError(404, "not_found", "Task not found"); + return row; + }, +); +``` + +## 4. Validate and publish + +```bash +sf check +sf publish +``` + +Open the returned access link, sign in through `/__spacefast/sign-in`, verify a task mutation saves and reloads, then repeat on your custom domain once HTTPS is active. Preview publishes (`sf publish --target preview`) run against an isolated SQLite database per version so preview testing never touches live MySQL data. + +## Next steps + +- [Actions, queries, and jobs](/actions): transactional hooks, `job()` background queues, and custom HTTP routes +- [Database and ORM](/database): compound indexes, forward-only SQL migrations, and `sf db` +- [App users](/users): managed Google, Gravatar, and Spacefast sign-in settings +- [Workers](/functions): add `"use worker";` or `functions/` routes when you need Node-compatible npm packages or streaming AI responses (`sf add ai-route`) diff --git a/content/guides/recipes/spacepress-blog.mdx b/content/guides/recipes/spacepress-blog.mdx new file mode 100644 index 00000000..f6769427 --- /dev/null +++ b/content/guides/recipes/spacepress-blog.mdx @@ -0,0 +1,90 @@ +--- +title: SpacePress blog and CMS +description: Scaffold a SpacePress blog with typed collections, Markdown sync, drafts, revisions, RSS feeds, XML sitemaps, and TSX pages in one Space +--- + + + +Build a typed blog and CMS with [SpacePress](/build) in five mechanical steps. Spacefast compiles your schema and TSX templates to native managed WordPress and PHP on publish, with drafts, revisions, staged versions, RSS/Atom feeds, XML sitemaps, and Markdown twins (`*.md`) built in. + +## 1. Scaffold the project + +```bash +sf init my-blog +cd my-blog +``` + +## 2. Declare the `posts` collection in `sp/schema.ts` + +Extend WordPress's built-in `posts` kind with typed fields, pretty URLs, Markdown sync, and optional comments (keep schema declarations in `sp/schema.ts` and `defineConfig` in `spacepress.config.ts`; never declare both `spacepress.config.ts` and inline `app` in `spacefast.config.ts`): + +```ts sp/schema.ts +import { text, wp } from "spacepress"; + +export const posts = wp.posts.extend( + { + subtitle: text().max(200).optional(), + }, + { + url: "/blog/:slug", + sync: "content/posts/*.md", + comments: { moderation: "first-time", threaded: 2 }, + }, +); +``` + +```ts spacepress.config.ts +import { defineConfig } from "spacepress"; + +export default defineConfig({ + name: "my-blog", + seed: true, +}); +``` + +## 3. Add TSX pages under `sp/app/` + +Read published posts through `spacepress/server/db`, which enforces collection access rules automatically: + +```tsx sp/app/blog/page.tsx +import { posts } from "spacepress/server/db"; + +export const metadata = { + title: "Blog", + description: "Latest updates", +}; + +export default async function BlogIndex() { + const items = await posts.list({ status: "publish", limit: 20 }); + return ( +
+

Blog

+ +
+ ); +} +``` + +## 4. Validate and publish + +```bash +sf check +sf publish +``` + +Open the returned access link to check `/blog`, `/feed/`, and `/wp-sitemap.xml`, then repeat on your custom domain once HTTPS is active. + +## What ships automatically + +- **Editorial workflow:** Drafts, scheduled publishing (`future`), native revisions with `_rev` conflict protection, staged versions (`sp_preview`), and SpacePress Admin at `/wp-admin/new/`. +- **Feeds and SEO:** RSS 2.0 (`/feed/`), Atom (`/feed/atom/`), XML sitemaps (`/wp-sitemap.xml`), `robots.txt`, and structured `metadata` tags. +- **Agent-readable output:** Markdown twins at `/blog/.md` and a `/llms.txt` index. +- **Two-way Markdown sync:** Run `sf sync pull` and `sf sync push` to sync `content/posts/*.md` with edits made in SpacePress Admin. + +See [Collections and CMS](/collections) and [WordPress and Content API](/wordpress) for field modifiers, custom feeds, focal-point media crops, and three-way content sync. diff --git a/content/guides/recipes/sveltekit.mdx b/content/guides/recipes/sveltekit.mdx new file mode 100644 index 00000000..484d48b3 --- /dev/null +++ b/content/guides/recipes/sveltekit.mdx @@ -0,0 +1,95 @@ +--- +title: SvelteKit +description: Build and move a SvelteKit project to Spacefast using @sveltejs/adapter-static and sf publish +--- + +Spacefast detects SvelteKit from the `@sveltejs/kit` dependency, runs your `package.json` `build` script, and publishes `build`. + +## Move or configure a SvelteKit project + +1. **Remove any platform adapter and install `@sveltejs/adapter-static`** matching your `@sveltejs/kit` major version: + +```bash +npm uninstall @sveltejs/adapter-auto @sveltejs/adapter-vercel @sveltejs/adapter-netlify @sveltejs/adapter-cloudflare + +# SvelteKit 3 (@sveltejs/kit ^3) +npm install -D @sveltejs/adapter-static + +# SvelteKit 2 (@sveltejs/kit ^2) +npm install -D @sveltejs/adapter-static@^3 +``` + +2. **Point your adapter config at `@sveltejs/adapter-static`** (SvelteKit 3 configures the adapter inside `vite.config.*`; SvelteKit 2 configures it in `svelte.config.js`): + + + + +Replace the `@sveltejs/adapter-auto` (or old platform adapter) import in `vite.config.js` or `vite.config.ts`: + +```js vite.config.js +import adapter from "@sveltejs/adapter-static"; +import { sveltekit } from "@sveltejs/kit/vite"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [ + sveltekit({ + adapter: adapter({ + pages: "build", + assets: "build", + }), + }), + ], +}); +``` + + + + +Replace the adapter import in `svelte.config.js`: + +```js svelte.config.js +import adapter from "@sveltejs/adapter-static"; +import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; + +export default { + preprocess: vitePreprocess(), + kit: { + adapter: adapter({ + pages: "build", + assets: "build", + }), + }, +}; +``` + + + + +3. **Enable prerendering or SPA mode:** + - **Prerendered site (default):** keep `fallback` unset (setting `fallback: "index.html"` overwrites a prerendered `build/index.html`) and export `export const prerender = true;` in `src/routes/+layout.js` (or `+layout.ts`). + - **Single-page app (SPA):** set `fallback: "index.html"` in `adapter(...)`, export `export const ssr = false;` in `src/routes/+layout.js`, and add `fallback: "/index.html"` in `spacefast.config.ts`: + +```ts spacefast.config.ts +import { defineConfig } from "spacefast/config"; + +export default defineConfig({ + fallback: "/index.html", +}); +``` + +4. **Move server endpoints (if any):** rewrite `+server.ts` routes that run at request time as [Workers](/functions) under `functions/`. +5. **Build and publish:** + +```bash +npm run build +sf publish ./build --prebuilt +``` + +Or let Spacefast build remotely from source: + +```bash +sf publish --remote +``` + +New Spaces start private: open the returned access link, or change access with [Spacefast Share](/share). See [Frameworks and builds](/guides/frameworks) for build overrides and variables. diff --git a/content/guides/recipes/vite.mdx b/content/guides/recipes/vite.mdx index db61724d..0fbec212 100644 --- a/content/guides/recipes/vite.mdx +++ b/content/guides/recipes/vite.mdx @@ -7,11 +7,11 @@ Vite is detected by its `vite` dependency, or by a `vite.config` file in `.js`, A framework built on Vite matches its own row first. Astro, VitePress, Nuxt, SvelteKit, SolidStart, and TanStack Start all sit above Vite in the table, so this recipe is for a plain Vite app. -## What to build +## Build command The default `vite build`. -## The output directory +## Output directory `dist`. @@ -21,7 +21,7 @@ The default `vite build`. sf publish ``` -## What the receipt shows +## Publish receipt ```text Published: https://quiet-harbor.space.fast @@ -46,7 +46,7 @@ export default defineConfig({ See [Project configuration](/config-file), [Redirects and rewrites](/redirects), and [Response headers](/headers). -## The plugin +## Validate builds with `@spacefast/vite-plugin` `@spacefast/vite-plugin` is optional. It checks that the Vite build can be published before you find out in production, and it can also compile inline or optional `_redirects` and `_headers` files in `vite dev`. @@ -59,7 +59,7 @@ export default defineConfig({ }); ``` -## The gotcha +## Static vs. SPA mode The plugin's `mode` defaults to `static`, and a static build whose output holds no `.html` file anywhere fails the build. A blank Space is a real outcome of a misconfigured Vite entry, and failing is more useful than deploying it. diff --git a/content/guides/recipes/workspaces.mdx b/content/guides/recipes/workspaces.mdx new file mode 100644 index 00000000..8f49b60b --- /dev/null +++ b/content/guides/recipes/workspaces.mdx @@ -0,0 +1,54 @@ +--- +title: Multi-app workspaces +description: Publish one or more apps from a pnpm, Turborepo, Bun, or npm workspace repository to Spacefast +--- + +Publish any app inside a multi-app workspace by pointing Spacefast at the app's `rootDirectory` and installing dependencies from the workspace root with `installDirectory`. + +## Configure in `spacefast.config.ts` + +Place `spacefast.config.ts` inside the app directory (for example `apps/web/spacefast.config.ts`) or at the repository root: + +```ts apps/web/spacefast.config.ts +import { defineConfig } from "spacefast/config"; + +export default defineConfig({ + build: { + rootDirectory: "apps/web", + installDirectory: ".", + installCommand: "pnpm install --frozen-lockfile", + buildCommand: "pnpm --filter web build", + outputDirectory: "dist", + }, +}); +``` + +## Publish from the CLI + +### Option 1: Build locally, upload output directly + +```bash +pnpm --filter web build +sf publish ./apps/web/dist --prebuilt --space my-web-space +``` + +Omit `--space` to publish to a new Space. New Spaces start private: open the returned access link, or change access with [Spacefast Share](/share). + +### Option 2: Remote build from workspace root + +```bash +sf publish . --remote \ + --root-directory apps/web \ + --install-directory . \ + --build-command "pnpm --filter web build" \ + --output-directory dist \ + --space my-web-space +``` + +## Multiple Spaces in one workspace repository + +1. **Create one Space per app:** run `sf spaces create --name web` and `sf spaces create --name docs`. +2. **Link each app directory separately:** run `sf link --space ` inside `apps/web` and `sf link --space ` inside `apps/docs` (each directory gets its own `.spacefast/space.json`). +3. **Connect GitHub with per-Space root directories:** connect the same repository to each Space and set **Builds → Build settings → Root directory** (`apps/web` vs `apps/docs`). Spacefast skips pushes that do not touch files under that Space's `rootDirectory`. + +See [Frameworks and builds](/guides/frameworks) and [Publish from Git](/git). diff --git a/content/guides/starters.mdx b/content/guides/starters.mdx index f51678d4..0e281d05 100644 --- a/content/guides/starters.mdx +++ b/content/guides/starters.mdx @@ -98,7 +98,7 @@ printf %s "$OPENAI_API_KEY" | sf env set OPENAI_API_KEY --value-from-stdin | `--force` | Overwrite files that already exist instead of keeping them | | `--json` | Return a structured receipt with `recipe`, `directory`, `status` (`done`, `no-op`, or `planned`), `files`, `setup`, and `next` | -If every file in a recipe already exists and you omit `--force`, `sf add` reports `no-op` and changes nothing. It checks the whole target tree before writing and refuses symbolic links, missing directories, and Zero projects you have not migrated yet. Migrate Zero projects first with [`sf migrate app --from zero`](/zero-migration). +If every file in a recipe already exists and you omit `--force`, `sf add` reports `no-op` and changes nothing. It checks the whole target tree before writing and refuses symbolic links, missing directories, and Zero projects you have not migrated yet. Migrate Zero projects first with [`sf migrate app --from zero`](/guides/zero-migration). See [`sf add`](/cli/reference/add#sf-add-recipe-directory) for the full command specification. diff --git a/content/(build)/zero-migration.mdx b/content/guides/zero-migration.mdx similarity index 100% rename from content/(build)/zero-migration.mdx rename to content/guides/zero-migration.mdx diff --git a/generated/cli/index.md b/generated/cli/index.md index 0c1c6e2e..e725145a 100644 --- a/generated/cli/index.md +++ b/generated/cli/index.md @@ -8483,16 +8483,16 @@ Install MCP client config. ```text USAGE $ sf mcp install [--api-url ] [--cwd ] [-d] [--no-color] [--non-interactive] [--profile - ] [--token ] [-y] [--agent auto|all|generic|claude-code|cursor|codex|windsurf|vscode|github-copilot|ope - ncode|zed|devin-desktop|openclaw|hermes|pi|conductor|amp|warp|factory-droid|cline|claude|claude-code-cli|clawhub|cod - eium|conductor.build|copilot|droid|earendil|factory|pi.dev...] [--local | --remote | --oauth] [--read-only | + ] [--token ] [-y] [--agent auto|all|generic|cursor|openclaw|claude-code|codex|vscode|github-copilot|ope + ncode|zed|devin-desktop|conductor|orca|hermes|pi|amp|warp|factory-droid|cline|windsurf|claude|claude-code-cli|clawhu + b|codeium|conductor.build|copilot|droid|earendil|factory|pi.dev...] [--local | --remote | --oauth] [--read-only | --groups ] FLAGS --agent=