metacore Start a pilot

Showcase · Content management

A CMS, as one domain.

Pages, sections and authors, with texts in each language and pictures rendered at every width. A reviewer who did not write a page approves it, and a publication rolls back in one step.

The domain, as its schema declares it

3 entities and 7 layers, 4 roles and 4 atoms, in one file.

Model

Each entity, split by who changes it.

A layer is a group of fields that change together: it is the unit of a permission, of an approval and of a release. Its scope is the lowest level at which a value may differ.

EntityLayerScopeKindFields
pagemainglobalReleasedkind, author, section, published_on, featured
textslanguageReleased, second personheadline, summary, body, reading_minutes
medialanguageReleasedcover, attachments
statsglobalOverlayviews
sectionmainglobalReleasedparent, position
textslanguageReleasedtitle, path
authormainglobalReleasedname, bio, email

The entities and their layers

A released layer publishes and rolls back. A dated one holds values by period, one stated once never changes, balances add up, and an overlay is written live by another system.

Roles

A role holds what a job needs, and no more.

A role names operations on layers. Where a person works is in the grant: one role serves every scope value, and a grant gives it on one.

RoleReadsChangesDecides, starts and calls
writerpage, section, authorpage.main, page.texts, page.mediaStarts editorial.
reviewerpageNothingApproves page.texts. Rolls back page.texts. Decides the stage review of editorial.
chiefpage, section, authorsection.main, section.texts, author.mainCalls publish.
siteNothingpage.statsNothing

Who does what

The engine checks each operation for every caller: a person, a system or an AI agent.

Flow

People decide, and your code acts.

The schema holds no formula and no condition. Whatever computes is an atom: your code, which the engine calls outside itself or in a sandbox.

AtomKindWhat it does
reading_timeEnricherDerives fields of page.texts at each change.
style_guideGate ruleJudges each change of page.texts before it is live: pass, reject, or hold for a person.
publishHandlerChanges page.main. Emits page_published. A caller with the grant calls it.
refreshHandlerGives done.

What computes

An atom returns its effects as data, and the engine checks each one.

  1. WrittenA writer changes the texts of a language
  2. JudgedA gate rule checks them against the style guide
  3. ReviewedA reviewer who did not write them approves
  4. PublishedA handler publishes, and the site is built again

A publication, step by step

Each step is a run with its own audit entry.

Connections

What comes in, and what goes out.

A third party reaches the domain through a webhook, and a handler reaches a third party through the engine. A schema holds no address and no secret: an admin binds each one in each environment.

NameKindHow
translationsWebhookThe third party sends a token with each notification. It starts refresh.
after_publishTriggerAfter the event page_published: it starts refresh.
page_publishedEventA handler emits it for a page. Other domains and the event stream follow it.

The connections of the domain

Every system meets the engine at one public API.

Boundaries

What the engine gives, and what you build.

metacore is not a product of this kind. It is the engine under one that you build: the guarantees come with it, and the rest is yours.

From the engineWhat you get
A public APITyped from the schema, for every entity. There is no private interface.
A back officeEvery record at every level, from the schema, with no code.
Access controlA role holds an operation, on a layer, at a scope value.
Approvals and releasesA change waits where a person must approve it, publishes in one step, and rolls back in one step.
An audit trailAn entry is written in the same step as the operation it records.
Search, events and MCPBuilt in, from the same schema.

With no code

The same for every domain.

Yours to buildHow it meets the engine
The schemaThis file. It is the whole model, and it changes only by deployment.
The atoms4 in this domain, in your repository and in your language.
The siteAn app of yours. It reads the published pages through the public API.
The editor of rich textYours too. The back office edits each field as it is.
The translation vendorIt tells through a webhook when the texts of a language are ready.

In your code

A product of this kind brings its own screens. Here they are yours.

Schema

The whole domain, in one file.

Every table of this page is read from this file. The check of the CLI finds no problem in it.

