# Admin guide

# Admin guide

Running a site from the dashboard: accounts, sites, themes, pages, widgets,
menus, media, orders, and payment methods.

## Create the admin account

On first run, visit `/` or `/manage/setup`. Enter an email and password. This creates:

- A super-admin user
- A default site with the `default` theme
- Demo content (navigation, widgets, home page)

## Find your way around

- **Switch site**: the button at the top of the sidebar shows the site you are in. Open it to pick another site you can manage; the current one has a check. Under the list, **Organization settings** (admins) and **Platform admin** (super admins) open those screens.
- **View site**: the button at the right of the top bar opens the live site in a new tab.
- **Help**: at the bottom of the sidebar; it opens this guide, at the section for the screen you are on when there is one.
- **Appearance**: at the bottom of the sidebar; switch dark mode and high contrast. Your choice follows you to every browser.
- **Tour**: the first time you open Home or Pages, a three-step tour points out Pages, View site and Help. Skip it or finish it and it does not come back.

## Create a new site

1. Open the site switcher and choose **Platform admin**
2. Click **New Site**
3. Enter a name (the slug is auto-generated)
4. Optionally set a domain

## Change the theme

1. Go to your site's **Settings** (sidebar)
2. Select a theme from the **Theme** dropdown
3. Check **Default site** if this site should be served on `/`
4. Click **Save settings**

The dropdown lists whatever the theme registry loaded.

## Load demo content

1. Go to your site's **Dashboard** (sidebar)
2. Click **Load demo content**
3. This reads the theme's `seed.json` and creates menus, global widgets, and pages with widgets
4. Existing content is not overwritten, so it is safe to click more than once

## Manage pages

- **Pages** in the sidebar lists all pages with status indicators
- Click **New page** to create a page (the title auto-generates the slug and path)
- Set status to **Published** to make it visible on the public site
- Click **Widgets** on a page to add content widgets

## Manage widgets

**Global widgets** (sidebar, Widgets) appear on every page:

- Typically a navigation header and footer
- Click a widget card to expand and edit its configuration

**Page widgets** (Pages, select a page, Widgets) are specific to one page:

- Hero banners, text sections, contact forms, image blocks, and so on
- Use **Add Widget** to add, **Move Up/Down** to reorder, **Remove** to delete

The **Add Widget** picker groups the available widget types into Core,
Structured content, Media and gallery, Location and contact, Social proof,
Reactive elements, Layout and utility, and Conversion. Each entry shows its
label and a one-line description, so the picker is the quickest way to see
what a site can use. The authoritative list is `src/widgets/registry.rs`,
where every widget type is registered; the picker and the
`GET /api/widgets/types` catalog are both built from it.

Reactive elements currently has one member, `scroll_reveal`: cards that fade,
slide, or zoom into view one at a time as the visitor scrolls past them. Its
config takes an `animation` (`fade`, `slide`, or `zoom`; defaults to `fade`),
a `direction` (`up`, `down`, `left`, or `right`, used only by `slide`;
defaults to `up`), a `trigger_point` (0.0-1.0 fraction of the item visible
before it reveals, clamped into range; defaults to `0.15`), and a `stagger`
(milliseconds of delay added per item, floored at 0; defaults to `0`). An
unrecognised `animation` or `direction` falls back to its default rather than
being passed through. See `resolved_properties()` in
`src/widgets/scroll_reveal.rs` for the exact normalisation.

## Manage menus

- **Menus** in the sidebar
- Create menus with a name, slug, and **location** (for example `header`)
- Add menu items with Label and URL fields
- The `navigation` widget finds menus by matching its `menu_location` config to the menu's `location`

## Orders

- **Orders** in the sidebar (`/orders`)
- Lists every order for the site with its number, status, and total
- Click through to an order's detail page for its items, subtotal, and total
- The detail page also has a status-transition form and a checkout-initiation form, both calling the same model code the API routes use
- Order creation and status changes otherwise go through the API directly (see [api.md](/docs/storefront/api)), not the dashboard; there is still no admin-side order-creation form

## Payment methods

- **Payment methods** in the sidebar (`/payment-methods`), under Administration
- Add a method with a label, a provider (`stripe` or `manual`), and the provider's own fields: a secret key and webhook secret for Stripe, free-text instructions for manual
- A secret is write-only: the form takes it, nothing ever renders it back
- Enable or disable a method, or delete it, from the methods list
- An enabled method appears as a checkout option on an order's detail page
- If the sealing key rotates, a method whose secret can no longer be decoded shows a re-entry notice and is removed from checkout options until its credentials are resaved (`DecodedConfig::Unreadable`, `src/models/payment_method.rs`); resaving its fields clears the condition

## Media manager

- **Media** in the sidebar
- Upload images, videos, and documents
- Browse folders and create subdirectories
- Rename and delete files
- Files are stored at `data/sites/<site_id>/media/`
- The folder is created on the first upload; opening Media on a site with no uploads lists an empty library and writes nothing to disk

## Galleries

- Create a collection from the **Gallery** or **Portfolio** template, then add an entry
- The **Gallery items** panel on the entry form picks images and videos from the media library
- Drag items (or use Up and Down) to reorder, and fill in a caption and alt text for each
- Items save with the entry; a rejected save shows the error on the form and changes nothing
- Embed a gallery in a page with the **Gallery** widget, choosing grid or carousel
- Saving a gallery does not publish it: the entry lists the pages that embed it, and each needs republishing to show the change
- A file used by a gallery cannot be deleted from the media manager until it is removed from the gallery

## Account security

Each account manages its own machine credentials and recognized browsers:

- API tokens at `/{workspace}/account/api-tokens`, created and revoked there; the page names the site the token acts on, next to the create form, on the new token, and in the tokens table (each row names its own site); on a docs or blog host the token is bound to that host's site with content-only scope, the page lists only the tokens bound to it, and only a super admin can open it
- Push history and Pause syncing on the docs host's Docs sync screen (`/manage/sync`), for super admins: every push that reaches the site is listed newest first with its message, repository, commit, author, token, result and the pages it created, updated or removed, filtered by result; a failed push shows its error and says nothing on the site changed. Pause syncing holds new pushes (the site keeps the pages it has) and Resume syncing applies the newest held push of each repository once
- Docs content tokens on the docs host's Docs sync screen (`/manage/sync?tab=tokens`), for super admins: create (label, optional expiry), regenerate (revokes the old secret, mints a new one with the same label and lifetime) and revoke, each asking for your password unless you gave it in the last 10 minutes; the secret is shown once
- Recognized devices at `/{workspace}/account/devices`, where the owner sees when each was first seen and last used, which one they are reading on, and can remove any of them after confirming their password

Both are described from the API side in [api.md](/docs/storefront/api).
