Forms, RSVPs, polls, task boards, guestbooks: a page that keeps what its readers send needs no server. Every static space has a small store of JSON records on its own origin, and its page talks to it with fetch. Readers must be signed in (an anonymous call gets 401), and nobody who can't open the space can read its records.
- A collection is private unless you say otherwise: each reader sees and changes only their own records, and you, the owner, see them all — so one page is the form and your results table.
- A shared collection shows everyone's records with who wrote each, and
"edit":"any"lets any reader update them (a task board). Declare modes in the page's head:<meta name="spacesheep:records" content='{"tasks":{"mode":"shared","edit":"any"}}'> - Co-owners: add
data-owners="editors"to the same tag, and everyone you shared the space with as an editor sees and changes every record, as you do. - Endpoints, under
/apion the space's own origin:GET/POST records/<collection>,PUT records/<collection>/mine(one record per person — a vote, a form),PUT/DELETE records/<collection>/<id>, andGET me. - Limits: 32 KB per record, 2,000 records per collection, 20 collections per space.
The publishing skill has the whole contract, including the thing a page gets wrong the first time: on an open page, the first call can answer 401 a moment before a signed-in reader's session arrives — wait for the spacesheep:session event before asking them to sign in.
Was this page helpful?