cms.txtpb
# proto-file: metacore/api/v1/schema.proto
# proto-message: metacore.api.v1.Schema

# The content of a site: pages with their texts and their pictures, in
# sections, with an editorial workflow. A message of metacore.api.v1.Schema,
# in the text format of Protocol Buffers.
#
# A page is one record, by its slug:
#
#   main   global    what the page is, and where it stands
#   texts  language  what a reader reads: a change waits for a second person
#   media  language  its cover and its attachments
#   stats  global    how often it is read: an overlay that the site writes live
#
# The reading time is derived by an enricher, and a gate rule judges a change
# of the texts against the style guide: both are atoms, because a schema
# holds no formula and no condition.
#
# A writer sends a page to its review, which starts a workflow instance for
# its slug: a reviewer who did not send it approves it, and then the handler
# publishes it. The translation vendor tells through a webhook when the texts
# of a language are ready.
#
# The org declares the scope language under global before the first
# deployment.

entities {
  name: "page"
  key { name: "slug" type: FIELD_TYPE_TEXT }
  layers {
    name: "main"
    scope: "global"
    fields { name: "kind" type: FIELD_TYPE_TEXT required: true allowed_values: "news" allowed_values: "guide" allowed_values: "landing" }
    fields { name: "author" type: FIELD_TYPE_REFERENCE reference { entity: "author" carries: "name" } }
    fields { name: "section" type: FIELD_TYPE_REFERENCE reference { entity: "section" } }
    fields { name: "published_on" type: FIELD_TYPE_DATE exposed: true }
    fields { name: "featured" type: FIELD_TYPE_BOOLEAN }
  }
  layers {
    name: "texts"
    scope: "language"
    second_person: true
    hold_timeout { seconds: 259200 }
    fields { name: "headline" type: FIELD_TYPE_TEXT max_length: 140 exposed: true }
    fields { name: "summary" type: FIELD_TYPE_TEXT max_length: 300 }
    fields { name: "body" type: FIELD_TYPE_TEXT }
    fields { name: "reading_minutes" type: FIELD_TYPE_INTEGER derived_by: "reading_time" }
  }
  # A cover stated at the global root shows in every language, and one stated
  # for a language replaces it there. The engine renders it at three widths.
  layers {
    name: "media"
    scope: "language"
    fields {
      name: "cover"
      type: FIELD_TYPE_FILE
      file {
        media_types: [FILE_MEDIA_TYPE_JPEG, FILE_MEDIA_TYPE_PNG, FILE_MEDIA_TYPE_WEBP]
        public: true
        widths: [640, 1280, 1920]
        max_bytes: 20971520
        min_width: 1280
      }
    }
    fields {
      name: "attachments"
      type: FIELD_TYPE_FILE
      list: true
      file { media_types: FILE_MEDIA_TYPE_PDF public: true max_bytes: 10485760 }
    }
  }
  layers {
    name: "stats"
    scope: "global"
    overlay: true
    fields { name: "views" type: FIELD_TYPE_INTEGER }
  }
}

entities {
  name: "section"
  key { name: "code" type: FIELD_TYPE_TEXT }
  layers {
    name: "main"
    scope: "global"
    fields { name: "parent" type: FIELD_TYPE_REFERENCE reference { entity: "section" } }
    fields { name: "position" type: FIELD_TYPE_INTEGER least { integer: 0 } }
  }
  layers {
    name: "texts"
    scope: "language"
    fields { name: "title" type: FIELD_TYPE_TEXT max_length: 80 }
    fields { name: "path" type: FIELD_TYPE_TEXT pattern: "[a-z0-9-]{1,60}" }
    # The address of a section in each language: two sections may share a
    # path in two languages, never in one.
    uniques { name: "path" fields: "path" scope: "language" ignore_case: true }
  }
}

