Skip to content

Document versions

NFZ Docs Notion Editor 0.1.70 strengthens a document versioning foundation to secure Markdown save, delete and restore operations.

Goal

The docs-versions service stores Markdown snapshots for the current tenant. It is designed for a commercial SaaS usage: auditability, controlled restore, customer support and change evidence.

How it works

Snapshots are created automatically:

  • after a Markdown page is created;
  • before a full save;
  • before a content patch;
  • before a deletion;
  • before a restore.

Each version contains:

  • the page path;
  • the Markdown content;
  • a SHA-256 hash;
  • the size;
  • the version number;
  • the source action;
  • the actor when available;
  • the tenant;
  • the creation date.

Admin page

The /admin/versions page lets administrators:

  • filter history by page;
  • filter by action;
  • search metadata;
  • preview a version Markdown content;
  • copy the content;
  • restore an earlier version;
  • compare two versions through the Visual diff tab;
  • quickly identify added, removed or modified lines.

Security

Read and restore operations are protected by:

ini
NFZ_LICENSE_ENFORCEMENT=true
auditTrail=true

Direct client-side version creation is forbidden. Snapshots are generated server-side by NFZ/Feathers hooks.

Optimistic locking

Saving from /admin/docs-editor now uses a contentHash loaded with the page. During docs-pages.patch(), the editor sends expectedHash. If the content changed between load and save, the server returns a 409 Conflict instead of silently overwriting the page.

This is required for a multi-user SaaS edition: it prevents concurrent edit loss and encourages administrators to reload or compare versions before continuing.

Restore

A restore replaces the current Markdown content with the selected snapshot. Before overwriting, the current content is snapshotted too, so administrators can roll back.

Current limits

This iteration provides the foundation. Recommended next steps are:

  • edition-based retention policy;
  • history export;
  • more advanced Markdown block diff;
  • real-time collaborative warning when multiple administrators open the same page.

Public user guide generated with VitePress.