npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@onderwijsin/directus-studio-docs-bundle

v0.2.1

Published

An in-Studio documentation module and shared documentation provisioning foundation for Directus

Readme

@onderwijsin/directus-studio-docs-bundle

An in-Studio documentation module and shared article-seeding foundation. The bundle targets Directus >=12.2.0 <13, provisions its schema during startup, and provides the server-side collection and policy contract used by participating extensions. Article authoring and version promotion remain outside this bundle’s current scope.

Installation

Install the package in the Directus runtime and restart Directus:

pnpm add @onderwijsin/directus-studio-docs-bundle

The package is non-sandboxed and requires a trusted Directus installation. It is not intended for Directus Cloud environments that do not permit custom server extensions.

Configuration

The hook validates these environment variables. Defaults are enabled:

| Variable | Default | Purpose | | -------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | DIRECTUS_DOCS_ENABLED | true | Enables server-side provisioning and seeding. The client-side module remains registered because it cannot read server environment variables. | | DIRECTUS_DOCS_SEED_ENABLED | true | Article seeding gate. | | DIRECTUS_DOCS_SEEDING_STRATEGY | versioning | override or versioning reconciliation strategy. | | DIRECTUS_DOCS_SCHEMA_CHANGES_ENABLED | true | Schema provisioning gate; requires the global schema gate too. | | DIRECTUS_DOCS_SCHEMA_ABORT_ON_ERROR | true | Schema error policy. | | DIRECTUS_DOCS_MANAGE_POLICY_ENABLED | true | Manage-policy gate. | | DIRECTUS_DOCS_VIEW_POLICY_ENABLED | true | View-policy gate. |

The shared Directus extension startup and lock settings are also accepted by the hook. They are documented in the repository’s extension utilities guidance.

The article collection is fixed at studio_docs and the Studio module is named Docs. These client-side values are constants, not environment options.

DIRECTUS_DOCS_ENABLED=false disables the server-side hook, including schema and policy/data provisioning. It does not hide or unregister the Studio module: app extensions run in the browser and cannot read the server environment directly. If the module is still installed while this switch is off, it remains visible but cannot load articles unless the collection and permissions are provided by another mechanism.

Collection and policies

The hook provisions the fixed studio_docs collection with UUID articles, Markdown bodies, navigation labels, ordering, archive state, audit fields, and an optional icon. Collection versioning is enabled with archived as the archive field. The hook can also seed the unassigned Can Manage Studio Docs and Can View Studio Docs policies. The view policy only permits unarchived articles. Neither policy grants Directus Data Studio access; administrators must assign policies to roles.

Schema provisioning requires both DIRECTUS_DOCS_SCHEMA_CHANGES_ENABLED and DIRECTUS_EXTENSIONS_SCHEMA_CHANGES_ENABLED; the global switch is authoritative. Policy provisioning remains ordinary extension data work and requires DIRECTUS_DOCS_SEED_ENABLED and DIRECTUS_EXTENSIONS_DATA_SEED_ENABLED.

Startup and collection surface

The bundle registers the Docs Studio module with an empty route and the article route contract /docs/:id. It loads unarchived articles in deterministic order, renders Markdown article bodies, and shows article audit metadata. Schema provisioning runs during Directus app.before, and data seeding runs during the following awaited middlewares.before phase. This prevents participating extensions from seeding articles before the collection exists and ensures seeding completes before middleware and route setup continues.

The shared utility package exposes the server-only ensureDirectusDocumentation() contract for participating extensions. Register it from a startup.documentation() callback after passing the complete hook object to createDirectusStartupCoordinator; documentation callbacks run during awaited application startup independently of the ordinary global schema/data gates. The helper supports stable UUIDs, no-op gates, override reconciliation, and reserved incoming content versions. Article CRUD and version promotion remain planned for a later phase.

Contributing articles

An extension can contribute a stable article from its startup documentation phase:

import { ensureDirectusDocumentation } from '@onderwijsin/directus-extension-utils/server'

startup.documentation(async ({ lockProvider }) => {
  await ensureDirectusDocumentation(
    {
      id: '7b8b3a1e-38f3-4ab7-9b37-5e4c5d7f1234',
      navigation_label: 'Getting started',
      body: '# Getting started\n\nWrite the article in Markdown.',
      icon: 'menu_book',
    },
    context,
    { lockProvider, extensionName: 'My extension' },
  )
})

Article UUIDs are part of the contributor contract and must remain stable across releases. The required fields are id, navigation_label, and body; icon defaults to null, and archived to false.

Versioning and visibility

The default DIRECTUS_DOCS_SEEDING_STRATEGY=versioning leaves the current article untouched when content changes. It creates or updates the reserved incoming content version for review and never promotes that version automatically. Use override only when deployment-time seeds are the source of truth and replacing the current item is intentional.

The module requests and locally filters archived=false articles. The view policy applies the same filter for users assigned that policy. Draft or incoming versions are not shown by the module; a maintainer must review and promote versioned content through Directus.

Troubleshooting

| Symptom | Check | | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | studio_docs is missing | Enable both schema-change switches, then restart Directus. | | A contributed article is missing | Check DIRECTUS_DOCS_ENABLED, DIRECTUS_DOCS_SEED_ENABLED, and the contributor’s extensionSeedEnabled option. | | A changed article is not visible immediately | With versioning, inspect the article’s incoming version and promote it after review; use override only when appropriate. | | Users cannot see articles | Assign Can View Studio Docs to the relevant role, or assign Can Manage Studio Docs to editors. | | Startup reports a lock skip | Ensure all Directus replicas use a shared Redis or filesystem lock provider when startup coordination spans processes. |

Compatibility and non-goals

The bundle supports Directus >=12.2.0 <13 and requires a trusted, non-sandboxed Directus server runtime. It is not intended for Directus Cloud environments that do not permit custom server extensions.

The bundle does not manage article authoring, role assignment, role membership, or automatic version promotion. It does not guarantee ordering between independent init listeners; its startup coordinator guarantees that coordinator-managed schema work completes before data work begins, and that data work completes during awaited startup before Directus serves requests.