entities {
  name: "author"
  key { name: "handle" type: FIELD_TYPE_TEXT }
  layers {
    name: "main"
    scope: "global"
    fields { name: "name" type: FIELD_TYPE_TEXT required: true }
    fields { name: "bio" type: FIELD_TYPE_TEXT max_length: 1000 }
    fields { name: "email" type: FIELD_TYPE_TEXT restricted { read_roles: "chief" write_roles: "chief" } }
    uniques { name: "email" fields: "email" scope: "global" ignore_case: true }
  }
}

roles {
  name: "writer"
  permissions { operation: OPERATION_READ entity: "page" }
  permissions { operation: OPERATION_READ entity: "section" }
  permissions { operation: OPERATION_READ entity: "author" }
  permissions { operation: OPERATION_CHANGE entity: "page" layer: "main" }
  permissions { operation: OPERATION_CHANGE entity: "page" layer: "texts" }
  permissions { operation: OPERATION_CHANGE entity: "page" layer: "media" }
  permissions { operation: OPERATION_START workflow: "editorial" }
}

roles {
  name: "reviewer"
  permissions { operation: OPERATION_READ entity: "page" }
  permissions { operation: OPERATION_DECIDE entity: "page" layer: "texts" }
  permissions { operation: OPERATION_GO_BACK entity: "page" layer: "texts" }
}

roles {
  name: "chief"
  permissions { operation: OPERATION_READ entity: "page" }
  permissions { operation: OPERATION_READ entity: "section" }
  permissions { operation: OPERATION_READ entity: "author" }
  permissions { operation: OPERATION_CHANGE entity: "section" layer: "main" }
  permissions { operation: OPERATION_CHANGE entity: "section" layer: "texts" }
  permissions { operation: OPERATION_CHANGE entity: "author" layer: "main" }
  permissions { operation: OPERATION_CALL procedure: "publish" }
}

roles {
  name: "site"
  permissions { operation: OPERATION_CHANGE entity: "page" layer: "stats" }
}

atoms {
  name: "reading_time"
  connection: "editorial"
  timeout { seconds: 2 }
  enricher { layer { entity: "page" layer: "texts" } }
}

atoms {
  name: "style_guide"
  connection: "editorial"
  timeout { seconds: 10 }
  gate_rule { layer { entity: "page" layer: "texts" } }
}

atoms {
  name: "publish"
  connection: "site"
  timeout { seconds: 30 }
  handler {
    inputs { name: "slug" type: FIELD_TYPE_TEXT required: true }
    outcomes: "published"
    outcomes: "rejected"
    changes { entity: "page" layer: "main" }
    events: "page_published"
    exposed: true
  }
}

atoms {
  name: "refresh"
  connection: "site"
  timeout { seconds: 30 }
  handler { outcomes: "done" }
}

events {
  name: "page_published"
  entity: "page"
  exposed: true
}

triggers {
  name: "after_publish"
  event { event: "page_published" }
  atom: "refresh"
}

# A reviewer approves a page, then the handler publishes it. Each outcome
# names what follows: no stage holds a condition.
workflows {
  name: "editorial"
  inputs { name: "slug" type: FIELD_TYPE_TEXT required: true }
  first_stage: "review"
  stages {
    name: "review"
    person {
      roles { role: "reviewer" }
      timeout { seconds: 259200 }
      outcomes: "approved"
      outcomes: "sent_back"
      second_person: true
    }
    transitions { outcome: "approved" next_stage: "go_live" }
    transitions { outcome: "sent_back" }
  }
  stages {
    name: "go_live"
    handler: "publish"
    transitions { outcome: "published" }
    transitions { outcome: "rejected" next_stage: "review" }
  }
}

# The translation vendor tells when the texts of a page are ready, and the
# site is built again. It sends the secret of the webhook as a bearer token.
webhooks {
  name: "translations"
  handler: "refresh"
  proof: WEBHOOK_PROOF_HEADER
  proof_header: "Authorization"
  proof_prefix: "Bearer "
}

The schema of the domain

A message of the public contract, in the text format of Protocol Buffers.

See also

Build your domain.

Declare its schema, and take it to production, self-hosted or in a managed region.

Briefing