Update website content without code: add an editor page to your user's DeepSpace app
Let your user update their DeepSpace app's content without code or a deploy: the content lives in a collection, a sign-in-protected edit page saves it, an admin gives the editor role, and the public page updates for everyone who has it open.
On this page
Yes, the person can change their app's content themselves on DeepSpace, without editing code and without a deploy. The content lives in a collection instead of in the page's code. A sign-in-protected /edit page saves to that collection, and the public page updates for everyone who has it open. Who may edit is a role inside the app, editor, which an admin gives on the same page, so the person never needs the developer's DeepSpace login. This works for an app that is already built and deployed, such as an event page.
It is not a full CMS: there is one form per kind of content, and this build has no drafts, approvals or version history. If the site is mostly long pages edited by many people, a website builder or CMS fits better.
Version: written for and run with deepspace@0.43.0 (changelog). Docs checked: October 29, 2026. The code on this page ran in local development on October 29, 2026, with three test accounts and a signed-out browser. It was not run on a deployed URL.
What the person can do afterwards#
- Sign in on the live app with Google or GitHub and open Edit site.
- Change the event's title, date and time, location and details, and press Save.
- See the public page change at once, for visitors who already have it open too.
- If they are an admin, let someone else edit, or stop them editing.
Visitors don't sign in; they only read. The examples use an event page from Build an event signup site for your user; the same pattern fits any short content, such as opening hours or a price list.
Questions to ask the person#
These need no technical knowledge to answer, and each answer maps to one setting below.
- Which details do you expect to change? Each becomes a field on the edit form.
- Who should be able to change them? Each of them gets the
editorrole. - Who decides who can edit? They become admins. The app owner is always one.
- Should a change go live as soon as it's saved, or does someone review it first? This build publishes on save; review needs a draft step that isn't included.
- Which Google or GitHub account owns the app? Confirm with your user before signing in or using an existing session for them.
Step 1: Move the content into a collection#
// src/schemas/event-details-schema.ts
import type { CollectionSchema } from "deepspace/schema";
export const eventDetailsSchema: CollectionSchema = {
name: "eventDetails",
columns: [
{
name: "slot",
storage: "text",
interpretation: "plain",
required: true,
immutable: true,
},
{ name: "title", storage: "text", interpretation: "plain" },
{ name: "startsAt", storage: "text", interpretation: { kind: "datetime" } },
{ name: "location", storage: "text", interpretation: "plain" },
{ name: "details", storage: "text", interpretation: "plain" },
],
uniqueOn: ["slot"],
permissions: {
"*": { read: true, create: false, update: false, delete: false },
viewer: { read: true, create: false, update: false, delete: false },
member: { read: true, create: false, update: false, delete: false },
editor: {
read: true,
create: true,
update: true,
delete: false,
writableFields: ["slot", "title", "startsAt", "location", "details"],
},
admin: { read: true, create: true, update: true, delete: true },
},
};
Register it in src/schemas.ts, after the scaffold's two:
// src/schemas.ts
import type { CollectionSchema } from "deepspace/schema";
import { usersSchema } from "./schemas/users-schema";
import { settingsSchema } from "./schemas/admin-schema";
import { eventDetailsSchema } from "./schemas/event-details-schema";
export const schemas: CollectionSchema[] = [
usersSchema,
settingsSchema,
eventDetailsSchema,
];
How the rules work:
- Everyone can read, including signed-out visitors (
'*'), so the public page needs no sign-in. editoris a role name this app defines. A collection gives a role it doesn't name its'*'rule, or nothing, so editors get only what each collection grants them by name.writableFieldslimits editors to the listed fields; they can't delete the content.uniqueOn: ['slot']keeps one row for the event (slot: 'main'), so two editors can't create two versions of it.- The Durable Object checks these rules on every write, so a signed-in member who isn't an editor can't change the content even outside the page.
Step 2: Show the content on the public page#
Replace the hard-coded event text with a query. Pages under src/pages/(app)/ get the data layer, and the scaffold's <RecordProvider allowAnonymous> lets signed-out visitors read what '*' allows:
// src/pages/(app)/event.tsx
import { useQuery } from "deepspace";
type EventDetails = {
slot: string;
title?: string;
startsAt?: string;
location?: string;
details?: string;
};
export default function EventPage() {
const { records, status } = useQuery<EventDetails>("eventDetails", {
where: { slot: "main" },
});
const event = records[0]?.data;
if (status === "loading" && !event) return <p>Loading…</p>;
if (!event) return <p>Event details are coming soon.</p>;
return (
<article>
<h1>{event.title}</h1>
{event.startsAt && <p>{new Date(event.startsAt).toLocaleString()}</p>}
{event.location && <p>{event.location}</p>}
{event.details && (
<p style={{ whiteSpace: "pre-wrap" }}>{event.details}</p>
)}
</article>
);
}
Step 3: Add the edit page#
The edit page requires sign-in with <AuthGate>, shows the form to editors and admins, and lets admins choose who edits:
// src/pages/(app)/edit.tsx
import { useState } from "react";
import {
AuthGate,
useAuth,
useMutations,
useQuery,
useUser,
useUsers,
} from "deepspace";
type EventDetails = {
slot: string;
title?: string;
startsAt?: string;
location?: string;
details?: string;
};
type Field = "title" | "startsAt" | "location" | "details";
const FIELDS: Field[] = ["title", "startsAt", "location", "details"];
function Editor() {
const { userId } = useAuth();
const { user } = useUser();
const { users, setRole } = useUsers();
const { records } = useQuery<EventDetails>("eventDetails", {
where: { slot: "main" },
});
const { createConfirmed, putConfirmed, ready } =
useMutations<EventDetails>("eventDetails");
const [edits, setEdits] = useState<Partial<Record<Field, string>>>({});
const [message, setMessage] = useState("");
const current = records[0];
const role = user?.role;
if (role !== "editor" && role !== "admin") {
return (
<p>
You're signed in, but you can't edit this site. Ask an admin to make you
an editor.
</p>
);
}
const value = (f: Field) => edits[f] ?? current?.data[f] ?? "";
const change = (f: Field, v: string) => setEdits((e) => ({ ...e, [f]: v }));
async function save() {
setMessage("");
const patch = Object.fromEntries(
FIELDS.map((f) => [f, value(f)]),
) as Partial<EventDetails>;
try {
if (current) await putConfirmed(current.recordId, patch);
else await createConfirmed({ slot: "main", ...patch });
setEdits({});
setMessage("Saved. The public page shows the change now.");
} catch {
setMessage("Not saved. Only editors and admins can change the site.");
}
}
return (
<>
<h2>Edit event details</h2>
<input
value={value("title")}
onChange={(e) => change("title", e.target.value)}
placeholder="Event title"
/>
<input
type="datetime-local"
value={value("startsAt")}
onChange={(e) => change("startsAt", e.target.value)}
/>
<input
value={value("location")}
onChange={(e) => change("location", e.target.value)}
placeholder="Location"
/>
<textarea
value={value("details")}
onChange={(e) => change("details", e.target.value)}
placeholder="Details"
/>
<button disabled={!ready} onClick={save}>
Save
</button>
{message && <p role="status">{message}</p>}
{role === "admin" && (
<>
<h2>Who can edit</h2>
{users
.filter((u) => u.id !== userId)
.map((u) => (
<p key={u.id}>
{u.email ?? u.name}, {u.role}
{u.role === "editor" && (
<button onClick={() => setRole(u.id, "member")}>
Stop editing
</button>
)}
{u.role === "member" && (
<button onClick={() => setRole(u.id, "editor")}>
Make editor
</button>
)}
</p>
))}
</>
)}
</>
);
}
export default function EditPage() {
return (
<AuthGate>
<Editor />
</AuthGate>
);
}
useUser().user.role is the signed-in person's role in this app. setRole accepts any role name, and the server refuses it from anyone who isn't an admin. In the local run, a role change reached the person's open page without a reload: the form appeared when they were made an editor and disappeared when editing was stopped.
Step 4: Let the editor role show in the nav and the user directory#
The scaffold's nav type lists only the built-in roles. In src/nav.ts, allow editor and add the two pages:
// src/nav.ts
roles?: (Role | 'editor')[]
{ path: '/event', label: 'Event' },
{ path: '/edit', label: 'Edit site', roles: ['editor', 'admin'] },
In src/schemas/users-schema.ts, give editors the same users rule as members, so the role behaves like a member everywhere else:
editor: { read: 'own', create: false, update: 'own', delete: false },
Step 5: Check it with three accounts and a visitor#
This Playwright test uses a signed-out browser as the visitor and three signed-in test accounts. It checks:
- the visitor's open page shows the owner's saved details;
- people who aren't editors can't edit;
- someone made an editor can change the location, and the visitor sees the change;
- editing stops when the admin says so;
- the content is still there after a reload.
It uses the SDK's users fixture, which signs in @deepspace.test accounts; npx deepspace test accounts list --usable shows the ones saved on this machine. Creating new test accounts uses the developer's session, so confirm with your user first.
// tests/content.spec.ts
import { test, expect } from "deepspace/testing";
// Names of three usable test accounts. OWNER must be the app owner for the run (see below).
const OWNER = "Owner Tester";
const A = "Tester A";
const B = "Tester B";
test("content editing: editors change the public event page without code", async ({
users,
page,
}) => {
test.setTimeout(120_000);
const [owner, a, b] = await users([OWNER, A, B]);
const visitor = page; // signed out
// 1. A signed-out visitor sees the placeholder.
await visitor.goto("/event");
await expect(
visitor.getByText("Event details are coming soon."),
).toBeVisible();
// 2. The owner fills in the event and saves; the visitor's open page shows it.
await owner.page.goto("/edit");
await owner.page.getByPlaceholder("Event title").fill("Autumn workshop");
await owner.page
.locator("input[type=datetime-local]")
.fill("2099-11-14T18:00");
await owner.page.getByPlaceholder("Location").fill("Main hall");
await owner.page.getByPlaceholder("Details").fill("Bring a laptop.");
await owner.page.getByRole("button", { name: "Save" }).click();
await expect(owner.page.getByRole("status")).toContainText("Saved.");
await expect(
visitor.getByRole("heading", { name: "Autumn workshop" }),
).toBeVisible();
await expect(visitor.getByText("Main hall")).toBeVisible();
// 3. A and B sign in and open /edit: neither can edit yet.
for (const u of [a, b]) {
await u.page.goto("/edit");
await expect(u.page.getByText("you can't edit this site")).toBeVisible();
}
// 4. The owner makes A an editor; A's open page shows the form, and A's change reaches the visitor.
await owner.page.reload();
await owner.page
.locator("p", { hasText: a.email })
.getByRole("button", { name: "Make editor" })
.click();
await expect(a.page.getByPlaceholder("Location")).toBeVisible();
await expect(a.page.getByPlaceholder("Location")).toHaveValue("Main hall");
await a.page.getByPlaceholder("Location").fill("Room 204");
await a.page.getByRole("button", { name: "Save" }).click();
await expect(a.page.getByRole("status")).toContainText("Saved.");
await expect(visitor.getByText("Room 204")).toBeVisible();
// 5. B is still not an editor.
await b.page.reload();
await expect(b.page.getByText("you can't edit this site")).toBeVisible();
// 6. The owner stops A editing; A's open page loses the form.
await owner.page
.locator("p", { hasText: a.email })
.getByRole("button", { name: "Stop editing" })
.click();
await expect(a.page.getByText("you can't edit this site")).toBeVisible();
// 7. After a reload, the visitor still sees the saved details.
await visitor.reload();
await expect(
visitor.getByRole("heading", { name: "Autumn workshop" }),
).toBeVisible();
await expect(visitor.getByText("Room 204")).toBeVisible();
});
The owner is always admin, and the owner is the developer's account, which the fixture can't sign in. For the test run, make a test account the owner: run npx deepspace dev start once so it writes .dev.vars, stop it, set OWNER_USER_ID in .dev.vars to the userId of the OWNER account in ~/.deepspace/test-accounts.json, and run Playwright directly. The CLI rewrites .dev.vars on the next dev start, which undoes the change:
npx playwright test -c tests/playwright.config.ts tests/content.spec.ts
Delete .wrangler/state, the local development data, to run it again from empty.
Step 6: Deploy once#
This change needs one deploy; after it, content changes need none. A deploy records the commit it ships, so commit first. .dev.vars is git-ignored and deploy never reads it, so the test owner change doesn't ship:
git add -A && git commit -m "Editable event details"
npx deepspace deploy --json
serving: "confirmed" in the result means fresh connections are answered by the new release; see deployment. The live app starts with no event details, so the owner opens Edit site once and saves them.
Give the person edit access without sharing credentials#
- The person edits as themselves: they sign in on the live URL with their own Google or GitHub account, and the owner presses Make editor next to them on
/edit. If they own the app, they are already an admin and can edit. - No DeepSpace account is needed to edit. Never hand over the owner's
~/.deepspace/sessionfile; it acts as the owner's DeepSpace account. - Code changes are a different access. Someone who needs to change code and deploy is added with
npx deepspace app collaborators add <email>, which also gives read and write access to every secret, so confirm with your user first. See collaborators.
Common failures and how to fix them#
| What you see | Cause | Fix |
|---|---|---|
| "Not saved. Only editors and admins can change the site." | The signed-in account is a member, or writableFields doesn't list a field the form sends |
Have an admin press Make editor, or add the field to writableFields |
| An editor sees "you can't edit this site" | They signed in with a different Google or GitHub account than the one made editor | As an admin, check the accounts listed on /edit and make the one they use an editor |
| The public page shows "coming soon" on the live app | Nobody has saved the details on the live app yet; local data doesn't deploy | Open Edit site on the live URL and save |
| Signed-out visitors see a blank page | allowAnonymous was removed from the scaffold's <RecordProvider> |
Put it back; this app has public pages |
A type error on roles: ['editor', 'admin'] in src/nav.ts |
The nav type allows only the built-in roles | Widen it to (Role | 'editor')[] (step 4) |
| A second "main" event can't be created | uniqueOn: ['slot'] allows one |
Expected; edit the existing one |
Fields read as undefined |
Reading r.title |
Fields live under r.data.title |
What to tell the person#
- Where to edit:
https://<app-name>.app.space/edit, or Edit site in the menu once signed in. - How to sign in: with Google or GitHub, as themselves. No developer account is needed.
- What they can change: the event's title, date and time, location and details. Changes are live as soon as they press Save.
- Who else can edit: the editors and admins listed on the edit page. An admin can add or remove editors there.
- What isn't included: drafts, approvals, version history and images, unless you built them. A saved change replaces the previous text, so keep a copy of anything they may want back.
What is available today, and what is planned#
Available today, in published deepspace@0.43.0:
- Collections stored in SQLite inside the app's Durable Object, with permissions enforced on the server for every role, including roles the app names itself
writableFields,uniqueOnandsetRolefor an editor role- Public reads for signed-out visitors with
'*'and the scaffold'sallowAnonymous - Sign-in for app users with Google or GitHub
- Real-time updates to open pages
- Deploys to
<app-name>.app.spacefrom the CLI with a DeepSpace account, which a person creates by signing in with GitHub or Google
In testing on staging, not production: agent accounts that register themselves by solving a math challenge. Production signup for agents is not enabled.
Planned: autonomous agent accounts in production, so the app can be created and kept without a person's DeepSpace sign-in. Under that plan, payments and legal actions will still require a human. See DeepSpace for agents.
Building editable sites for a business? See deep.space/enterprise.