DECLARATIVE
guide
9 min read

Declarative Site Blueprints (blueprint.json)

A Site Blueprint (SiteBlueprintV1) describes an entire OpenDash site structure in one validated JSON payload: site identity, folder theme activation and design token overrides, custom post types, field groups, taxonomies, entries (both classic fields and Studio blocks), navigation menus, and homepage assignment.

SiteBlueprintV1 Top-Level Schema

Every blueprint requires "blueprint_version": 1. All remaining sections are optional and validated upfront before any SQLite transaction begins.

SectionKey FieldsNotes
sitetitle, tagline, timezonetitle must be 1..=120 chars; tagline <= 240 chars
themeactivate, options, design_tokens_overrideUse "folder:<slug>" for folder-based themes
content_types[]key, label, singular_label, public, has_archive, publicationDeclares custom post types without touching Core post/page
field_groups[]key, title, description, fields[], location_rulesUses Unified Field Schema V1 field specs
taxonomies[]key, label, hierarchical, publicRegisters taxonomies prior to term insertion
terms[]taxonomy, slug, name, localeCreates or updates taxonomy terms
entries[]content_type, slug, title, status, locale, fields, builder_blocksPopulates both custom field values and Studio block trees
menus[]key, title, slot, items[{label, url}]Creates menus and optionally binds them to theme slots
readinghome_page_slugAssigns the front page after entries are created
blueprint.json json
{
  "blueprint_version": 1,
  "site": {
    "title": "Acme Developer Docs",
    "tagline": "Single-binary product documentation",
    "timezone": "UTC"
  },
  "theme": {
    "activate": "folder:opendash-starter-theme",
    "options": { "version_badge": "v1.0" }
  },
  "content_types": [
    { "key": "doc", "label": "Docs", "singular_label": "Doc", "public": true, "has_archive": true }
  ],
  "entries": [
    {
      "content_type": "page",
      "slug": "home",
      "title": "Welcome to Acme",
      "status": "published"
    }
  ],
  "reading": { "home_page_slug": "home" }
}

Apply Modes & Dry-Run Verification

Three flags govern execution across CLI, HTTP, and MCP:

  • upsert (default): Creates missing objects and updates matching keys/slugs idempotently across repeated deployments.
  • create_only: Inserts only non-existent entities; colliding keys raise a 409 Conflict (blueprint_conflict).
  • dry_run=true: Runs full schema validation and conflict analysis and returns a BlueprintApplyReport without committing SQLite changes or bumping SiteCacheEpoch.

Three Channels: CLI, HTTP & MCP

apply-blueprint.sh bash
# Dry-run locally against OPENDASH_SITE_ROOT
opendash blueprint apply blueprint.json --dry-run --mode upsert

# Apply against a remote running instance with Bearer token
opendash blueprint apply blueprint.json \
  --url https://cms.example.com \
  --token "od_pat_..." \
  --mode upsert \
  --json

Output Report & Validation Diagnostics

Successful execution returns BlueprintApplyReport (max request body 4 MiB on HTTP): { ok, dry_run, mode, counts: { content_types, field_groups, taxonomies, terms, entries, menus }, warnings }. Invalid payloads fail closed with HTTP 422 Unprocessable Entity and structured field_errors: [{ path, message }] before any write occurs.

Edit Source URL:

Search OpenDash

Use Arrow keys & Enter to navigate Full search page →