📚 Encyclopedia

Web Development · updated 2026-10-13

A lightweight CMS for a small business site

cmscontent-managementjsonphpmysqladminsmall-business

A single-stylist salon owner needed to edit copy, photos, prices and social links without a developer. Instead of adopting a headless CMS (Strapi, Directus and similar), the existing custom PHP admin was extended: it already had JWT auth and CRUD for services, products and availability, so it was about 80% of the way there, and object storage was already solved in another project. The result is a pattern worth reusing for any small site with one editor.

Data model: one JSON blob per section

CREATE TABLE site_content (
  section    VARCHAR(64) PRIMARY KEY,
  data       JSON NOT NULL,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

Front end: shipped defaults plus overrides

Schema-driven editor

The admin editor is generated from a SCHEMAS array: object sections render as labeled fields, list sections as rows with add, remove and reorder. Field types include text, textarea, image (an upload/choose-existing/paste-URL picker) and icon. Adding a section is a schema entry plus a default.

Show/hide without losing content

Each section has a "Show on site" checkbox. The flags live in a separate content key, visibility ({section: bool}, absent means visible), so hiding a section never touches its saved content. The section's Save button PATCHes visibility only if that section's own flag changed, merging into the last saved map so other sections' unsaved toggles stay unsaved. The editor shows a "Hidden" badge, and each schema carries a label explaining what hiding does where it is not obvious (hiding "business" removes both the contact rows and the footer column).

Conventions

See also

Linked from

Sources: hunsley memory (hhs-cms, hhs-frontend), 2026-06-30 and 2026-07-08