metacore Start a pilot

Developers · Extend

A domain, declared as data.

A schema is one document: entities and keys, layers and fields, roles, atoms, events, triggers, workflows and webhooks. Every part has a type, and nothing in it computes. Write it in the text format of Protocol Buffers, or in JSON.

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

entities {
  name: "setting"
  key { name: "name" type: FIELD_TYPE_TEXT }
  layers {
    name: "value"
    scope: "team"
    fields { name: "enabled" type: FIELD_TYPE_BOOLEAN }
    fields { name: "limit" type: FIELD_TYPE_INTEGER least { integer: 0 } }
    fields {
      name: "mode"
      type: FIELD_TYPE_TEXT
      allowed_values: ["off", "shadow", "on"]
    }
  }
}

Language

Eight parts, and four steps to production.

The schema above declares one setting, with a value that can differ by team. metacore schema guide models a domain step by step, with sample schemas.

PartWhat it declares
EntityA kind of record, with a key of its own.
LayerA group of fields that change together, at one scope: the unit of a permission, an approval and a release.
FieldA typed value and its checks: required, least and greatest, length, pattern, allowed values, unique.
RoleThe operations that one job needs, on entities and layers.
AtomYour code behind a connection: a source, an enricher, a gate rule, a handler or a converter.
Event, triggerWhat a handler did, and what starts a handler or a source: a schedule, an event or a change.
WorkflowStages where people decide and handlers act.
WebhookWhere a third party notifies the domain.

The parts of a schema

A schema holds no secret and no address. A connection is a name in it, which an admin binds in each environment.

  1. metacore schema check FILE --localEvery problem of the schema alone, on your machine, with no sign-in.
  2. metacore schema check FILEChecked against what your org allows. It lists what a deployment would widen or remove.
  3. metacore schema deploy FILE --dry-runChecked against the org, the other domains and the live data. Nothing goes live.
  4. metacore schema deploy FILELive, as the next version of the schema. The data stays.

Check, then deploy

metacore schema doc -o json gives the language as a JSON Schema, for an editor or for a model that writes schemas.

Check

Every problem at once, with its path.

A check with --local runs on your machine, with no sign-in. It names where each problem is, and a reason from the public API, so an editor or a pipeline can act on it.

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

entities {
  name: "setting"
  key { name: "name" type: FIELD_TYPE_TEXT }
  layers {
    name: "value"
    scope: "team"
    fields { name: "enabled" type: FIELD_TYPE_BOOLEAN }
    fields { name: "limit" type: FIELD_TYPE_INTEGER least { integer: 10 } greatest { integer: 1 } }
  }
}
roles {
  name: "editor"
  permissions { operation: OPERATION_CHANGE entity: "setting" layer: "values" }
}
Terminal
$ metacore schema check draft.txtpb --local
PATH                                      REASON     PROBLEM
entities[0].layers[0].fields[1].greatest  INVALID    the greatest value is below the least
roles[0].permissions[0].layer             NOT_FOUND  the entity setting has no layer values
metacore: the schema has 2 problems

A draft with two problems

The command ends with 1, so a pipeline stops there. metacore schema fmt --check does the same for a file that is not in its form.

Versions

The live schema, and every version before it.

Each deployment gives the schema its next version. A version never changes, and its digest is the same in every environment, so a promotion proves what it deploys.

The schema of a domain

The back office reads the live schema as a table, and lists each version with its digest. metacore schema deploy FILE --digest DIGEST promotes what another environment runs: the engine rejects any other content.

Changes

A deployment says what it changes.

The engine compares a file with the live version before anything goes live. A change of names moves no data. A change that computes values runs your converter.

Deploy a schema to configuration in production

Schema file
configuration.txtpb

configuration.txtpb has no problem of its own, and its deployment passes its check against the org, the other domains of the environment and their data.

Against the live version 3

PartAddsRemovesRenamesChanges
Entitiessetting

Its digest: 1b5facc0103c21a612b8a6650f9f793e37ceb4dc972e550710e01788ff9e06b2

The check before a deployment

Here a file renames one field of setting. Rehearse prepares the deployment whole, reports what would fail, and makes nothing live.

A changeWhat the engine does
Renameformerly keeps the old name. No row moves, and a caller that uses the former name still gets its answer.
Wider typeAn integer becomes a decimal, or one value a list. The engine converts, and no value changes.
New key or typeA converter, an atom of yours, computes the new values. The conversion is a run, and passes the gate.
New uniquenessThe deployment prepares first: it claims every live value while the live version serves.
RemovalTwo deployments: stop the use, then remove. A part goes only when no value is stated for it.
Wider accessOnly a person deploys it. An app proposes it, and waits for an owner.

What each change takes

A deployment with a problem changes nothing, and reports every problem at once.

See also

Build your domain.

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

Briefing