Content Engine

Publication & Editorial

Add draft/published lifecycles, revision histories, signed preview links, and scheduled publishing to content types.

Content Engine includes complete editorial workflows: draft and published states, historical revisions with one-click restore, signed reviewer preview URLs, and automated scheduled publishing.

Quick start

Enable publication and editorial options in your content type:

plugins/blog/src/content/post.ts
import { defineContentType, field } from "@vitnode/core/content"

export const blogPostContentType = defineContentType({
  id: "blog.post",
  tableName: "blog_posts",
  publication: { enabled: true },
  editorial: {
    enabled: true,
    revisions: { retention: 20 }, // Store up to 20 historical versions
    preview: { enabled: true, expiresInMinutes: 60 },
    scheduling: { enabled: true },
  },
  fields: {
    title: field.text({ required: true }),
  },
})

Editorial Features

1. Publication Lifecycle

When publication: { enabled: true } is enabled:

  • Records carry a status column (draft or published) and a publishedAt timestamp.
  • Unauthenticated public queries automatically filter out drafts.
  • Publishing is idempotent: the first publish stamps publishedAt, while subsequent edits preserve original publication dates.

2. Revision History

Each save creates an immutable snapshot in the generated revisions table:

  • Editors can inspect diffs between any historical version and current state.
  • One-click restore reinstates previous content while logging the change.

Share unpublished drafts with stakeholders who lack AdminCP accounts:

  • Generates HMAC-signed URLs valid for a customizable duration (e.g. 60 minutes).
  • Public frontend routes verify the preview token and stream the draft.

4. Scheduled Publishing

Pick a future release date and time:

  • The background cron worker checks scheduled items periodically.
  • Automatically transitions records to published at the specified timestamp.

Learn More