Skip to content

Deploying data models with the Glaze CLI

The Glaze CLI provide commands for common interactions with data models to help support your development workflow.

The Glaze CLI is useful for basic data model management. For managing multiple models or more complex models, we recommend using the Glaze DevTools library.

Getting started with the Glaze CLI


npm install --global @glazed/cli

The CLI is then accessible as glaze.


Run glaze help to list the available commands. The commands for some common flows are described below.

Set up your developer account

In order to create streams that store the schemas and definitions for our data models, you'll need to use a Key DID account. If you don't already have one, you can use the did:create command. It will output a random hexademical seed that can be used as the DID_KEY environment variable or as the --key flag in the following commands.

glaze did:create

Creating data models

Creating a local model can be done using the model:create command:

glaze model:create my-model

Schemas can be added to the model, either by using a stream already present on the given Ceramic node or by creating a new one:

glaze model:add my-model schema MySchema schemaStreamReference
glaze model:add my-model schema MySchema '{"$schema":"","title":"MySchema","type":"object","properties":{}}' --key=<your key>

The model:add command can be used in a similar way to add Definitions (model:add my-model definition ...) and Tiles (model:add my-model tile ...).

Import data models

Existing models can be imported in a local model either using JSON files or locally installed packages (that can be imported by Node) using the model:import command:

glaze model:import my-model ./model-to-import.json
glaze model:import my-model package-name-of-model

Export data models as JSON

A local model can also be exported to a JSON file using the model:export command:

glaze model:export my-model ./my-model.json

Deploy to Ceramic

The model:publish command can be used to publish all the streams used by a given model:

glaze model:publish my-model
glaze model:publish ./my-model.json
glaze model:publish package-name-of-model

Optionally, a second argment can be provided to output the PublishedModel to a JSON file:

glaze model:publish my-model ./published-model.json

Next steps: Using models in your app

Aliasing your data models

Your output file can be used by the DataModel module contained in Glaze suite in order to give your model a friendly, human-readable name.

Storing and retrieving data

Your data models are now available to be used by the DID DataStore module provided by Glaze suite, which is also included in the Self.ID framework, to store and retrieve data from these data models.


In this example, we will import and publish popular Ceramic data models found in the Data Models Registry, defined by the CIP-19 "Basic Profile", CIP-21 "Crypto Accounts" and CIP-23 "Also Known As" specifications.

First, we need to install these data models from the Data Models Registry using npm:

npm install --dev @datamodels/identity-profile-basic @datamodels/identity-accounts-crypto @datamodels/identity-accounts-web

We can then import them when using the CLI in a folder where these npm packages can be resolved from, using the steps described above:

glaze model:create idx
glaze model:import idx @datamodels/identity-profile-basic
glaze model:import idx @datamodels/identity-accounts-crypto
glaze model:import idx @datamodels/identity-accounts-web
glaze model:publish idx