Skip to main content

What you start from

This page is the Astro template, the default. A Next.js site uses the Next template and the @sp-stage/next adapter; see Next.js sites.
The client template is a minimal Astro site that already meets the whole contract: the SDK initialised, the middleware re-exported, the /admin mount, a reference Hero component, the blog and forms renderers, the header and footer globals, the consent banner, and the analytics scripts in the base layout. Clone it and build the design out from there.
A standalone site installs @sp-stage/sdk and @sp-stage/admin from the private registry at an exact version. In the platform monorepo the template consumes them from source.

Environment

Sites hold no service-role key. The public key plus row-level security covers every read a site makes; anything needing more goes through the API.
API_URL must not end in a slash. The admin normalises it, but inline scripts in the base layout concatenate it raw, so a trailing slash produces //api/... requests.

The org

An org is a row in organizations with a settings JSON. Two settings matter on day one:
  • qa_mode: true turns inline editing on. Without it the bar reads that editing is off.
  • site_url is the canonical https:// address campaign links are minted against.
Members are rows in memberships (user_id, org_id, role of editor or admin). A person can belong to several orgs.

The admin mount

pages/admin.astro is a static shell that boots the admin. It passes the site’s schema and two switches:
The public site stays static. The preview route is server-rendered and membership-gated; it is what the edit canvas loads so a save shows on the next reload. Its gate caches allow decisions briefly and never caches a denial.

Local development

Edge middleware does not run under the dev server, so the template ships a dev-only Astro middleware that applies the same campaign-landing and private-site verdicts. It is compiled out of static builds.

Smoke test

  1. Open /admin, sign in as a member of the org.
  2. Press Edit, click the hero title, type, press Publish.
  3. The bar reads Live. With no deploy hook set it reads Failed: No deploy hook, which is expected until the site has a rebuild address.

Next steps

Anchors

The attributes that make a field editable.

Components

Build and register a renderer.