Start
Create your first content type
This tutorial grows the post content type from the Quickstart into a small
blog. You add an author content type, link each post to its author, turn on drafts and
publishing, and read a post back with its author in one call. Along the way you preview a
change before you apply it, the way you would on a live site.
You describe the shape of the content and the engine creates the storage for it in your database. You never write SQL or a migration file, and the same definition works on PostgreSQL, MySQL and SQL Server.
Before you start
Link to the section Before you start- You did step 4 of the Quickstart, or you start here: applying the definition in step 4
below creates
postwhen it does not exist yet. - Changing content types takes the
adminorsuper_adminrole. Writing entries also works as aneditor. - For the console steps, you are signed in to LyEve Console. Its Schema builder edits each content type in a list. With Schema Pro the same editor also opens from a visual canvas of every content type.
- For the API steps,
TOKENholds a token for anadminorsuper_adminaccount. Steps 2 and 3 of the Quickstart get one. The commands run from one directory, because step 2 saves a file there.
1. Add the Author content type
Link to the section 1. Add the Author content typeConsole v0.28.0
- Open Schema builder and choose New schema.
- Enter
Authorin Display name andauthorin Machine name. - Choose Add field, name it
name, keep the typetextand tick Req. - Choose Add field, name it
bioand keep the typetext. - Choose Save.
Engine API v0.62.0
curl -X POST http://localhost:3001/api/admin/schemas \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "author", "display_name": "Author", "fields": [ { "name": "name", "field_type": "text", "required": true }, { "name": "bio", "field_type": "text" } ] }'The answer is 200 with the stored definition.
The display name is the label the console shows. A required name refuses an author
with no name.
2. Describe the new Post
Link to the section 2. Describe the new PostThe new Post keeps the Quickstart's two fields and adds two:
| What is new | What it does |
|---|---|
slug, indexed | Finding a post by its slug stays fast as the blog grows |
author | A belongs_to relation: each post points at one entry of author |
Console v0.28.0
- In Schema builder, choose Post in the list of content types.
- Choose Add field, name it
slug, keep the typetextand tick Idx. - Choose Add relation and name the field
author. Under Relation, keep Belongs to one, and pick Author in Target schema.

