Skip to content

Admin Panel

pH7x Systems edited this page Jul 19, 2026 · 54 revisions

Admin Panel

apps/admin (package cms-admin): one FastAPI process serving the API and the server-rendered UI — Jinja templates styled natively with the ph7x design system (same tokens and local Inter/Newsreader fonts as the reference theme; no component library, no CDN, no build step). It drives cms-core, cms-validation and cms-build through their public APIs and never bypasses them.

Try it without installing anything: the demo site ships a read-only static snapshot at https://stillsite.ph7x.com/admin/ — the real admin's pages, captured with demo content; nothing there saves, by construction.

Run it

pip install -e apps/admin
cms admin create-user editor-in-chief --role admin   # prompts for a password
SARDINE_STORAGE_URL="sqlite:///content.sqlite3" \
SARDINE_ADMIN_COOKIE_SECURE=0 \
  uvicorn --factory cms_admin.app:create_app

Sign in at /login. There are no default credentials — the first account always comes from the CLI.

Configuration (environment only — no config files with secrets)

Variable Default Meaning
SARDINE_STORAGE_URL sqlite:///content.db Storage URL (create_storage)
SARDINE_ADMIN_SESSION_HOURS 12 Session lifetime
SARDINE_ADMIN_COOKIE_SECURE 1 Set 0 only for plain-http local development

Accounts and security

  • Roles (least-privilege ladder): editor < reviewer < publisher < admin, enforced server-side.
  • Passwords: argon2id hashes; sessions server-side with only the token digest stored; cookies HttpOnly + Secure + SameSite=Strict.
  • CSRF: synchronizer tokens on every authenticated state-changing request, double-submit token on the login form; failed-login rate limiting.
  • Accounts live in the storage database (shared migrations) and are never exported.

What works today (Milestone 3, phases 1–6)

  • Dashboard: content by workflow status, the translation coverage matrix (missing/outdated/complete per language), a live validation report with the publish-gate verdict.
  • Articles: list with per-language state badges, create, EN source editor (slug, category, tags, cover) with a preview rendered by the builder's own Markdown renderer (raw HTML disabled), and a side-by-side translation editor per language — the EN source read-only next to the translation form.
  • Pages and sections: metadata editor, ordered typed sections (add/reorder/remove), a dynamic field editor with kind-aware suggestions, and per-section side-by-side translation.

Editing a source marks its translations outdated automatically (checksum model). Statuses are displayed but transitions arrive with the workflow phase.

Coming next

Media library (validated uploads, alt-text management), workflow and publishing (role-gated transitions, publish gate, builds/exports from the panel), and the hardening pass (CSP, security suites, axe over admin pages). The phased plan lives in docs/PLAN.md.

The demo snapshot

python -m cms_admin.demo_export --storage content.sqlite3 --out _site/admin boots the real admin on a throwaway copy of the content, signs in as a generated demo user and captures every editorial page as inert static HTML (links prefixed, CSRF stripped, forms neutralized, read-only banner). The demo deploy runs it automatically.

Clone this wiki locally