DruxtJS.org
Nuxt frontend and Drupal backend, built with Druxt.
This repository is the source of druxtjs.org, the documentation site for Druxt. It is also a working example of a Druxt site: its pages are Drupal content, rendered by Nuxt.
The site is two applications in one repository. nuxt/ is the frontend. It
renders the documentation with Druxt, through DruxtEntity and its wrapper
components. drupal/ is the Drupal 11 backend that editors write in.
Run the whole site on your machine, frontend and backend together. Pick one of three ways.
| Way | You need |
|---|---|
| Dev container | VS Code with Dev Containers, GitHub Codespaces, or DevPod |
| mise | mise, and three PHP extensions |
| By hand | PHP 8.3 or later, Composer and Node 16.20.1 |
| Tool | How |
|---|---|
| VS Code | Clone the repository, open it, then choose Reopen in Container |
| GitHub Codespaces | On the repository page, open Code and choose Codespaces |
| DevPod | Click the badge, or run devpod up https://github.com/druxt/druxtjs.org |
The container has Node 16.20.1, PHP 8.4, Composer and mise. Creating it runs
npm install and npm run setup, so Drupal is running when it opens. Then run
npm run dev.
.mise.toml pins Node 16.20.1 and PHP 8.4. PHP needs the gd, pdo_sqlite
and sodium extensions.
mise install
npm install
npm run setup
npm run dev
Install PHP 8.3 or later with the gd, pdo_sqlite and sodium extensions,
Composer, and Node 16.20.1. Then run:
npm install
npm run setup
npm run dev
| Command | What it does |
|---|---|
npm install | Installs the root tooling and enables the git hooks |
npm run setup | Installs Drupal on a throwaway SQLite database, fetches the pinned druxt.js for the API pages, then starts Drupal |
npm run dev | Starts the Nuxt dev server against that Drupal. The first run installs the frontend's packages |
npm run login | Prints a one-time login link for Drupal |
| Service | Address |
|---|---|
| Drupal | http://127.0.0.1:8888, or the next free port. npm run info shows which |
| Nuxt | http://localhost:3000 |
npm run setup writes Drupal's address to .env, and npm run dev reads it
from there. Setup needs network access, for Composer packages and the pinned
documentation on GitHub.
npm run login, and open the link it prints.Preview, on the edit form, shows unsaved changes. docs/backend.md explains its tabs.
An edit made here is local to this machine's database: it previews and tests the site, and is not how page text is published. See Where changes go for what belongs where.
Editors can also sign in on http://localhost:3000 and see a page's latest draft on its own URL. docs/backend.md covers the workflow and the sign-in.
The Modules, API reference and Components pages come from the druxt.js
packages. npm run docs:generate builds them locally, in the pinned druxt.js
checkout. It installs and builds druxt.js first, so the first run is slow.
| Change | Where it goes |
|---|---|
| The content model, the editor or the site's settings | Export them with vendor/bin/drush config:export in drupal/, and commit drupal/config/sync/ in a pull request |
| The frontend | A pull request with the change in nuxt/ |
| The text of a page | Drupal, where editors change it. The database is the source of truth, and page text is not taken as a pull request yet |
The site's content is stored in product
The docs MCP server is two protocol revisions behind
https://github.com/druxt/druxtjs.org/issues/214
Labels: enhancement
Package manager tabs on code blocks: npm, yarn and pnpm from one command
https://github.com/druxt/druxtjs.org/issues/189
Labels: None
Docs MCP server: search the issue queues and draft a report
https://github.com/druxt/druxtjs.org/issues/188
Labels: enhancement
Thanks for helping. This repository is the druxtjs.org documentation site, with a Drupal backend and a Nuxt frontend. The backend holds the content model and the site's configuration.
| Change | Where it goes |
|---|---|
| The text of a documentation page | Drupal, where editors change it. The database is the source of truth, and page text is not taken as a pull request yet, so report a mistake as an issue here |
| A Druxt Nuxt module | druxt/druxt.js |
| The Druxt Drupal module | drupal.org/project/druxt |
| The frontend, the content model, the editing experience or the site's configuration | This repository. Open an issue or a pull request on druxt/druxtjs.org |
The README has three ways to run the site: a dev container, mise, or by hand. Each ends with the same commands:
npm install
npm run setup
npm run dev
npm install also enables the git hooks. If you skipped install scripts, run
npm run hooks:install, or the hooks stay on disk doing nothing.
docs/backend.md covers page history and previews.
npm run lint # every linter except prose
npm test # node tests
npm run lint:prose # Vale, after `npm run lint:prose:install` once
The pre-commit hook runs the first two. The pipeline also runs the guardrail
tests in tests/, PHPUnit in drupal/, commit message and YAML lint, a
secret scan, and a provision from the committed configuration. To run
PHPUnit yourself, run vendor/bin/phpunit in drupal/ after
.devtools/assemble.
Conventional Commits. The commit-msg hook checks them, and the pipeline checks every commit in the merge request.
Title a pull request the same way. A squash merge makes the title the commit subject, so a prose title passes review and then breaks the next push to the target branch.
A change made through the admin UI stays in the database until you export it.
Run vendor/bin/drush config:export in drupal/, and commit
drupal/config/sync/ with the change that needed it.
The site is versioned by Semantic Versioning, and
CHANGELOG.md records every version. Releases before 1.0.0 count up toward
the launch of Druxt 1.0.0, which the site will celebrate as its own 1.0.0.
A release dates the changelog's Unreleased section, bumps the version in
both package.json files, and tags the commit v followed by the number, for
example v0.9.0.
This repository is public. Nothing that resolves only on a private network may
reach a tracked file, whether as a URL, in a comment or in a patch
description. npm run lint:private checks this and runs in the pipeline. To
cite something internal, describe it without the URL. A public equivalent,
such as a drupal.org issue, can be linked instead.
No commit, pull request or merge request description, or file may credit an
AI tool as an author or co-author. npm run lint:attribution checks this.