Engine API v0.62.0
Save this as post-schema.json:
{ "name": "post", "display_name": "Post", "with_draft_publish": true, "fields": [ { "name": "title", "field_type": "text", "required": true }, { "name": "body", "field_type": "rich_text" }, { "name": "slug", "field_type": "text", "indexed": true }, { "name": "author", "field_type": "relation", "relation_type": "belongs_to", "relation_to": "author" } ]}with_draft_publish also turns on drafts and publishing, which step 5 explains.
The data model lists every field type, every flag such as
unique and default, the validation rules and the other kinds of relation.
3. Preview the change
Link to the section 3. Preview the changeAsk what the new definition would change before you apply it.
Console v0.28.0
Choose Preview DDL. Each statement shows the SQL a save would run, and Down SQL shows the SQL that undoes it. Choose Close when you have read them.
Engine API v0.62.0
curl -X POST http://localhost:3001/api/admin/schemas/post/preview-ddl \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d @post-schema.jsonThe answer is {"statements": [...]}, each with a description, the sql an apply would
run and the down_sql that undoes it. The file also turns on drafts, so the API's preview adds
a status column.
For this change you see a column for slug and its index, and for the author a column, a step that clears links to authors that do not exist, a foreign
key and an index. Nothing changes until you apply.
4. Apply it
Link to the section 4. Apply itConsole v0.28.0
Choose Save. The badge beside the name reads Saved. The Post has no drafts yet, and step 5 turns them on.
Engine API v0.62.0
curl -X POST http://localhost:3001/api/admin/schemas \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d @post-schema.jsonThe answer is 200 with the definition as stored. The Quickstart's first post, written before
drafts were on, is now published. Applying the same file again changes nothing.
The engine compares the new definition with the stored one and changes only what differs. Existing entries keep their values.
Removing a field later does not delete its data right away. The removal waits until a super admin applies it, so a mistaken edit loses nothing. The data model covers renames and removals.
5. Turn on drafts and publishing
Link to the section 5. Turn on drafts and publishingWith drafts on, each post carries a status: draft, published or archived. Only the API
turns drafts on: the schema builder in console v0.25.0 has no switch for them. If you followed
the API steps, post-schema.json turned them on in step 4, so go on to step 6.
From the console path, run two commands. They use the address of Run the engine and the console together. An engine on its own takes the same calls on port 3001. Sign in with your console account and keep the token:
curl -X POST http://localhost:8080/api/admin/auth/login \ -H "Content-Type: application/json" \ -d '{"email": "you@example.com", "password": "<your password>"}'
export TOKEN="<the token from the answer>"Then save Post again with drafts turned on:
curl -X POST http://localhost:8080/api/admin/schemas \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "post", "display_name": "Post", "with_draft_publish": true, "fields": [ { "name": "title", "field_type": "text", "required": true }, { "name": "body", "field_type": "rich_text" }, { "name": "slug", "field_type": "text", "indexed": true }, { "name": "author", "field_type": "relation", "relation_type": "belongs_to", "relation_to": "author" } ] }'The answer is 200 with "with_draft_publish": true.
6. Write an author and a post
Link to the section 6. Write an author and a postConsole v0.28.0
- Open Content, choose Author and then New entry.
- Enter
Ada Lovelacein Name andWrites about engines.in Bio, then choose Create. - Open Content > Post and choose New entry.
- Enter a Title, a Slug such as
notes-on-the-engineand some text in Body. - In Author, type part of the name and pick Ada Lovelace.
- Choose Create.
A post created in the console starts as a draft. Open it and choose Publish to publish it.
Engine API v0.62.0
Create the author:
curl -X POST http://localhost:3002/api/v1/content/author \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"data": {"name": "Ada Lovelace", "bio": "Writes about engines."}}'The answer is 201 with the new entry. Copy its id:
export AUTHOR_ID="<the id from the answer>"Create a post that points at the author. A belongs_to field takes the other entry's id:
curl -X POST http://localhost:3002/api/v1/content/post \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "data": { "title": "Notes on the engine", "slug": "notes-on-the-engine", "body": "<p>A first look.</p>", "author": "'"$AUTHOR_ID"'" } }'export POST_ID="<the id from the answer>"The answer carries the link as author_id under data, and _status is published. A post
created through the Content API takes the _status its data names, such as "_status": "draft",
and is published when it names none.
7. Take it back to draft, then publish it
Link to the section 7. Take it back to draft, then publish itConsole v0.28.0
- Open the post from Content > Post and choose Unpublish. Its status in the list
reads
draft. - The Draft and Published filters above the list show the entries in each status.
- Open the post again and choose Publish.
Engine API v0.62.0
curl -X PUT http://localhost:3002/api/v1/content/post/$POST_ID/unpublish \ -H "Authorization: Bearer $TOKEN"The answer is 204 with no body. The post is a draft now, so a plain list leaves it out:
GET /api/v1/content/post returns published entries only. To see the drafts, filter on the
status. The -g flag stops curl from reading the square brackets as a pattern:
curl -g "http://localhost:3002/api/v1/content/post?filters[_status]=draft" \ -H "Authorization: Bearer $TOKEN"Publish it again:
curl -X PUT http://localhost:3002/api/v1/content/post/$POST_ID/publish \ -H "Authorization: Bearer $TOKEN"The answer is 204, and the post is back in the list.
8. Read a post with its author
Link to the section 8. Read a post with its authorReading a post together with its author is a Content API call, the one a site or an app makes. The console shows the author's name in the Author column of the Post list instead.
Find the post by its slug, and ask for the author to come with it:
curl -g "http://localhost:3002/api/v1/content/post?filters[slug]=notes-on-the-engine&populate=author" \ -H "Authorization: Bearer $TOKEN"[ { "id": "4769807e-2cbe-487b-be6f-1c87aabfbaa3", "data": { "title": "Notes on the engine", "slug": "notes-on-the-engine", "body": "<p>A first look.</p>", "_status": "published", "author_id": "6c5b5d81-fa95-448d-ab1f-385bfad85209", "author": { "id": "6c5b5d81-fa95-448d-ab1f-385bfad85209", "name": "Ada Lovelace", "bio": "Writes about engines.", "created_at": "2026-10-02T05:06:55.656177Z", "updated_at": "2026-10-02T05:06:55.656177Z" } }, "created_at": "2026-10-02T05:06:55.693943Z", "updated_at": "2026-10-02T05:07:03.696363Z" }]GET /api/v1/content/post/$POST_ID reads one post by its id, and takes populate too.
Your account may read drafts, so a draft comes back as well. A caller who may not read drafts
gets 404 for one.
- Drafts and publishing: how editors work with drafts, revisions and scheduled publishing in the console.
- Content history: turn on revisions for the content types that need them.
- Schema changes: presets, renames and the history of every change.
- Webhooks: tell another system when a post is published.
- API endpoints: paging, cursors and every other route that reads and writes entries.